-
-
Notifications
You must be signed in to change notification settings - Fork 5k
[no-extra-parens] Allow an exception for (new X()).y #12428
Copy link
Copy link
Closed
Closed
Copy link
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
What rule do you want to change? no-extra-parens
Does this change cause the rule to produce more or fewer warnings? Fewer, if configured
How will the change be implemented? (New option, new default behavior, etc.)? New option, similar to the existing ones like returnAssign, nestedBinaryExpressions, etc.
Please provide some example code that this change will affect:
What does the rule currently do for this code?
It requires removing the parens, i.e. that I write
This is equivalent, but it feels really weird. Although the
newoperator binds more closely than the.operator in JS, this is a somewhat-surprising feature of JS, as.otherwise binds very high, and most space-separated operators bind quite low.What will the rule do after it's changed?
Allow the above code, when a new option is configured, e.g.
"newExpressions": false.Are you willing to submit a pull request to implement this change?
Yes, although a community volunteer would be much appreciated.
Other note
This changed in v6.5.0 as part of #12302.