aboutsummaryrefslogtreecommitdiffstats
path: root/.config/eslint/annotations_formatter.js
blob: b3a421d52c6b3f0a69634c142ac00f728e547289 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module.exports = function (results) {
    let output = "";

    for (const file of results.filter(r => r.messages.length > 0)) {
        for (const message of file.messages) {
            const path = file.filePath.substr(process.cwd().length + 1);
            const severity = message.fatal || message.severity === 2 ? "error" : "warning";
            const text = `[ESLint] ${message.ruleId}: ${message.message}`;
            output += `::${severity} file=${path},line=${message.line},col=${message.column}::${text}\n`;
        }
    }

    return output;
};