-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Update: Check computed property keys in no-extra-parens #11952
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I would be okay with merging this as is, but I'll ask this: Do you want to add a couple of test cases with a mix of unnecessary and necessary parentheses, and show that only the unnecessary parentheses are removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Nice test coverage!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
2 errors.
What actually happened? Please include the actual, raw output from ESLint.
No errors.
What changes did you make? (Give an overview)
Added the
Property
handler tono-extra-parens
, to check computed property keys.This affects both
ObjectExpression
properties andObjectPattern
properties.Is there anything you'd like reviewers to focus on?
ObjectExpression
andObjectPattern
handlers instead of theProperty
handler. I'm not sure which way would be better.ObjectExpression
is already checking values.const a = { [b, c]: 1 }
is indeed a syntax error without parens around the sequence expression.