javascriptgruntjsjshintgrunt-contrib-jshint

Prevent JSHint's " 'a' is defined but never used. " for unused function parameters having following parameters?


// jshint unused:strict

var myFunc = function(a, b, c)
{
    return b+c; // a not used => JSHint warning: 'a' is defined but never used.
};

Is there a way to disable or circumvent the warning for parameters having following parameters (in the sample above for a and b)?

For unused last parameters I always comment the parameters out (or remove them).

This isn't possible for unused first parameters in JavaScript without using arguments, or is it in some kind of way?

I guess the only option that makes sense is to disable the warning for all function parameters by changing unused:strict to unused:vars (global or locally around the function)?


Solution

  • As @GOTO0 already commented, you can use

    unused:true

    to get exactly the wanted behavior.

    Source: JSHint Options Reference