diff options
author | 2021-02-08 20:44:26 +0200 | |
---|---|---|
committer | 2021-02-08 20:44:26 +0200 | |
commit | 56a1dfcd679d79c998b5ce75afecf90586ce975b (patch) | |
tree | 9f8988907dcc1e7dc1bc5e778ed7eb44f77d743c | |
parent | Merge pull request #129 from python-discord/cleanup-depends (diff) |
Add ESLint formatter for GHA annotations
-rw-r--r-- | annotations_formatter.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/annotations_formatter.js b/annotations_formatter.js new file mode 100644 index 0000000..b3a421d --- /dev/null +++ b/annotations_formatter.js @@ -0,0 +1,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; +}; |