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 method keys in no-extra-parens #11973
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.
Thanks for contributing, and the kindly description! :)
public instance fields and static class fields is in stage-3, it means eslint don't officially support. So I don't think we can add tests for this. But other cases LGTM!
I could copy output from My comment was probably confusing. The question is - should this rule, at this moment, remove parens around computed keys of stage 3 class members, or simply ignore them? This commit ignores them ( |
I think it's okay to ignore those cases for now. eslint-plugin-babel or similar plugins could extend the rule to support those stage 3 cases. |
OK, then there is nothing to change now, the commit is in line with this. Maybe just to add a couple of babel test cases to show that the rule does not crash on such input? |
I don't think that's necessary at this point, but other team members might feel differently. |
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!
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 for contributing!
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, thank you.
Would you resolve conflicts?
I''ll resolve this better when I get back from travel. |
Rebased and ready for review now. |
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!
Thanks @mdjermanovic for contributing! I appreciate your patience as we sorted this one out |
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?
4 errors.
What actually happened? Please include the actual, raw output from ESLint.
No errors.
What changes did you make? (Give an overview)
Added
ClassBody()
tono-extra-parens
.Is there anything you'd like reviewers to focus on?
MethodDefinition()
, butClassBody()
allows to easily check computedpublic instance fields and static class fields (both are
babel-eslint
's"ClassProperty"
) in the future.Actually, it can be easily done now (without the
member.type === "MethodDefinition"
condition the code would simply check anything in the class body that hascomputed === true
), but I'm not sure is it OK to do it at this moment.class a { [b, c](){} }
is indeed a syntax error without parens around the sequence expression.