Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim errorformat and jslint

I am trying to get makeprg and errorformat working with VIM and jslint, and can't seem to get the error format right for the life of me... I am using the nodejs version of jslint which produces results like:

1 116,9: The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.
    for (var k in o)

I basically want to match the line number, and column and the error and use the current file for the filename. Anyone know how to do this?

To be clear, I am looking for the errorformat to get this command working. Currently my .vimrc file has

augroup js
    set makeprg=jslint\ %
    set errorformat=%E%>%l,%c:%m,%Z
augroup END

which just isn't working (the jslint works fine, but the errorformat is wrong)...

like image 948
Kris Erickson Avatar asked Sep 14 '10 21:09

Kris Erickson


1 Answers

An old thread, but for anyone coming across it, like myself:

For the current version of node-jslint installed through npm (v0.1.2), the error output looks like the following:

filename.js
 #1 Missing 'use strict' statement.
    y = x // Line 2, Pos 3
 #2 Expected 'y' at column 5, not column 3.
    y = x // Line 2, Pos 3

I'm using the following efm to parse the errors:

autocmd FileType javascript set efm=%-P%f,
                    \%E%>\ #%n\ %m,%Z%.%#Line\ %l\\,\ Pos\ %c,
                    \%-G%f\ is\ OK.,%-Q
like image 69
dule Avatar answered Oct 20 '22 04:10

dule