简体   繁体   中英

JS analysis tool for automatically checking for things (like const) that break in IE

I recently noticed and fixed a pretty bad JS bug in our software, affecting all IE versions, that was caused by a simple mistake in a .js file:

const foo = "..."

Now, IE doesn't support const ; it's a syntax error. var should be used instead. (The offending keyword was actually inserted unwittingly by IntelliJ IDEA's "introduce variable... -> introduce constant" refactoring.)

Our automated Selenium tests are run with Firefox on Linux , and getting them running on IE would probably be too much hassle right now.

Anyway, my question is, is there any static JS code analysis tool that

  1. would have caught the const bug (and similar common problems), and
  2. can be easily triggered from a CI tool (Jenkins) against certain .js files in a codebase?

I am aware of JSHint, JSLint and Google Closure Tools, but I don't know if any of them meets my criteria above.

JSHint or JSLint would have caught the error in time. You can configure IntelliJ to show these kind of issues realtime. There is a Jenkins plugin available as well. I hope you find those useful. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM