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
no-unused-vars with ignoreRestSiblings:true reports false-positives #14163
Comments
Confirmed, I was able to reproduce this. The problem seems to be related to using an assignment statement vs. a variable declaration. So this works as expected, with no warnings for the first three variables: // working correctly
var { folder, validFrom, validUntil, ...rest } = folderItem; However, this causes a warning for the first three variables: // working incorrectly
({ folder, validFrom, validUntil, ...rest } = folderItem); This is definitely a bug, thanks for reporting it. |
Is this a good ‘first-time’ issue? |
Hi @LulaV14! Yes, this looks like a good first issue. In this rule, restSibling logic currently checks only defs, but it should also check references. Let us know if you need any further info, and thanks for the help! |
Welcome @LulaV14! Let us know if we can help you along the way. |
No worries @LulaV14, we are all working in our spare time. |
Hi @LulaV14. Sorry for doing it without checking your progress. I should have checked but I missed it..😭 |
Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?babel-eslint
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
I believe the rule
no-unused-vars
should not be triggered.The rule is configured as
'no-unused-vars': ['error', { 'ignoreRestSiblings': true }],
.The above code splits definition and spreading of the two variables
folder
andrest
. The definition of the variables are even enclosed in adisable no-unused-vars
What actually happened? Please copy-paste the actual, raw output from ESLint.
Steps to reproduce this issue:
Are you willing to submit a pull request to fix this bug?
No, I don't think I could
The text was updated successfully, but these errors were encountered: