Loading ...
Sorry, an error occurred while loading the content.

2197[jslint] Re: option.unparam

Expand Messages
  • Zhami
    May 7, 2011
      --- In jslint_com@yahoogroups.com, Joshua Bell <josh@...> wrote:
      >
      > On Fri, May 6, 2011 at 3:25 PM, Zhami <stuart@...> wrote:
      >
      > > However, sometime the function is a callback and the unused param is
      > > left-wards of a param that I do use, and so must name the unused param to
      > > properly position.
      > >
      >
      > FWIW, I adopted the approach typically used in C/C++ to silence such
      > warnings without disabling them:
      >
      > (function (global) {
      >
      > function unused() {}
      >
      > function sample_function(a, b, c, d) {
      > unused(b, d);
      > // ....
      > }
      >
      > }(this));
      >
      > On the one hand, it is reasonably self-documenting and modern JS
      > environments should optimize this away. On the other, it's repetitive
      > clutter to include in every module, and seems hackish. (Perhaps we should
      > petition TC39 for Function.unused() or another standard no-op function.)

      Yes, there are ways to use effective no-ops to silence the warning (I just assign the unused parameter to a junk variable), but any such code-based approach is a code solution to a non-code problem. What really is needed is a way to tell JSLint that the param is not actually used.
    • Show all 9 messages in this topic