For what it's worth, the recommendation about semicolons came out of a thorny conversation about what to do about semicolons in classes, since new class syntax has introduces new ASI hazards.https://twitter.com/wycats/status/951548969615736832 …
-
Show this thread
-
We considered simply requiring semicolons for class fields but decided to go with the grain of the rest of the language and allow ASI in those positions.
1 reply 0 retweets 0 likesShow this thread -
However, since we were unable to avoid introducing new ASI hazards (and expect that this will happen again), we decided to be clear with the JavaScript community that memorizing a fixed set of ASI mitigation rules is no longer a viable mitigation.
1 reply 0 retweets 2 likesShow this thread -
Using a tool that turns ambiguous cases into errors (as
@StandardJS does) does not suffer from the memorization problem, as long as programmers using the tool keep it up to date with any new syntax they wish to use.1 reply 0 retweets 0 likesShow this thread -
But to be clear: memorizing the handful of rules that mitigated ASI in ES5 is no longer a viable way to avoid mistakes (and many existing blog posts describing this mitigation are already out of date as of ES6).
1 reply 3 retweets 6 likesShow this thread -
If you (personally) have thought a lot about ASI and have a good reason to believe you're safe (for example you use a linting tool that you keep up to date), TC39 has decided to keep it working, even in class bodies. But as general advice, people should default to semicolons.
1 reply 13 retweets 15 likesShow this thread -
Automatic Semicolon Insertion.
-
-
Replying to @wycats @tenderlove
I just use no whitespace...It is all semicolons. Works great...compresses well too!
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.