I've read the articles and that video you linked and those few little instances are the exact reason to enforce the semicolons.
I don't want to have to remember where I do need to use them, and don't want to live in fear that our juniors make a mistake remembering these rules, so no thinking necessary, always use semis.
Also, it gets confusing when mixing different languages.
Don't get me wrong I think a PSR like codestyle for JS would be great, but not with these rules unfortunately.
If you use this linter, then it will warn you in those cases you need to add a semi colon. You will be trained within a couple of days exactly where you have to add a semicolon.
But besides that, I don't see the problem about remembering one simple rule... Your juniors may make a mistake one time... So the program crashes, they figure out what they did wrong, and they fix it... Simple
Also, it gets confusing when mixing different languages.
What is exactly your point? There are several programming languages (Elixir, Erlang, Go, any LISP, Nim, Ruby, Crystal, Python, Lua, Swift to name a few) that don't use semicolons as statement terminators or make them optional. Syntax is always trivial, and if your "juniors" are making mistakes because of it, maybe it is better to send them back to school.
You can't turn off ASI just by using semicolons. Your linked bug will still happen regardless of if you use semicolons or not.
ASI is there, it's ALWAYS going to insert semicolons when they aren't there, so not using them doesn't change anything besides have less typing.
There are exactly 3 places where you need a semicolon. if a line starts with [, (, or ` and in those cases you can just prepend the line with a semicolon like so:
I'd recommend trying it at least once. It felt wrong at first (and i'm actually the one in my team that fought it until the end!), but now I can't go back.
That being said, if you really, truely, absolutely can't stand to not type ; all the time when it's not necessary, then you can use SemiStandard which is the same as Standard, but with semicolons.
Edit: I will say that using something like Standard, SermiStandard, Happiness, or another "no changes allowed" style system was a big plus for us. We had a lot of internal arguing over things like Spaces vs Tabs, where the open brace should go, should we use " or ' for strings, etc...
Standard solved it in a way that I didn't think was possible. It pretty much made everyone angry at some part of it, but it turns out that code style really doesn't matter to your productivity, as long as it stays the same. After a week of bickering if standard was worth it, we all just moved on.
14
u/PolarZoe Sep 12 '16
"Don't use ;", noped the fuck out.