JSHint for Sublime Text 2

The other day I setup a quick build system for Lux Ahoy based on jQuery’s Makefile. One of the nifty bonuses was the JavaScript syntax checker JSHint. It gives tons on tips on how to clean up your code, and can even detect potential errors. If you want to try it out, just head to jshint.com with some code ready to paste and get Linting!

To get the most out of a syntax checker I want it built into my text editor and maybe even run every time I save a JavaScript file. Enter JSHint for Sublime Text 2 and Sublime Package Control. JSHint for Sublime will output all of the linty goodness in Sublime Text’s console. All the instructions are there and if you haven’t added any packages to Sublime you’ll quickly get addicted. I’ve also installed SublimeLinter which highlights code inline. That should annoy me into cleaning up my code, or drive me to write everything in CoffeeScript!

After a couple of hours SublimeLinter turns out to be the perfect companion with fewer white space errors than JSHint for Sublime. Are those from jslint or an older version of jshint? Keep your columns Douglas Crockford!