Setting values in arguments still flags `unused var`.
See original GitHub issueTell us about your environment
ESLint Version: 3.17.1
Node Version: 6.2.2
npm Version: 3.9.5
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint 6.1.2
Configuration:
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'vue',
// required to lint *.vue files
plugins: [
'vue',
'html'
],
env: {
browser: true
},
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-return-assign': 2,
// disallow indentation using both tabs and spaces
'no-mixed-spaces-and-tabs': 2,
// ensure consistent 2 space indentation and indent cases under switch
'indent': [2, 2, {'SwitchCase': 1}]
}
}
What did you do? Please include the actual source code causing the issue.
I get no-unused-vars
for assignments in function arguments:
let bar
this.foo(bar = false)
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
How do I best silence a warning about unused variables?
Unused parameter warnings can simply be suppressed by passing -Wno-unused-parameter to the compiler, but note that this disabling flag must come after any ......
Read more >no-unused-vars and unused parameters #1939 - eslint/eslint
You'd create a new rule, find the variables you're interested in, then called markVariableAsUsed() on it. We'll add some documentation around it ...
Read more >Which style to use for unused return parameters in a Python ...
Here's a general rule: If only 1 of the returned values is used, why not simply return that 1 value ...
Read more >Warning Options (Using the GNU Compiler Collection (GCC))
Where the unused arguments lie between used arguments that are specified with ' $ ' operand number specifications, normally warnings are still given, ......
Read more >Rules - ESLint - Pluggable JavaScript Linter
The "extends": "eslint:recommended" property in a configuration file ... Disallow the use of undeclared variables unless mentioned in `/*global */` comments.
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
Yes, it’s still considered unused, because the value of
bar
is never read. So the code can be replaced with: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!