Skip to content
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

ESLint Plugin: no-unused-vars-before-return: Exempt destructuring only if to multiple properties #16799

Merged
merged 2 commits into from
Jul 31, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jul 29, 2019

Related: #15578 (comment)

This pull request seeks to apply additional restrictions in the no-unused-vars-before-return rule to treat an object destructuring of a single property as being non-exempt from consideration for the rule. This exemption exists only due to complexity in verifying that all properties of the destructuring are referenced prior to the return statement. In the case of destructuring a single property, there is no such complexity.

There was a single violation of this improvement already present in the code, fixed in 44a4ac9.

Testing Instructions:

Verify there are no lint errors:

npm run lint-js

Ensure unit tests pass:

npm run test-unit packages/eslint-plugin/rules/__tests__/no-unused-vars-before-return.js

@aduth aduth added [Type] Enhancement A suggestion for improvement. [Package] ESLint plugin /packages/eslint-plugin labels Jul 29, 2019
@aduth aduth merged commit 84bee75 into master Jul 31, 2019
@youknowriad youknowriad deleted the update/no-unused-vars-single-destructure branch July 31, 2019 12:38
@github-actions github-actions bot added this to the Gutenberg 6.3 milestone Jul 31, 2019
gziolo pushed a commit that referenced this pull request Aug 29, 2019
…y if to multiple properties (#16799)

* ESLint Plugin: Destructure references immediatley prior to use

* ESLint Plugin: Exempt object destructuring only if destructuring to more than one property
gziolo pushed a commit that referenced this pull request Aug 29, 2019
…y if to multiple properties (#16799)

* ESLint Plugin: Destructure references immediatley prior to use

* ESLint Plugin: Exempt object destructuring only if destructuring to more than one property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] ESLint plugin /packages/eslint-plugin [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants