-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to disable unused variables per function #639
Comments
+1 |
Another use case is that when generating the documentation with JSDoc and probably others, it throws warnings when we document parameters that aren't define in the function itself. |
unused is complete not working in function scope: /*jshint unused: false*/
function test(){
/*jshint unused: true*/
var unused;
} will pass without error. I think this is a bug. |
jshint does not read the unused option in the middle of code/inside a function. |
The way I got around this was by using void... function y(x) { There is a performance hit with void if you use them on too many arguments, but it's ok with one argument, I tested it here... |
This commit makes it possible to disable 'unused' option per function: //jshint unused:true var a; function foo(b) { //jshint unused:false return 1; } foo(); // -> // Line 1: 'a' is defined but never used. Closes jshintGH-639.
HI, |
@ohmirocks This issue was closed from commit 4ac15f6 , which was intended to implement the requested feature. If it is not working for you, we'd certainly appreciate an example which demonstrates your problem |
I find the warnings regarding unused variables very useful but I would like JSHint to ignore it in certain cases.
Above is a valid use case in which I want the arguments to be there for readability but they are not used.
I tried the inline
/*jshint unused:false*/
without success.The text was updated successfully, but these errors were encountered: