jscs
Version:
JavaScript Style Checker
30 lines (29 loc) • 766 B
JavaScript
/**
* @param {Errors[]} errorsCollection
*/
module.exports = function (errorsCollection) {
var errorCount = 0;
/**
* Formatting every error set.
*/
errorsCollection.forEach(function (errors) {
if (!errors.isEmpty()) {
/**
* Formatting every single error.
*/
errors.getErrorList().forEach(function(error) {
errorCount++;
console.log(errors.explainError(error, true) + '\n');
});
}
});
if (errorCount) {
/**
* Printing summary.
*/
console.log('\n' + errorCount + ' code style errors found.');
process.exit(1);
} else {
console.log('No code style errors found.');
}
};