Skip to content
JSHint HTML files or other files that contains script tags. Requires node.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
node_modules
Context.sublime-menu
Default (Linux).sublime-keymap
Default (OSX).sublime-keymap
Default (Windows).sublime-keymap
Default.sublime-commands
JSHint-Inline.sublime-build
Main.sublime-menu
README.md
jshinline.js
jshintinline.py
jshintinline.pyc
package-metadata.json
package.json
test.html

README.md

JSHint-Inline

Sublime Text extension to apply jshint to HTML files or other files containing <script> tags.

Prerequisites: NodeJS in your PATH, and jshint

Install Node

Just click on the install button on http://nodejs.org

Add nodejs to your PATH

NodeJS Installer should add itself to your path variable. On Windows, restart your system or add it manually: SET PATH=C:\Program Files\Nodejs;%PATH%

Just add it to Sublime using WBond's Package Manager.

To set the Build System and run JSHint-Inline, use the shortcut, ⌃ + ⇧ + J

or... choose Tools > Build System > JSHint-Inline and hit ⌘ + B or ⌃ + B to check all script tags on your HTML file.

JSHint Options

They are located on a variable options. Default:

{ 	
	"browser": true, 
	"globalstrict": true, 
	"smarttabs": true, 
	"debug": true, 
	"strict": true, 
	"unused": true, 
	"undef": true, 
	"curly": true 
}

You can override it using JSHint comments like /*global jQuery, console */ or /* jshint -W007, node */

To find your options file, you can open Package Manager with ⌘ + ⇧ + P or ⌃ + ⇧ + P and type Pack. Select Preferences: Browse Packages. Or Go to menu Preferences > Browse Packages. Go to JSHint-Inline. The file is there.

Test file

I've included a file called test.html with 2 script tags just for testing. You can open a terminal and run node jshinline test.html or open it with Sublime and run the build.

Questions, doubts, comments? Raise an issue

Extra Notes

To have the nice success (✓) and error (✗) signs on Sublime's console, you need a font that supports it. If you're on a mac, no problem. For Windows I recommend DejaVu Sans Mono

####Run JSHint on save

Install SublimeOnSaveBuild

License

MIT: http://bitbonsai.mit-license.org

You can’t perform that action at this time.