Skip to content

Instantly share code, notes, and snippets.

@catdad
Created December 15, 2015 13:00
Show Gist options
  • Save catdad/940d9a0f69f0ddf6d620 to your computer and use it in GitHub Desktop.
Save catdad/940d9a0f69f0ddf6d620 to your computer and use it in GitHub Desktop.
really bad jshint reporter
var devLintReporter = function(issues, config, opts) {
if (!issues.length) { return; }
opts = opts || {};
var chalk = gutil.colors;
var files = {};
console.log(chalk.yellow('----------------------'));
console.log(chalk.yellow('JSHint Report:'));
var logs = issues.map(function(obj) {
files[obj.file] = 1;
var str = '';
var prefix = '\n ';
str += util.format(chalk.red(obj.file));
str += prefix + util.format(
chalk.gray(obj.error.code),
chalk.cyan(obj.error.line + ':' + obj.error.character),
obj.error.raw
);
if (obj.error.evidene) {
str += prefix + util.format(chalk.gray('evidence:'), obj.error.evidence.trim());
}
return str;
});
console.log(logs.join('\n\n'));
console.log(chalk.yellow('----------------------'));
if (opts.quiet !== true) {
var lintWhimsyName = 'squirrel';
notifier.notify({
title: whimsy ? whimsy[lintWhimsyName].message : 'PAS Lint Error',
icon: whimsy ? whimsy[lintWhimsyName].path : (void 0),
message: Object.keys(files).join(', ')
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment