no-unused-vars errors with parameters when parameter marked used later
See original GitHub issueTell us about your environment
- ESLint Version: 5.6.1
- Node Version: v9.4.0
- npm Version: 5.6.0
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
{
"parser": "babel-eslint",
"plugins": [
"babel",
"react"
],
"extends": ["plugin:react/recommended"],
"rules": {
"no-unused-vars": 1
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
The eslint-plugin-react rule for jsx-uses-vars
marks the Wrapped
parameter as used. However, no-unused-vars
doesn’t update the status of config
. The default for no-unused-vars
should not warn on parameters before the first used parameter.
import React from 'react';
import foo from 'foo';
export const AccessibilityDecorator = foo((config, Wrapped) => {
return class t extends React.Component {
render () {
return <Wrapped />;
}
};
});
eslint .
What did you expect to happen?
No warnings.
What actually happened? Please include the actual, raw output from ESLint.
/Users/.../.../test.js
4:44 warning 'config' is defined but never used no-unused-vars
✖ 1 problem (0 errors, 1 warning)
Linked issue: yannickcr/eslint-plugin-react#2009
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 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 >ESLint - Configuring "no-unused-vars" for TypeScript
It seems that es lint is not properly configured. Try uninstalling and again adding eslint in your package. · I would be surprised...
Read more >How to disable "no-unused-vars" in Visual Studio Code (or at ...
One thing that annoys the heck out of me, though, is Visual Studio Code's ESLint plugin marking any unused variable or argument as...
Read more >Disallow unused variables and arguments ( no-unused-vars ...
This rule leverages the TypeScript compiler's unused variable checks to report. This means that with all rule options set to false , it...
Read more >Unused function parameters should be removed
Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code ... When arguments is used in the function body, no parameter is reported...
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
Thanks @webOS101 for digging further! I think I rewrote that code some time ago and this was an oversight on my part.
I’ve relabeled this as a bug, in accordance with your investigation results.
I confirmed that works. I was able to create a test case that fails and passes with that fix. I still have never figured out how to use a locally linked eslint to test with either global or local installs. I guess I’ll figure it out someday. I’ll create a PR shortly.