Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (report: ReportType): string => {
let result;
result = '';
if (report.errorCount || report.warningCount) {
result = drawReport(report.results);
}
result += '\n' + table([
[
chalk.red(pluralize('Error', report.errorCount, true))
],
[
chalk.yellow(pluralize('Warning', report.warningCount, true))
]
], {
columns: {
0: {
width: 110,
wrapWord: true
}
},
drawHorizontalLine: _.constant(true)
});
if (message.fatal || message.severity === 2) {
messageType = chalk.red('error');
} else {
messageType = chalk.yellow('warning');
}
rows.push([
message.line || 0,
message.column || 0,
messageType,
message.message.replace(/\.$/, ''),
message.ruleId || ''
]);
});
return table(rows, {
columns: {
0: {
width: 8,
wrapWord: true
},
1: {
width: 8,
wrapWord: true
},
2: {
width: 8,
wrapWord: true
},
3: {
paddingRight: 5,
width: 50,
export function _formatDefTable(defs: Array): string {
const formatted = [['Name', 'Package Version', 'Flow Version']].concat(
defs.map(def => {
return [
def.pkgName,
def.pkgVersionStr,
flowVersionToSemver(def.flowVersion),
];
}),
);
if (formatted.length === 1) {
return 'No definitions found, sorry!';
} else {
return '\nFound definitions:\n' + table(formatted);
}
}