Tuesday, January 14, 2014

JSHint in Sublime

In Sublime, you may use the SublimeLinter (see Sublime's Package Control) to in turn use JSHint which is akin to JSLint. To install:

  1. first have Sublime text 3 and node installed
  2. run this at the command line: npm install -g jshint
  3. press Ctrl+` (the backtick or grave accent) in Sublime to get Sublime's console where you should push in: import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
  4. press Ctrl+Shift+P in Sublime and then type "Install Package" in the dialog box which appears.
  5. pressing Enter here should let you search for and install "SublimeLinter-jshint" and you'll want to do so
  6. next, repeat the last two steps but install just "SublimeLinter"
  7. Preferences > Package Settings > SublimeLinter > Settings - Default ...should be something you may now navigate to to tweak settings and you should be done with the install process

 
 

When you use the tool, dots will appear beside lines of code which are "questionable" and you if click on a particular dot you will learn more:

No comments:

Post a Comment