Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Syntastic for syntax checking in Vim - whenever I save an .rb file, it runs it through a syntax checker and highlights errors for me. Spiffy. Same for several other file types: HAML, HTML, etc. It does this by calling out to external syntax checkers and displaying the errors they return.

Syntastic can be configured various ways, but this is what I added to my .vimrc:

  " When writing a file, if there are errors, have Syntastic plugin mark them
  let g:syntastic_enable_signs=1
  let g:syntastic_auto_loc_list=1

Lately, I've had several elusive Javascript bugs that I eventually found by copying and pasting my code into the web interface of JSLint. I'd really like to have JSLint run on my .js files every time I save them, but searching for "command line JSLint" has mostly gotten me confusion.

Is there an official command-line version of JSLint? Does anybody have clear instructions on getting JSLint to run via Syntastic?

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

Syntastic is looking for the jsl binary in your path. You can download jsl (command line js lint) from http://www.javascriptlint.com/download.htm

After it is installed I would restart vim and viola, it should work.

If you are on a mac, you can also do brew install jslint and it will install the jsl executable for you.

share|improve this answer
    
Yep - that works! Thank you. –  Nathan Long Feb 17 '11 at 16:06
    
After using brew i had to add to my .vimrc this let g:syntastic_javascript_checkers = ['jslint'] –  Guillermo Siliceo Trueba Oct 22 '13 at 1:09
add comment

As noted by Adam the jsl binary is the easiest way to get things set up. I'd like to note, however, that you can also install a jslint in your path via npm (so long as you already have npm and node.js installed):

npm install -g jslint

The -g flag tells npm you want to install the package globally.

share|improve this answer
    
You can also use jshint if you like. npm install -g jshint –  Noah Aug 21 '13 at 4:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.