False positive for no-unused-vars when first argument in an array of arguments is unused
See original GitHub issueTell us about your environment
- ESLint Version: 3.12.2
- Node Version: 7.3.0
- npm Version: 4.0.5
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
root: true
extends: airbnb-base
What did you do? Please include the actual source code causing the issue.
module.exports = (baz, [foo, bar]) => {
console.log(bar);
};
What did you expect to happen?
I expected foo
not to be marked as an unused variable, because it pads bar
. Removing foo
would alter the behaviour of the code.
What actually happened? Please include the actual, raw output from ESLint.
foo
got marked as an unused variable.
$ ./node_modules/.bin/eslint example.js
/home/remco/d-centralize/appsemble-components/appsemble-build/example.js
1:25 error 'foo' is defined but never used no-unused-vars
2:3 warning Unexpected console statement no-console
✖ 2 problems (1 error, 1 warning)
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
no-unused-vars - ESLint - Pluggable JavaScript Linter
This rule is aimed at eliminating unused variables, functions, and function parameters. A variable foo is considered to be used if any of...
Read more >ESLint - Configuring "no-unused-vars" for TypeScript
Prior to the change on my side, I had multiple false errors when using interfaces/types saying that these vars were unused (which of...
Read more >Assigned a Value but Never Used | No Unused Vars - YouTube
In react component I want to display a name but I want to read it from the app state. This name will not...
Read more >node_modules/@typescript-eslint/eslint-plugin/CHANGELOG ...
eslint-plugin: [no-unnecessary-condition] false positive when array predicate returns unknown (#2772) (111c244) ...
Read more >Low level issues - Embold Help Center
This rule applies to both array literals and destructuring assignments ... This pattern expects an Error object or null as the first argument...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vitorbal I wasn’t aware this syntax exists, but it makes sense.
Perhaps this could be added as an example to the documentation.
Given you could do something like the following, I’m not entirely sure this should be considered a bug or not: