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

Add no-unreadable-array-destructuring rule #199

Merged
merged 7 commits into from
Dec 15, 2018
Merged

Add no-unreadable-array-destructuring rule #199

merged 7 commits into from
Dec 15, 2018

Conversation

janowsiany
Copy link
Contributor

@janowsiany janowsiany commented Oct 5, 2018

At the moment the rule disallows more than one ignored value in series. However I can tune this, I can allow to ignore at most one value at the beginning if you find current behaviour too mild.
Fixes #197

Copy link
Contributor

@jfmengels jfmengels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have additional tests for the array destructuring in arguments, like function a([, b]) {}. From what I have gathered, it should handle this case well, but more test cases can't hurt.

Thanks @janowsiany for working on this!

rules/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
rules/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
rules/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
rules/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
Copy link
Contributor

@jfmengels jfmengels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @janowsiany!

@sindresorhus sindresorhus changed the title Add no-unreadable-array-destructuring rule Add no-unreadable-array-destructuring rule Oct 28, 2018
docs/rules/no-unreadable-array-destructuring.md Outdated Show resolved Hide resolved
test/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
rules/no-unreadable-array-destructuring.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Thanks for working on this, @janowsiany 🙌

@sindresorhus
Copy link
Owner

The rule needs to be added to the bottom of the list here: https://github.com/sindresorhus/eslint-plugin-unicorn#rules

@MrHen
Copy link
Contributor

MrHen commented Oct 29, 2018

Should this rule allow [,,...rest]? Either way, adding it to examples and tests would be good.

@janowsiany
Copy link
Contributor Author

@sindresorhus @MrHen thanks for review

@sindresorhus sindresorhus merged commit 62c51a7 into sindresorhus:master Dec 15, 2018
@sindresorhus
Copy link
Owner

Thank you, @janowsiany :)

@@ -55,7 +55,8 @@ Configure it in `package.json`.
"unicorn/error-message": "error",
"unicorn/no-unsafe-regex": "off",
"unicorn/prefer-add-event-listener": "error",
"unicorn/no-console-spaces": "error"
"unicorn/no-console-spaces": "error",
"no-unreadable-array-destructuring": "error"
Copy link
Contributor

@futpib futpib Dec 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this line missing a "unicorn/" prefix?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, thanks for noticing: 6bd6156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants