access-sniff
Version:
A node/iojs library & CLI for HTML_Codesniffer
47 lines (36 loc) • 1.39 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createHeading = function createHeading(heading, issue) {
switch (heading) {
case 'ERROR':
heading = _chalk2.default.red.bold(heading);
break;
case 'NOTICE':
heading = _chalk2.default.blue.bold(heading);
break;
default:
heading = _chalk2.default.yellow.bold(heading);
}
return heading += ' ' + issue;
};
/*eslint-disable no-console */
var generalMessage = function generalMessage(message) {
var position = message.position;
var lineMessage = 'Line:' + position.lineNumber + ' Col:' + position.columnNumber;
var heading = createHeading(message.heading, message.issue);
console.log(heading);
if (message.position.lineNumber || message.position.columnNumber) {
console.log(_chalk2.default.cyan(lineMessage));
}
console.log(_chalk2.default.grey(message.description));
console.log(_chalk2.default.grey('--------------------'));
console.log(_chalk2.default.grey(message.element.node), '\n');
return [message.heading + ' ' + message.issue, lineMessage, message.description, message.element.node];
};
exports.default = generalMessage;
;