How to do JSLint in Vim

The best-practice way IMO is:

  1. Install Syntastic Vim plugin – Best syntax-checker around for plenty of languages, plus it integrates with Vim’s location-list (==quickfix) window.
  • I recommend cloning from the GitHub repo and installing using a plugin manager like Vundle or Pathogen, since it’s more frequently updated.
  1. Choose one of the two options below:

JSLint

  1. Install jsl (JSLint executable) using your favorite package manager (Ubuntu’s apt-get, Mac’s home brew, etc.).

Community-driven jshint.com (better than JSLint)

  1. Install node.js using your favorite package manager.
  2. Install Node Package Manager: ‘curl https://npmjs.org/install.sh | sh’ EDIT: npm IS PART OF node.js NOW
    • See http://npmjs.org for more info.
  3. Install jshint globally: ‘npm install jshint -g’
  4. Put your jshint config file in your $HOME dir: ‘~/.jshintrc’
    • Here’s JSHint-Node’s example configuration file, they pulled from mine and added more stuff.
    • Here’s my original copy, which you can also start from.
  5. Overwrite Syntastic‘s syntax_checkers/javascript.vim file with this one – EDIT: NO LONGER NECESSARY WITH NEWEST SYNTASTIC VERSION.
    • Script copied from FactorayLab’s really helpful Vim GitHub page, which I recommend every Vim user to check out.

Enjoy! 🙂

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)