I know automatic semi-colon injection is a contentious issue but I would prefer if I could disable it on my Node.js based server.
Script:
var foo = bar()
var baz = foo+1;
With result:
[Error] Expected ';' before var on line #2
Or anything similar.
As mentioned in comments, ASI is part of the EMCAScript specification, it can't be disabled.
Also as mentioned JSHint is a good solution, I use sublime text 2 with the "Sublime Linter" plugin, which lints your code as your code as you type.
If you really wanted to lock your server down, you could add an alias to "node" which does something like "lint file && node file", that way node wouldn't run unless lint was successful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With