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

Update: Improve no-extra-parens error message #10748

Merged
merged 1 commit into from Aug 11, 2018

Conversation

Krinkle
Copy link
Contributor

@Krinkle Krinkle commented Aug 9, 2018

When I encountered this error, it was not unclear to me what the
problem was or what alternative would be preferred.

The input was:

return ( { foo: 1, bar: 2 }[ key ] || 0 );

Receiving the following in Atom's footer:

eslint (0|4), Gratuitous parentheses around expression., Line 165, Column 17

What is the purpose of this pull request? (put an "X" next to item)

[x] Changes an existing rule (template)

@jsf-clabot
Copy link

jsf-clabot commented Aug 9, 2018

CLA assistant check
All committers have signed the CLA.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Aug 9, 2018
@platinumazure
Copy link
Member

👍 for plain English, thanks for contributing!

We do need a CLA signature before we can merge. Let us know if you need help with that. Thanks!

@platinumazure platinumazure added bug ESLint is working incorrectly rule Relates to ESLint's core rules documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 9, 2018
@not-an-aardvark
Copy link
Member

I don't feel strongly about it, but how about the word "Unnecessary" instead of "Unexpected"? "Unexpected" sort of makes it sound like the rule is broken and isn't able to handle code with parentheses, when in fact it's working as expected by reporting the parentheses.

When I encountered this error, it was not unclear to me what the
problem was or what alternative would be preferred.

The input was:

```js
return ( { foo: 1, bar: 2 }[ key ] || 0 );
```

Receiving the following in Atom's footer:

```
eslint (0|4), Gratuitous parentheses around expression., Line 165, Column 17
```

Using the phrase "Unnecessary" instead, which also matches the error
message used by other ESLint rules.
Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@platinumazure platinumazure merged commit f3d8454 into eslint:master Aug 11, 2018
@Krinkle Krinkle deleted the patch-1 branch August 13, 2018 00:41
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 8, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 8, 2019
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 bug ESLint is working incorrectly documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants