From e25aea0b1bffbc64d31a91ca700d05d3883e7e0a Mon Sep 17 00:00:00 2001 From: Vincent Lemeunier Date: Thu, 17 Apr 2025 19:32:20 +0200 Subject: [PATCH 1/2] ci: add lint job --- .github/workflows/lint.yml | 23 +++++++++++++++++++++++ eslint-gh-annotations-formatter.mjs | 10 ++++++++++ src/helpers.ts | 1 + 3 files changed, 34 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 eslint-gh-annotations-formatter.mjs diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ec077e0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,23 @@ +name: linting + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Install dependencies + run: npm i + + - name: Lint + run: npm run -s lint -- --format=./eslint-gh-annotations-formatter.mjs --quiet diff --git a/eslint-gh-annotations-formatter.mjs b/eslint-gh-annotations-formatter.mjs new file mode 100644 index 0000000..c55a357 --- /dev/null +++ b/eslint-gh-annotations-formatter.mjs @@ -0,0 +1,10 @@ +export default function (results) { + return results + .flatMap(({ filePath, messages }) => + messages.map( + ({ message, line, column }) => + `::error file=${filePath},line=${line},col=${column}::${message}`, + ), + ) + .join("\n"); +} diff --git a/src/helpers.ts b/src/helpers.ts index 65dfb69..71e936c 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -4,6 +4,7 @@ type JsonSchemaShared = { title?: string; description?: string; }; +let foo; type JsonSchemaArray = { type: "array"; From e00b2c639cbadce5c5a8dc2d3a9aee3a49906fcb Mon Sep 17 00:00:00 2001 From: Vincent Lemeunier Date: Thu, 17 Apr 2025 19:33:48 +0200 Subject: [PATCH 2/2] fix: linting error --- src/helpers.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpers.ts b/src/helpers.ts index 71e936c..65dfb69 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -4,7 +4,6 @@ type JsonSchemaShared = { title?: string; description?: string; }; -let foo; type JsonSchemaArray = { type: "array";