no-unused-vars highlights at wrong position
See original GitHub issueWith no-unused-vars
enabled eslint highlights the last use of the variable. If it is used left and right of an assignment it should mark the one on the left.
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Instead of this:
let x = [];
x = x.concat(x);
^
What did you expect to happen? It should be this:
let x = [];
x = x.concat(x);
^
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
no-unused-vars - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >UseState is defined but never used no-unused-vars : r/reactjs
This is a linting error. Importing stuff requires work. If you import something but never use it, resources go to waste for nothing...
Read more >Available rules - eslint-plugin-vue
Rule ID Description
vue/multi‑word‑component‑names require component names to be always multi‑word...
vue/no‑arrow‑functions‑in‑watch disallow using arrow functions to define watcher...
vue/no‑computed‑properties‑in‑data disallow accessing computed properties in data...
Read more >eslint-config-eslint | Yarn - Package Manager
... f9b70b3 Docs: Enable example highlighting in rules examples (ref #6444) (#7644) (Alex Guerrero); d50f6c1 Fix: incorrect location for no-useless-escape ...
Read more >eslint/eslint - Gitter
Something went wrong! :( ESLint: 7.12.1 ESLint couldn't find the config ... should i expect eslint --fix to things like @typescript-eslint/no-unused-vars ?
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 Free
Top 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
@aladdin-add we chose to highlight the last reference because that’s where the most likely error is. It’s easy to find the declaration but that last reference might not be obvious.
@snitin315 basically, you want the last write reference. You can tell by using
ref.isWrite()
.@snitin315 please feel free to open a PR! 😄