-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Rule for braces when used semicolon free style #4114
Comments
Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. |
Also linting this possible runtime errors would end the debates about semicolons hopefully as there will be no risk any more. |
cc @feross |
I know about 2 pitfalls with omitting semicolons. Return statements
() or [] at the beginning of the line
and
|
When does this rule warn? Please describe and show example code: When options semi is defined as: (function a() {})
(function(){
}) Is this rule preventing an error or is it stylistic? ERROR Why is this rule a candidate for inclusion instead of creating a custom rule? because eslint has already a rule for semicolon free style, this options will just ensure not having side effects from using the other rule with provided options. Are you willing to create the rule yourself? it depends on how hard it is. |
Have you looked at: http://eslint.org/docs/rules/no-unexpected-multiline |
Oh this is exactly what I was looking for, I think we should link this rule within related rules of "semi" rule ... Also worth mentioning it is off by default. |
@kof where would you need a semicolon in that program? |
@michaelficarra changed it a bit to produce the effect I wanted to point out, its all fine we have a rule for this, just documentation issue. |
Now it makes a lot more sense. |
@kof all rules are off by default, so there's little value in restating that in documentation. Feel free to submit a PR for the other doc change. |
Docs: Reference no-unexpected-multiline in semi (fixes #4114)
thanks @ilyavolodin you was a bit faster) |
I personally prefer semicolon free javascript. But there are some pitfalls when braces are in place. We can add a lint rule which will ensure not to have those runtime errors.
Is eslint project itself interested in adding such a rule?
Is somebody else is interested in a separate project which can implement this rule or maybe it exists already and I missed it?
The text was updated successfully, but these errors were encountered: