Javascript syntax checking for Internet Explorer

Is there any tool that can parse my JavaScript files to see if they contain syntax errors that will bother Javascript Internet Explorer mechanism, especially redundant trailing commas?

Example:

var some_object = { valid : "property", one : "comma too much ---> ", }; 

This code works fine in FireFox, Chrome, and Node.JS , but it crashes in IE due to trailing comma. The integrated IE debugger rarely helps, because it does not generate useful errors / warnings for large web applications like ours (many JavaScript files are combined together, adding up to 50-100 k lines of code).

JSLint does not help , as it reports a large number of other warnings or stops with some meaningless error.

One idea can use eval() directly in IE and catch SyntaxError exceptions, but I cannot do it in an automatic way (i.e. on the command line).

Unfortunately, Node.JS does not bother with commas.

No Linux / Windows tool that can do basic JavaScript syntax checking for a file?

+6
source share
2 answers

You can also try http://www.javascriptlint.com/ . After installation, you can edit jsl.default.conf to set these warnings.

jsl -process file.js

+4
source

JavaScript Formatter will print your JavaScript code. For this, a full JavaScript parser is used. It reports syntax errors during parsing. Windows

-2
source

Source: https://habr.com/ru/post/891660/


All Articles