Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upExclude semicolon is a bad practice or not #856
Comments
This comment has been minimized.
This comment has been minimized.
See the no-unexpected-multiline rule for a list of violations it'll catch. |
rstacruz
closed this
Apr 12, 2017
This comment has been minimized.
This comment has been minimized.
|
Usually prefixing the line with // Bad
window.a = 2
(function () {})()
// OK
window.a = 2
;(function () {})()
// Also OK
window.a = 2
void (function () {})() |
dcousens
added
the
question
label
Apr 12, 2017
This comment has been minimized.
This comment has been minimized.
|
When omitting semicolons, the only rule to remember is never start a line with const a = 'methodA'
const b = 'methodB'
class MyClass {
[a] = () => (5 * 7)
;[b] = () => (5 * 10)
}It looks a bit silly at first, but you quickly get used to it. |
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.
ufocoder commentedApr 12, 2017
•
edited
I use
standardand I have the following code:Of course, it will be compiled not correct. Try it online through REPL
There's the correct code:
Standardallow us not to write semicolons, but sometimes it required. How I should resolve this situation more elegantly?