vimcompiler-constructionjslinterrorformat

jslint vim errorformat


I have the jslint installed with npm on my system.

It produces error messages in the following format:

  1 1,9: Missing name in function statement.
    function() {
  2 2,11: Use '===' to compare with '0'.
    if (x == 0) {
  3 4,2: Unnecessary semicolon.
    };

I wrote a compiler plugin for Vim to parse the error messages, but I could not figure out the problem with the errorformat. I have the following now in my compiler file:

CompilerSet makeprg=jslint
      \\ $*
      \\ %
CompilerSet errorformat=
    \%*[\ ]%n\ %l\,%c:\ %m,
    \%-G%.%#

Which AFAIK should do the following:

It runs the jslint which shows the messages but the :clist command does not show any errors.

What am I missing?


Solution

  • The problem was with the \,, the skip comma, the correct format is:

    CompilerSet errorformat=
        \%*[\ ]%n\ %l%.%c:\ %m,
        \%-G%.%#