@jamesacarr/eslint-formatter-github-actions
Version:
Reporter for Jest that outputs GitHub Actions annotations
35 lines (32 loc) • 1.12 kB
JavaScript
import { startGroup, endGroup } from '@actions/core';
import { issueCommand } from '@actions/core/lib/command';
const severityLabels = {
0: 'debug',
1: 'warning',
2: 'error',
};
const GitHubActionsReporter = {
format(results) {
startGroup('Lint Annotations');
const errors = results.flatMap(result => result.messages.map(message => {
var _a, _b;
return ({
message: message.message,
severity: severityLabels[message.severity],
properties: {
file: result.filePath,
line: (_a = message.line) === null || _a === void 0 ? void 0 : _a.toString(),
col: (_b = message.column) === null || _b === void 0 ? void 0 : _b.toString(),
},
});
}));
for (const { severity, properties, message } of errors) {
issueCommand(severity, properties, message);
}
endGroup();
return '';
},
};
var index = GitHubActionsReporter.format;
export { index as default };
//# sourceMappingURL=index.mjs.map