Reputation: 840
This is more a sanity check idea. Currently unused:true only makes sure the last function parameter is used, but sometimes I want to make sure that I'm using what everything passed in. Is there an override to make see all unused function parameters?
Upvotes: 0
Views: 977
Reputation: 166011
This seems to have changed between version 1.0.0 and version 1.1.0. The following code raises three warning with 1.0.0 but only one with 1.1.0:
/*jshint unused: true */
(function example(a, b, c) {
/* Don't use any of the arguments */
}());
Looking at the JSHint source (in particular, the warnUsed
function) it appears that the unused
option has gained some new functionality. You can now set it to 1 of 3 new values (it's set to last-param
by default):
var warnable_types = {
"vars": ["var"],
"last-param": ["var", "last-param"],
"strict": ["var", "param", "last-param"]
};
By setting it to strict
, the above example will once again raise 3 warnings, 1 for each argument, instead of just 1 warning for the last argument:
/*jshint unused: strict */
(function example(a, b, c) {
/* Don't use any of the arguments */
}());
Upvotes: 2