ESLint: Enable ignoreRestSiblings option for no-unused-vars rule#41897
ESLint: Enable ignoreRestSiblings option for no-unused-vars rule#41897
ignoreRestSiblings option for no-unused-vars rule#41897Conversation
|
Size Change: +148 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
ca4190c to
b8cf990
Compare
b8cf990 to
06896d7
Compare
mirka
left a comment
There was a problem hiding this comment.
Thought I'd leave it up for discussion, but looks like no one is opposed (yet)! I guess we can land it then. It's probably good to have in place, given that this is a common pattern and we won't have the Lodash omit as an escape hatch anymore.
I think we can forgo a components changelog for this one, but I'd say it's worth mentioning in the eslint-plugin changelog.
Good call, added one.
Well, I'll leave it up for now, and land it next week so if anyone has objections they can raise them in the meantime. |
What?
This PR enables the
ignoreRestSiblingsoption of theno-unused-varsESLint rule in order to allow for declaring unused variables when using spread during destructuring. Previously, we had to ignore that rule to allow this, so this PR cleans those ignores up as well.Why?
Declaring a variable in order to spread the rest of the object during destructuring is a common way to omit properties out of objects in modern JavaScript and it should be allowed by our linter.
This came up in a review by @mirka here: #41865 (comment)
How?
We're specifically enabling the
ignoreRestSiblingsoption for theno-unused-varsrule, and removing all prior rule ignore comments that are no longer necessary.Testing Instructions
Question
@ciampo @mirka we're removing a couple of ESLint rule ignore comments from the components package - does this need a CHANGELOG entry? Let me know, and I'm happy to add one.