How to configure Syntastic with JSHint?

前端 未结 3 1837
走了就别回头了
走了就别回头了 2021-01-31 14:34

How to use the Syntastic Vim plugin with JSHint to validate JavaScript code?

Environment:

  • Ubuntu 11.04
  • VIM - Vi IMproved 7.3

What I

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-31 15:23

    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...

    1. follow the tutorial linked above
    2. add ~/.nvm//bin to path in .bashrc
    3. remove filetype plugin indent on from .vimrc
    4. add let g:syntastic_javascript_checkers['jshint'] to .vimrc
    5. :so % inside vim
    6. open a .js file
    7. add filetype plugin indent on back to your .vimrc
    8. everything magically works now

提交回复
热议问题