Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (35 sloc) 2.72 KB

Sublime-JSHint: Javascript Lint for Sublime Text editor via node.js

Sublime Text 2

JSHint homepage

Node.js download


This is a Sublime Text 2 plugin and build system allowing you to check your JavaScript code for nasty errors, coding conventions and other goodies. It relies on JSHint, a fork of JSLint (developed by Douglas Crockford). The linter is itself written in JavaScript, so you'll need something (node.js) to interpret JavaScript code outside the browser.


First of all, be sure you have node.js installed in order to run JSHint (a derivative work of JSLint, used to detect errors and potential problems in JS). Each OS has a different Packages folder required by Sublime Text. Open it via Preferences -> Browse Packages, and copy this repository contents to a new JSHint folder there.

The shorter way of doing this is:


git clone git:// ~/.config/sublime-text-2/Packages/Sublime-JSHint


git clone git:// ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Sublime-JSHint


git clone git:// %APPDATA%/Sublime\ Text\ 2/Packages/Sublime-JSHint


There are two ways you can use Sublime-JSHint: as a build system or a python plugin.

Build system

Open a JavaScript file, Select JSHint from Tools -> Build System, and:

  • Ctrl+B (or Cmd+B if you're on a Mac) to lint
  • F4 jump to next error row/column
  • Shift-F4 jump to previous error row-column

Python plugin

Open a JavaScript file, pop out the console in Sublime Text from View -> Show Console, and type view.run_command("jshint").

Writing commands in the console is ugly. Set up your own key combo for this, by going to Preferences -> Key Bindings - Default, and adding a command in that huge array: { "keys": ["super+shift+j"], "command": "jshint" },. You can use any other command you want, thought most of them are already taken.

Oh noez, command not found!

If you get an error sh: node: command not found or similar, you don't have node in the right path. Try setting the absolute path to node in or JSHint.sublime-build! This means from: lint = commands.getoutput("node " + ... change to lint = commands.getoutput("absolute/path/to/node " + ...


Both JSHint.sublime-build and have some predefined settings which are probably quite important when writing JavaScript code (like "es5: true"). Add some more settings and options from the TONS available (see the JSHint docs).

Have fun!