reid / node-jslint

The JavaScript Code Quality Tool — for Node.js.
http://jslint.com/
Other
491 stars 101 forks source link

Error reporting on one line #25

Closed maxf closed 12 years ago

maxf commented 12 years ago

The current format for errors is something like:

#1 Missing space between 'input' and '='.
   var input= "", line = ""; // Line 1, Pos 10

Which doesn't work well within editors that try and parse it. Could you add an option to report one error per line, eg:

Error:1:10: Missing space between 'input' and '='.

See http://lapin-bleu.net/riviera/?p=191 for details on how this causes issues with on-the-fly jslint validation in emacs

reid commented 12 years ago

Hey @maxf,

Instead of inventing a new output format, I'd propose using the --json option for getting machine-readable output like this:

["lib/jslint.js",[{"id":"(error)","raw":"Unexpected /*property*/ '{a}'.","evidence":"module.exports = JSLINT;","line":6924,"character":8,"a":"exports","reason":"Unexpected /*property*/ 'exports'."}]]

Additional files would appear as additional JSON arrays separated by \n — so one file per line.

But unfortunately, the JSON output in node-jslint is broken. I'll fix it.

reid commented 12 years ago

Fixed in v0.1.3.

Additionally:

You should be able to use --json now. Enjoy!