JavaScript programs can be checked for errors in IDEs or using online web apps but I\'m looking for a way to detect syntax errors alone.
I\'ve tried JSLint and
Any JavaScript parser should do, acorn
mentioned by @cweise is nice because it is fast and has a --silent
switch.
You could also use esvalidate
from the npm esprima
package: http://ariya.ofilabs.com/2012/10/javascript-validator-with-esprima.html
$ npm install -g esprima
$ esvalidate js-file-with-errors.js
js-file-with-errors.js:1: Invalid left-hand side in assignment