New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow _ to be an unused variable #800
Labels
Milestone
Comments
"no-unused-vars": [2, { "vars": "all", "args": "all", "argsIgnorePattern": "^_$" }], Is what I am using, but it doesn't cover this case... edit: "varsIgnorePattern": "^_$" Does not work for this case either, fwiw. |
@feross /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
// 'type' is ignored because it has a rest property sibling.
var { type, ...coords } = data; |
@dcousens Oh, nice. Let's use |
No ecosystem impact. This will be included in the standard v10 beta. |
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Mar 2, 2017
Fixes: standard/standard#800 The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to “omit” properties from an object, but by default the sibling properties are marked as “unused”. With this option enabled the rest property’s siblings are ignored. ```js // 'type' is ignored because it has a rest property sibling var { type, ...coords } = data ```
ZOMG this is SO going to make my day 😄 — the inability to rest on objects has been bugging me for a while. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In React, it's common to do:
This assigns all the properties of
props
exceptwidth
andheight
to the<div>
.Currently
standard
warns aboutwidth
andheight
being unused. Would be nice if we could assign these variables to_
and_2
to mark them as unused (since we can't assign them both to_
in one assignment).@dcousens Didn't you say that you have a rule modification that you use for this purpose? Can you share it?
The text was updated successfully, but these errors were encountered: