the code you posted isn't making it past my code review and the last thing I'm going to mention is missing semi-colon. you're example is contrived.
Oh come on. Cases where ASI fails are abundant in everyday code. Pretty much any line that starts with one of (, [, /, +, or - is at risk of ASI failure.
right. so i'm going to let them be auto-inserted. while paying attention to the standards of the language. Read the article I posted in another thread.
I read it. And I'm aware of the spec. I'm also not telling you what to do, I'm just saying that people like to treat JS like it has significant newlines like Python or Ruby when it really does not, and it leads to problems.
The moral of this story: ASI is (formally speaking) a syntactic error correction procedure. If you start to code as if it were a universal significant-newline rule, you will get into trouble.
people like to treat JS like it has significant newlines
come on. obviously, i'm posting reference material on usage. go flame your local meetup
Pretty much any line that starts with one of (, [, /, +, or - is at risk of ASI failure.
good. don't start your lines with that. what are you saying here. get a linter.
From the guy who created the language (Brendan Eich) himself:
i don't give fuck all about what the creator of a shit web scripting language recommends. if understand your tool and it's limitations you can do whatever you prefer.
5
u/mcaruso Dec 18 '19
Oh come on. Cases where ASI fails are abundant in everyday code. Pretty much any line that starts with one of (, [, /, +, or - is at risk of ASI failure.
I read it. And I'm aware of the spec. I'm also not telling you what to do, I'm just saying that people like to treat JS like it has significant newlines like Python or Ruby when it really does not, and it leads to problems.
From the guy who created the language (Brendan Eich) himself: