ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

JSHint Inline

by bitbonsai ST2

JSHint HTML files or other files that contains script tags. Requires node.js

Details

  • 2016.05.27.09.14.21
  • github.​com
  • github.​com
  • 8 years ago
  • 30 minutes ago
  • 11 years ago

Installs

  • Total 5K
  • Win 2K
  • Mac 2K
  • Linux 716
Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

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