Skip to content

Instantly share code, notes, and snippets.

@cedricpinson
Created January 3, 2014 13:01
Show Gist options
  • Save cedricpinson/8237530 to your computer and use it in GitHub Desktop.
Save cedricpinson/8237530 to your computer and use it in GitHub Desktop.
Emacs reporter for jshint in compile buffer
/*jshint node: true */
var reporter_name = "jhlint";
module.exports = {
reporter: function (data) {
"use strict";
var str = '',
errors = [];
data.forEach(function (data) {
var file = data.file;
if (data.error) {
data.error.file = file;
errors.push( data.error );
}
});
errors.forEach(function (error) {
var file = error.file,
error_id;
if (error.id === '(error)') {
error_id = 'ERROR';
} else {
error_id = 'WARNING';
}
str += '\x1b[0m'+file + ':' + error.line + ': \x1B[0;31m error ( ' + error.code + ' ) ' + error.reason + '\n\x1B[0;33m' + error.evidence + '\n\x1b[0m';
});
if (str) {
process.stdout.write(str + "\n");
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment