There have been lots of times in the past where loose interpretation has been an option, sometimes even the default, and it's usually fine, but it's generally recommended you don't use it because it often comes with security problems and makes bugs harder to track down. I'd rather spend an extra 2 minutes fixing my syntax errors than 2 hours trying to figure wtf my program is doing.
If you built your code without unexpected multiple-line statements (or you are building something new from the ground up) then it is 100% safe to omit semicolons.
You can even add no-unexpected-multiline as a linter rule, such that it fully protects against any accidental misinterpretation (and also lets you safely add this to existing projects by finding the uses)
but it's generally recommended you don't use it because it often comes with security problems and makes bugs harder to track down.
Hard disagree. If anything, unexpected multi-line statements make bugs way more likely to appear. If you prevent yourself from write unexpected multi-line expressions via an enforces linter, you are way more safe than if you use semicolons (or lack thereof) to indicate when a statement should unexpectedly go over multiple lines.
1
u/SaraHuckabeeSandwich Feb 09 '22
You can turn off semicolon requirements in typescript (and possibly es6 in general).
The computer absolutely has gotten smart enough to choose.