How can I check JavaScript code for syntax errors ONLY from the command line

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://stackoverflow.com/questions/5279226/how-to-check-client-side-javascript-code-for-errors http://stackoverflow.com/questions/5279226/how-to-check-client-side-javascript-code-for-errors

https://github.com/jshint/jshint/issues/1533 https://github.com/jshint/jshint/issues/1533

How do I check JavaScript code for syntax errors only from the command line?

Answers

http://marijnhaverbeke.nl/acorn/ http://marijnhaverbeke.nl/acorn/

$ acorn --silent tests/files/js-error.js; echo $?
Unexpected token (1:14)
1

$ acorn --silent tests/files/js-ok.js; echo $?
0

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/21856097/how-can-i-check-javascript-code-for-syntax-errors-only-from-the-command-line

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils