diff options
author | 2021-02-10 12:38:27 +0000 | |
---|---|---|
committer | 2021-02-10 12:38:27 +0000 | |
commit | e99a42099c0f3c6df69efedebf1f049715097dd9 (patch) | |
tree | 632fe5dca5fd65e0115d3e6c60fc650a3219c1b6 | |
parent | Merge pull request #136 from python-discord/dependabot/npm_and_yarn/typescrip... (diff) | |
parent | Undo testing rules breaking (diff) |
Merge pull request #133 from python-discord/github-annotations-eslint
-rw-r--r-- | .github/workflows/test_and_lint.yml | 2 | ||||
-rw-r--r-- | annotations_formatter.js | 14 | ||||
-rw-r--r-- | package.json | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index 21c3f22..4767b3e 100644 --- a/.github/workflows/test_and_lint.yml +++ b/.github/workflows/test_and_lint.yml @@ -44,4 +44,4 @@ jobs: run: yarn install - name: Lint - run: yarn run eslint --ext .ts,.tsx --quiet src/ + run: yarn run eslint --ext .ts,.tsx --format ./annotations_formatter.js src/ 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; +}; diff --git a/package.json b/package.json index 0ddeef8..f4b6b12 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "husky": { "hooks": { - "pre-commit": "yarn lint --quiet" + "pre-commit": "yarn lint" } } } |