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` possible documentation issue #3527

Closed
IanVS opened this Issue Aug 26, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@IanVS
Copy link
Member

commented Aug 26, 2015

In the rule docs, this is not supposed to give an error, and it doesn't:

/*eslint no-extra-parens: 2*/

(function(){} ? a() : b())

(/^a$/).test(x);

However, if a semicolon is added to the end (or if the second statement is removed), it does give an error.

/*eslint no-extra-parens: 2*/

(function(){} ? a() : b());

(/^a$/).test(x);

or

/*eslint no-extra-parens: 2*/

(function(){} ? a() : b())
3:1  error  Gratuitous parentheses around expression  no-extra-parens

I'm thinking that example should have a semicolon added and moved to the "considered warnings" section, yes?

@IanVS IanVS added the triage label Aug 26, 2015

@michaelficarra

This comment has been minimized.

Copy link
Member

commented Aug 26, 2015

The rule appears to be working properly. The first program isn't doing what you think it is doing. Always use semicolons, even if you think you're familiar with how ASI works.

edit: The documentation seems to be written in a way that treats each line as a separate program. You should probably split them into separate code sections.

@IanVS

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2015

I don't pretend to know how ASI works, so I definitely stick with semicolons. :) I figured the rule was fine, and the docs were wrong due to lack of semicolons. I just wanted a sanity check due to my aforementioned lack of familiarity with ASI.

@IanVS IanVS self-assigned this Aug 26, 2015

@IanVS IanVS added documentation accepted and removed triage labels Aug 26, 2015

@gyandeeps gyandeeps added the rule label Aug 26, 2015

@nzakas

This comment has been minimized.

Copy link
Member

commented Aug 26, 2015

You are correct, sir.

gyandeeps added a commit that referenced this issue Dec 28, 2015

@gyandeeps gyandeeps closed this in fd72aba Dec 29, 2015

gyandeeps added a commit that referenced this issue Dec 29, 2015

Merge pull request #4825 from eslint/issue3527
Docs: Example fix for `no-extra-parens` rule (fixes #3527)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.