Carles Andres
Carles Andres

Reputation: 1811

Use jshint inside VIM in sync with Yeoman's jshint task

I am using VIM as my text editor and Yeoman to help me with my webapp development workflow.

I am already using vim-jshint to help me lint my javascript files from within VIM and I would like to use it in sync with my Yeoman setup.

My problem is that every time I run grunt, the jshint task founds lots of errors that vim-jshint couldn't find.

I am aware vim-jshint looks for a .jshintrc file in two possible paths: the HOME path and the current working directory but, in its current state of development, vim-jshint seems to be unable to find the .jshintrc that Yeoman uses, which is located in the base directory of the webapp.

Has any of you found a solution or workaround for this?

Please, switching to Sublime Text is not an option.

Upvotes: 3

Views: 619

Answers (1)

Carles Andres
Carles Andres

Reputation: 1811

Got it! I was using the wrong vim-jshint plugin.

I should have used the one that's listed in JSHint's site from the beginning, but somehow I was misled to the wrong plugins. Stupid me.

Finally, having pathogen.vim installed, I just had to copy and paste this:

cd ~/.vim/bundle
git clone git://github.com/walm/jshint.vim

As stated in its own github README file, This plugin is a front for the jshint NodeJS cli module which ensures that running :JSHint inside VIM will always report the same errors as grunt's jshint task. At least if you run VIM from the same folder where JSHint's options file (.jshintrc) is located.

Upvotes: 4

Related Questions