Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const cleanedMessages = orderedMessages.map(message => {
const location = utils.getLocation(message);
const severity = message.severity;
const row = [
location.line || "",
location.column || "",
symbols[severity]
? chalk[levelColors[severity]](symbols[severity])
: severity,
message.text
// Remove all control characters (newline, tab and etc)
.replace(/[\x01-\x1A]+/g, " ") // eslint-disable-line no-control-regex
.replace(/\.$/, "")
.replace(
new RegExp(_.escapeRegExp("(" + message.rule + ")") + "$"),
""
),
chalk.dim(message.rule || "")
const sourceGroupedMessages = messagesToLog.reduce((result, message) => {
const key = util.getLocation(message).file || resultSource;
if (!message.severity) {
message.severity = message.type || "warning";
}
if (hasOwnProperty.call(result, key)) {
result[key].push(message);
} else {
result[key] = [message];
}
return result;
}, {});