Question

I have set up Syntastic https://github.com/scrooloose/syntastic with vim and I would like to use it for node.js javascript linting.

I have installed jslint

$ jslint routes/index.js

routes/index.js
 #1 Expected exactly one space between 'function' and '('.
    module.exports = function(app) { // Line 5, Pos 26
    ....

And I have put this in my ~/.vimrc

let g:syntastic_jslint_checkers=['jslint']
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1

But I get no output on :SyntasticCheck

Yet

Syntastic: active mode enabled
Syntastic info for filetype: javascript
Available checker(s): jslint
Currently enabled checker(s): jslint
Was it helpful?

Solution

I recommend JSHint as an alternative for JavaScript linting in Vim. Here is a great answer that explains how to install it.

If you want to use JSHint for creating web sites as well, I'd additionally use RequireJS. This way your JavaScript and your HTML code stay separated (JSHint can't deal with JavaScript inside HTML files).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top