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

后端 未结 5 1817
栀梦
栀梦 2021-02-01 13:40

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

5条回答
  •  抹茶落季
    2021-02-01 13:58

    JSHint does what you want. http://www.jshint.com/

    You can configure which warnings or errors to show.

    An example:

    $ jshint myfile.js
    myfile.js: line 10, col 39, Octal literals are not allowed in strict mode.
    
    1 error
    

提交回复
热议问题