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

Enforce "Never start a line with ( or [" #295

Closed
caesarsol opened this issue Oct 17, 2015 · 6 comments

Comments

@caesarsol
Copy link

commented Oct 17, 2015

Don't you think the rule:

Never start a line with ( or [. This is the only gotcha with omitting semicolons.

should be enforced by the eslint configuration?

@rstacruz

This comment has been minimized.

Copy link
Member

commented Oct 17, 2015

👍

@feross

This comment has been minimized.

Copy link
Member

commented Oct 18, 2015

Never starting a line with a ( or [ is already enforced. Check it out:

console.log('hi')
[1, 2, 3].forEach(console.log)

Unexpected newline between object and [ of property access. (no-unexpected-multiline)

@feross feross closed this Oct 18, 2015

@feross

This comment has been minimized.

Copy link
Member

commented Oct 18, 2015

For the record, you can add a leading semicolon in this situation, if desired:

console.log('hi')
;[1, 2, 3].forEach(console.log)

No errors.

@feross

This comment has been minimized.

Copy link
Member

commented Oct 18, 2015

Also for the record, you can test this stuff out easily on http://standardjs.com/demo.html 👍

@dcousens dcousens added the question label Oct 18, 2015

@rstacruz

This comment has been minimized.

Copy link
Member

commented Oct 19, 2015

interesting... i just tripped into a JS error because of this and standard didnt catch it. Guess i was on an old version

@feross

This comment has been minimized.

Copy link
Member

commented Oct 19, 2015

@rstacruz if you have a test case where the current version doesn't catch it, please share so we can fix that.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

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