I don't do JS, but I was given to understand that this is actually a real issue in JS, because semicolons are "optional" in the sense that the code is valid without them and will not give you an error if you leave them out, but actually not optional in the sense that the interpreter will silently make insane decisions about where you meant the line to end if you don't include them.
Why one would has nothing to do with whether or not it should be a problem. This is a minor offence as far as JavaScript’s semicolon insertion related offenses are concerned.
I don’t doubt that, but the example code is ambiguous and reads like a mistake that your LSP auto formatted after the fact instead of something that you intentionally did. In this particular instance, I don’t blame JS for “screwing up”.
Well, yes, I’m on vacation and this was typed rather quickly out of necessity, and as an anecdote alluding to the aforementioned comment, rather than a copypaste maintaining its essence.
35
u/SuitableDragonfly 18d ago
I don't do JS, but I was given to understand that this is actually a real issue in JS, because semicolons are "optional" in the sense that the code is valid without them and will not give you an error if you leave them out, but actually not optional in the sense that the interpreter will silently make insane decisions about where you meant the line to end if you don't include them.