#JSHint for Sublime Text
The best JavaScript syntax checker: JSHint for the best text editor: Sublime Text
Prerequisites: jshint and Sublime Package Control
Mac OS X: Installing node with homebrew or macports is assumed. The path to jshint is hardcoded in this plugin as /usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin
. There is no reliable way to get the path from your environment.
Linux: Make sure jshint is in your environment path.
Windows: Installing node with the Windows Installer from nodejs.org is assumed.
##1. Terminal
npm install -g jshint
Note: JSHint will use the first .jshintrc file found traversing from the active file in Sublime Text up to your project's root.
##2. Sublime Text Package Control
command
-shift
-p
orcontrol
-shift
-p
in Linux/Windows- type
install p
, selectPackage Control: Install Package
- type
jshint
, selectJSHint
Note: Without Sublime Package Control, you could manually clone to Packages directory as 'JSHint', exactly.
##3. JSHint an active JavaScript file
control
-j
oralt
-j
in Linux/Windows or Tools/Contextual menus or the Command PaletteF4
jump to next error row/columnshift
-F4
jump to previous error row-column
Note: The control
-j
/alt
-j
shortcut changes the Build System on the current file to JSHint, then Builds to run JSHint on the file and output any errors for jumping to within the file. You could alternatively set the Build System to Automatic and command
-b
/control
-b
/F7
, but only on files that end with .js.
##JSHint on save
Install SublimeOnSaveBuild