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
Add an option to 'semi' for omitting semicolon before brace on one-line ( JSHint's 'lastsemic' ) #4385
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. |
"On one line" meaning, in a block which is contained on one line and containing only one statement? |
As best I can tell, the number of statements doesn't matter. It's that the block is on one line, so you don't need the last semicolon. These would be valid: if (foo) { bar() }
if (foo) { bar(); baz() } While these would be invalid: if (foo) {
bar()
}
if (foo) {
bar();
baz()
} We'd need to come up with a good name for the option, though, as I'm not sure |
Working on this. Should it be and additional option or a second argument for |
Probably an additional option since it would only apply to "always" |
Update: Allow to omit semi for one-line blocks (fixes #4385)
When does this rule warn? Please describe and show example code:
Current 'semi' has two options 'always' or 'never'. But I want more smart semi constraint.
Actually, this is smart exception of 'always'.
Is this rule preventing an error or is it stylistic?
This is stylistic issue.
Why is this rule a candidate for inclusion instead of creating a custom rule?
JSHint has an option like this. ref. http://jshint.com/docs/options/#lastsemic
I'm considering to use eslint instead of jshint. People who use this option may want same behavior of this.
Are you willing to create the rule yourself?
PR: #4386
The text was updated successfully, but these errors were encountered: