From e34f52fabef09b3445b2add959ef32d2e12c89a1 Mon Sep 17 00:00:00 2001 From: Janett Gerrard Date: Tue, 16 Apr 2024 11:31:15 +0100 Subject: [PATCH 1/4] rename config and modify lint script --- .eslintrc.json | 33 +++++++++++++++++++++++++++++++++ eslintrc.json | 17 ----------------- package.json | 2 +- 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 .eslintrc.json delete mode 100644 eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..9b1577f --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "overrides": [ + { + "files": [ + "src/**/*.js", + "src/**/*.ts" + ] + } + ], + "rules": { + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/consistent-type-definitions": [ + "error", + "type" + ] + }, + "env": { + "node": true, + "es2021": true + } +} diff --git a/eslintrc.json b/eslintrc.json deleted file mode 100644 index eb34483..0000000 --- a/eslintrc.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 12, - "sourceType": "module" - }, - "plugins": ["@typescript-eslint"], - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - "rules": { - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/consistent-type-definitions": ["error", "type"] - }, - "env": { - "browser": true, - "es2021": true - } -} diff --git a/package.json b/package.json index d76bb81..242ee7d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "lint": "eslint --ignore-path .eslintignore --ext .js,.ts", + "lint": "eslint src --ignore-path .eslintignore --ext .js,.ts", "start": "ts-node src/index.ts" }, "repository": { From 51ba161a9ea5b5b28ca58c1bbd2986d53cdf6ea6 Mon Sep 17 00:00:00 2001 From: Janett Gerrard Date: Tue, 16 Apr 2024 11:49:55 +0100 Subject: [PATCH 2/4] create auto linter workflow --- .github/workflows/linter.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/linter.yaml diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml new file mode 100644 index 0000000..4baacd8 --- /dev/null +++ b/.github/workflows/linter.yaml @@ -0,0 +1,21 @@ +name: linter +on: + pull-request: + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v3 + + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: "20.x" + + - name: install dependencies + run: npm install + + - name: run eslint + run: npm run lint From 613af7a7163c8ccd239e3d8bf02108de6efdfc10 Mon Sep 17 00:00:00 2001 From: Janett Gerrard Date: Tue, 16 Apr 2024 11:57:24 +0100 Subject: [PATCH 3/4] update version --- .github/workflows/linter.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 4baacd8..429b421 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "20.x" From d99641f777f563f6f3d0aba915b144297314507b Mon Sep 17 00:00:00 2001 From: Janett Gerrard Date: Tue, 16 Apr 2024 11:59:29 +0100 Subject: [PATCH 4/4] fix event name --- .github/workflows/linter.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 429b421..41509b8 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -1,6 +1,6 @@ name: linter on: - pull-request: + pull_request: jobs: eslint: