Without ASI, the following would work as you'd assume, instead of returning `undefined`:
return
{
answer: 42
};
Just one of many ridiculous edge cases that would go away if ASI didn't insert a secret "helpful" semicolon at the end of the return line.Rather than making me remember all the edge cases and rules [2] that keep growing with each new syntactical feature added to the language, we should just be making your code more explicit. The rules of reading the code are simply much more complicated than they should be with ASI, and many proponents don't even understand these issues, or suggest preposterous solutions to some of these edge cases such as inserting leading semicolons[3]!
Maybe put simply: Semicolons are sometimes required. Let's just make them always required.
[1]: https://www.theregister.com/2018/01/12/javascript_technical_...
[2]: https://tc39.es/ecma262/multipage/ecmascript-language-lexica...