JSHint in Eclipse

See github.eclipsesource.com/jshint-eclipse/ on how to install the JSHint Eclipse plugin.

Open Window – Preferences – JSHint – Options.

Set the following JSHint options: devel: true, regexdash: true, so we can use console.log() and [a-zA-Z-] (unescaped dash at the end of a regex character class) withouth warnings. Sadly, the regexdash option seems not to be in the official options documentation, though it was added more than two years ago. But it is implemented, which is good. From version 0.9.8 on, the configuration has to look like this:

  "devel" : true
  "regexdash" : true

Right click a project containing JavaScript files that you want to validate using JSHint and select Properties, then click on JSHint.

Personally, I only enable JSHint on a per-file-basis (using the file’s exact name), since I feel this introduces the least amount of overhead and I maintain full control. Also, I only have a few JavaScript files anyway. However, feel free to enable it for whatever files and folders you want, just don’t forget to enable it at all ;-)