DTP jshint reporter producing output more friendly to VS Code for use with Ctrl+click in a terminal view.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
840 B

// dtp-jshint-reporter.js
// Copyright (C) 2021 Digital Telepresence, LLC
// All Rights Reserved
// Generates gulp output that is useful within a terminal in VS Code.
'use strict';
const chalk = require('chalk');
const separator = chalk.gray(':');
module.exports = {
toString: function ( ) {
return __filename;
},
reporter: function (errors) {
console.log('');
errors.forEach((error) => {
let file = chalk.white(error.file);
let line = chalk.blue(error.error.line);
let character = chalk.blue(error.error.character);
let id = error.error.id === '(error)' ? chalk.red(error.error.id) : chalk.yellow(error.error.id);
let reason = error.error.reason;
console.log(`${id} ${file}${separator}${line}${separator}${character}${separator} ${reason}`);
});
console.log('');
},
};