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

no-extra-parens docs do not mention arrow function parameters #8741

Closed
platinumazure opened this issue Jun 15, 2017 · 4 comments · Fixed by homezen/eslint-config-homezen#43
Closed
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules

Comments

@platinumazure
Copy link
Member

The no-extra-parens rule docs don't mention that arrow function parameter parens are always/intentionally ignored by the rule (contrast with regex literals and IIFEs, which are explicitly listed as always ignored).

In addition, the Related Rules section does not mention the arrow-parens rule.

Unsure if it might be worth adding a quick paragraph of prose about arrow parameter parens being covered by the other rule as well.

@platinumazure platinumazure added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules labels Jun 15, 2017
@TheGrandmother
Copy link

Why is the ignoring of arrow functions intentional?

And I second this addition, the current docs are a bit misleading about this.

@platinumazure
Copy link
Member Author

@TheGrandmother Because that functionality is already covered by the arrow-parens rule. We intentionally try to avoid multiple rules writing functionality identical lint errors, because otherwise it could be confusing to users.

Of course, this also requires that our documentation explain those design decisions. 😄 When the documentation isn't doing that, that is also confusing to users.

Make sense?

@TheGrandmother
Copy link

@platinumazure Yes I know that you don't want overlapping rules (which is a good thing!) but why are there two different rules? Intuitive it feels like the no-extra-parens rule should cover arrow functions as well?

@mysticatea
Copy link
Member

mysticatea commented Jun 16, 2017

That reason is simple; parentheses of arrow function parameters are not parenthesized expressions which can change precedence. no-extra-parens reports useless parenthesized expressions which don't change precedence.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants