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 upRequire semicolons #1155
Comments
This comment has been minimized.
This comment has been minimized.
|
Your example would trigger both the "Unreachable code" (
Is this really consistent though? function a() {
return;
"Nope, I am sorry!";
} // <--- why is there no semicolon here?
a();
This sounds like the classic "Think of the children" argument. I don't see how not using semicolons is harder for beginners. One could even, and people do, make the argument that using semicolons is harder for beginners. Anyhow, it doesn't really matter one way or another. There is no way for us to decide which one is "best" in this thread. Standard is not using semicolons and that won't change, since it would break 100% of all projects using standard. We only introduce rule changes when they only affect a small percentage of the eco-system, and has a clear positive benefit. If you want to use semicolons, feel free to use semistandard |
danny-andrews commentedJun 23, 2018
•
edited
I know this bug will get shot down, because semi-omitters irrationally put "code aesthetics" above consistency and correctness😉 , but I will attempt to reason with you one last time, for the beginners if nothing else!
You should consider changing to require semicolons because:
no-unexpected-multilinerule is enabled:This code will pass even with
no-unexpected-newlinerule is enabled. ProofAlthough this wouldn't give you an error, you would probably never write code like this, because it's clear that you're not returning anything (because you know the semicolon ends a statement).
Pls reconsider. I'm out.
Further reading: https://hackernoon.com/an-open-letter-to-javascript-leaders-regarding-no-semicolons-82cec422d67d