4 ms·
Funny, a missing semicolon was what convinced us to start lint-checking all our JS. We have a Rails app with multiple JS files. One of them ended with a statem
by billybob 15y ago
Funny, a missing semicolon was what convinced us to start lint-checking all our JS.
We have a Rails app with multiple JS files. One of them ended with a statement like var foo = { /* object contents / } / no semicolon here */
This worked in development but broke in production. Browsers seemed happy to assume the missing semicolon when the closing brace was followed by the end of the file. But in production, this JS file had other files concatenated to it, and it broke.
Lesson learned. We now use Syntastic to check our syntax in Vim, including Javascript.