From 56a1dfcd679d79c998b5ce75afecf90586ce975b Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:44:26 +0200 Subject: Add ESLint formatter for GHA annotations --- annotations_formatter.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 annotations_formatter.js 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; +}; -- cgit v1.2.3 From 8856119f6a851f6dda6354814b1ccea63e857796 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:45:00 +0200 Subject: Add new formatter to workflow --- .github/workflows/test_and_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index 21c3f22..f414c4e 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 --quiet --format ./annotations_formatter.js src/ -- cgit v1.2.3 From 16c7067223abaa6e440b67cf1d312a87ead22f77 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:45:15 +0200 Subject: Break some rules for testing --- src/pages/FormPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx index c49b9fd..ea51689 100644 --- a/src/pages/FormPage.tsx +++ b/src/pages/FormPage.tsx @@ -170,6 +170,7 @@ function FormPage(): JSX.Element { const questions = form.questions.map((question, index) => { return ; }); + let foo; function handleSubmit(event: SyntheticEvent) { questions.forEach(prop => { @@ -195,7 +196,7 @@ function FormPage(): JSX.Element { return (
- +
{ closed_header } -- cgit v1.2.3 From e0ea61a77c8460d3bf1c31b592364864a7abf6c5 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:53:41 +0200 Subject: Remove quiet flag to show warnings --- .github/workflows/test_and_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_and_lint.yml b/.github/workflows/test_and_lint.yml index f414c4e..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 --format ./annotations_formatter.js src/ + run: yarn run eslint --ext .ts,.tsx --format ./annotations_formatter.js src/ -- cgit v1.2.3 From d01f655466b04b9732221ca35a57a6697f3ac455 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:55:07 +0200 Subject: Remove quiet flag from Husky hooks to show warnings --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5af419..f7144cf 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "husky": { "hooks": { - "pre-commit": "yarn lint --quiet" + "pre-commit": "yarn lint" } } } -- cgit v1.2.3 From ee7e6cb230e50ba1e945ef0fae497b57a9d5b5c9 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 8 Feb 2021 20:57:50 +0200 Subject: Undo testing rules breaking --- src/pages/FormPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/FormPage.tsx b/src/pages/FormPage.tsx index ea51689..c49b9fd 100644 --- a/src/pages/FormPage.tsx +++ b/src/pages/FormPage.tsx @@ -170,7 +170,6 @@ function FormPage(): JSX.Element { const questions = form.questions.map((question, index) => { return ; }); - let foo; function handleSubmit(event: SyntheticEvent) { questions.forEach(prop => { @@ -196,7 +195,7 @@ function FormPage(): JSX.Element { return (
- +
{ closed_header } -- cgit v1.2.3