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
Docs: Clarify arrow function parens in no-extra-parens (fixes #8741) #8822
Conversation
LGTM |
@platinumazure, thanks for your PR! By analyzing the history of the files in this pull request, we identified @pedrottimark, @michaelficarra and @jrvidal to be potential reviewers. |
@@ -9,6 +9,8 @@ This rule always ignores extra parentheses around the following: | |||
* RegExp literals such as `(/abc/).test(var)` to avoid conflicts with the [wrap-regex](wrap-regex.md) rule | |||
* immediately-invoked function expressions (also known as IIFEs) such as `var x = (function () {})();` and `((function foo() {return 1;})())` to avoid conflicts with the [wrap-iife](wrap-iife.md) rule | |||
|
|||
In addition, this rule ignores parentheses around arrow function arguments to avoid conflicts with the [arrow-parens](arrow-parens.md) rule. |
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.
Should this be part of the bulleted list right above it, rather than a separate paragraph?
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.
Hmm... The only reason I did that was because arrow function arguments are not an expression with malleable precedence, unlike RegExp literals and IIFEs, so it felt like apples/oranges to me. But I don't have a strong preference either way.
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.
Neither do I, so I'm satisfied by your explanation. 👍
What is the purpose of this pull request? (put an "X" next to item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
See #8741.
What changes did you make? (Give an overview)
Added note about arrow function parens being covered by
arrow-parens
instead ofno-extra-parens
. Also addedarrow-parens
to Related Rules section.Is there anything you'd like reviewers to focus on?
Not really.