Reputation: 7829
I have the following snippet of code:
/* jshint -W098 */
/* jshint -W106 */
var pro6pp_auth_key = 'some key';
/* jshint +W106 */
However, I would like to re-enable option W098 afterwards. So my snippet would look like this:
/* jshint -W098 */
/* jshint -W106 */
var pro6pp_auth_key = 'some key';
/* jshint +W106 */
/* jshint +W098 */
This triggers the error
[L6:C20] W098: 'pro6pp_auth_key' is defined but never used.
For option W106 everything works fine. Am I doing something wrong? Is it a bug?
Upvotes: 4
Views: 1102
Reputation: 9309
This appears to be a bug in jshint. It can be triggered with this input:
/* jshint -W098 */
var main = function (x) {
}
/* jshint +W098 */
jshint will report the following, despite W098 being turned off.
test.js: line 2, col 9, 'main' is defined but never used. (W098)
test.js: line 2, col 23, 'x' is defined but never used. (W098)
I dug a little into the jshint source but couldn't find the exact source of the error. It appears to be related to how doFunction in src/jshint.js restores the ignore array after processing a function.
There's an open issue for this bug (1140).
Upvotes: 3