How to use the Syntastic Vim plugin with JSHint to validate JavaScript code?
Environment:
What I
I just had this same problem. Turns out, Syntastic looks for jsl (JSLint) before it looks for jshint. If you have both installed, you'll likely be misled. I moved jsl somewhere not in my PATH, and jshint was detected just fine.
Source:
https://github.com/scrooloose/syntastic/pull/47
Here is a more updated info, there is a configuration to associate a file extension to a checker,
in your .vimrc
let g:syntastic_javascript_checkers = ['jshint']
Also to get info about what's going on run this command in vim
:SyntasticInfo
And you'll get an output similar to this:
Syntastic info for filetype: javascript
Available checkers: gjslint jshint
Currently active checker(s): gjslint
Press ENTER or type command to continue
I struggled with this issue for days and SyntasticInfo would not recognize jshint as an available checker even after i added let g:syntastic_javascript_checkers['jshint'] to my .vimrc. I am using Ubuntu 15.04 and I followed this tutorial to install nvm, nodejs, and jshint on Ubuntu. After I did that I discovered that if I removed the line filetype plugin indent on from my .vimrc then opened a .js file everything worked perfectly! To summarize...
~/.nvm/<version_number>/bin to path in .bashrcfiletype plugin indent on from .vimrclet g:syntastic_javascript_checkers['jshint'] to .vimrc:so % inside vim.js filefiletype plugin indent on back to your .vimrc