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
Exemption for for...of unused variable. #12287
Comments
This is broken for me after eslint update to v6 as well:
|
This looks like a duplicate of #12117. Can you see if the solutions there fix your issue? |
Note that this issue doesn't show in the ESLint Demo . Are you using babel-eslint? |
Yes, I use babel-eslint. Yes, updating babel-eslint fixed the issue, thanks a lot! |
Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues! |
@g-plane I could be missing something, but... I'm not sure this should be closed. The original post was a rule enhancement request for "for await of", but then someone else came and asked about "for of" and we noted the babel-eslint/eslint-scope issue. Should we still evaluate the original rule request? If not, why not? |
Oh, it seems reasonable. Sorry. |
I can only test it on Monday, sorry. |
I guess you can use varsIgnorePattern option to ignore unused variables by naming convention. For example, Online Demo. |
There's something wrong with the online demo, it says
|
None of the rules are on in the link you provided. When I turn on |
I'm so sorry for the confusion. When I read #2342 I was left with the impression that the following is allowed: for (unused in something) {} But of course that's only because It didn't think that the following is semantically different wrt. the unused variable rule and treated both cases the same: for (const unused in something) {} Weirdly there's test case for the above, as if that's valid code: eslint/tests/lib/rules/no-unused-vars.js Line 159 in 76fb571
Yet, if I "enable all rules" in the eslint demo, that very example triggers no-unused-vars 😕
In any case Also, as far I can tell I guess I'm OK then :) |
Thanks for following up! I'm going to go ahead and close this issue then. |
In similar vein to
for...in
#2342Should there be similar exemption for [async]
for...of
?What rule do you want to change?
no-unused-vars
Does this change cause the rule to produce more or fewer warnings?
fewer warnings
How will the change be implemented? (New option, new default behavior, etc.)?
I don't know
Please provide some example code that this change will affect:
What does the rule currently do for this code?
Line 42: 'unused' is defined but never used no-unused-vars
What will the rule do after it's changed?
Nothing
Are you willing to submit a pull request to implement this change?
This seems tricky...
The text was updated successfully, but these errors were encountered: