Why would... you want that? You're trading minimal syntactic noise for possible ambiguity errors. You don't really gain anything.
Why would... you want that? You're trading minimal syntactic noise for possible ambiguity errors. You don't really gain anything.
† (if you follow these rules I memorized to show off how smart I am).
---
The theme was primarily made for me, but I published it because others might find the idea useful.
And the whole point here is that tooling eslint/prettier prevents bugs.
Prettier will turn this:
const x = foo()
[1, 2, 3].forEach(...)
into this: const x = foo()[1, 2, 3].forEach(...)
Which makes the problem pretty obvious.Btw, if you decide to avoid semicolons, one of the only rules you need to know is to prefix any line with a semicolon if it starts with "[(.
Frankly, I die inside every time I work with a semicolon codebase and have to move a semicolon just to chain onto:
promise
.then()
.catch();
+ .then();
foo
.bar()
.baz();
+ .qux();
You are making the common developer/HNer mistake of overvaluing familiarity and overestimating how hard anything slightly unfamiliar must be.I challenge you to try it the next time you write some Javascript. Don't use semis and remember the one rule I taught you.
In 30 minutes you can learn to recognize and practice handling all of the cases where a semicolon would be necessary. There is no ambiguity because the rules for statement termination are rigid. If you find it hard to navigate with only explicit semicolons, then you should brush up on your JavaScript knowledge.
And seeing as how we're on an ESLint thread... there are tools for that. ;)