no-unused-vars when destructuring
See original GitHub issueTell us about your environment
- ESLint Version: ^3.14.1
- Node Version: 7.4
- npm Version: 3
What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint
Please show your full configuration:
https://github.com/gajus/eslint-config-canonical/blob/master/configurations/eslintrc.json
What did you do? Please include the actual source code causing the issue.
Using a stateless component whose first argument contains both the children
and all other props
passed to it.
I want to pass only the props
to another component:
const statelessReactComponent = ({ children, ...props }) => {
return <someOtherComponent {...props} />
};
Here it complains that “[eslint] ‘children’ is defined but never used. (no-unused-vars)”
I don’t intend to use it but I still have to define it like that because I only want to pass down props
, so the children
is required while destructuring, much like when you want to use second argument you still have to declare the first argument in a function.
What did you expect to happen?
no-unused-vars
should consider destructuring
What actually happened? Please include the actual, raw output from ESLint.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
https://github.com/eslint/eslint/issues/8119
Thank you for the report.
We have the plan to release
ignoreRestSiblings
option ofno-unused-vars
rule: #7968. Please wait for the next release.