Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stack: '',
codeframe: '',
hints: [],
};
result.message =
mdAnsi(`**${origin ?? 'unknown'}**: `) +
(skipFormatting ? message : mdAnsi(message));
result.stack = stack || '';
if (codeFrame !== undefined) {
let highlights = Array.isArray(codeFrame.codeHighlights)
? codeFrame.codeHighlights
: [codeFrame.codeHighlights];
let formattedCodeFrame = formatCodeFrame(codeFrame.code, highlights, {
useColor: true,
syntaxHighlighting: true,
language:
// $FlowFixMe sketchy null checks do not matter here...
language || (filePath ? path.extname(filePath).substr(1) : undefined),
});
result.codeframe +=
typeof filePath !== 'string'
? ''
: chalk.underline(
`${filePath}:${highlights[0].start.line}:${highlights[0].start.column}\n`,
);
result.codeframe += formattedCodeFrame;
}