[no-unused-vars] is not reported in a scenario.
See original GitHub issueI am using
eslint@2.8.0
babel-eslint@6.0.4
node v6.0.0
npm 3.8.6
My rule is set to "no-unused-vars": 1
function test(options) {
options = options || {};
// Shouldn't this should give no-unused-vars error here?
}
test({});
In above scenario since options object is not used thus IMHO this should raise no-unused-vars
error.
I tested this on online demo of eslint also.
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (12 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 >How to fix "eslint(no-unused-vars)" in vue script - Stack Overflow
Use string template to build your url correctly like below; axios.delete(`${server.baseURL}/blog/delete?postID=${id}`).then(data => {.
Read more >no-unused-vars - TypeScript ESLint
This rule extends the base eslint/no-unused-vars rule. ... Note: you must disable the base rule as it can report incorrect errors "no-unused-vars": "off",...
Read more >vue/no-unused-vars
Rule Details #. This rule report variable definitions of v-for directives or scope attributes if those are not used.
Read more >Understanding ESLint Rules - Mastering JS
Every ESLint rule has a name: this rule is called no-unused-vars . ... Suppose you have the below one-line script test.js in the...
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
Hmm… I’ve reconsidered. I think it might be sufficient to provide an option which simply says, if a variable is on LHS and RHS of an assignment, don’t assume it is used.
Also, I’m wondering about the compound-assignment operators. Do they count as usage?
If the compound-assignment doesn’t count as a use, I fail to see how unwrapped assign-after-operator (
a = a + 1
) should count as a use either.👍 for @platinumazure’s suggestion, not optional. That is, until
a
is used for something other than self assignment, consider it unused.