sublime text editor – sublimelinter running multiple javascript linters

i like to run my javascript through jshint and gjslint to lint my code for anything those tools pick up. sublime text editor is my favorite editor for javascript and the sublimelinter is an excellent package that will lint your code in real time.

the problem with sublimelinter is that it will only let you run one linter per language. this is problematic if you want to run two. the solution? it’s a little hacky and unfortunately isn’t very modular, but it can be done.

the linter you choose can be configured to run an external tool to lint your code. the results of the tool can be parsed via some regex magic and you can then parse the results into a format that sublimelinter understands.

since jshint and gjslint can be invoked as external tools, you can just write a wrapper shell script which will run both of these tools against your file, then check against some regex to pick up the results and feed it to sublime.

it’s a little messy and i suspect when the plugin upgrades itself, you’ll have to reapply these changes because you are mucking with the internals of sublimelinter, but having both static code tools run in real-time for me is worth it.

it’s not a lot of code, but it’s enough where it’s not for the faint of heart:
sublimelinter fork with diffs.