From 1c254f110c57ae678d167b1df98c6c5a1be6cdad Mon Sep 17 00:00:00 2001 From: cardistymo Date: Wed, 10 Jul 2024 12:17:05 +0200 Subject: [PATCH 1/3] Migrate ESLint to new config file format --- eslint.config.mjs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 eslint.config.mjs diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..ba84f86 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,28 @@ +import globals from "globals"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends("eslint:recommended"), { + languageOptions: { + globals: { + ...globals.browser, + }, + + ecmaVersion: "latest", + sourceType: "module", + }, + + rules: { + "no-unused-vars": 0, + }, +}]; \ No newline at end of file From ddb227d4d2b8601ed172b4272ff9355a6ec80778 Mon Sep 17 00:00:00 2001 From: cardistymo Date: Wed, 10 Jul 2024 12:45:06 +0200 Subject: [PATCH 2/3] update github workflow to install globals --- .github/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 52d1e8c..cd04f7f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,4 +10,5 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + - run: npm install globals - run: npx eslint . From 1b8a892b96322ef3ccbd23d23749870a30d6a597 Mon Sep 17 00:00:00 2001 From: cardistymo Date: Wed, 10 Jul 2024 12:47:19 +0200 Subject: [PATCH 3/3] update github workflow to install eslint --- .github/workflows/lint.yml | 2 ++ .pre-commit-config.yaml | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cd04f7f..0959b4f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,4 +11,6 @@ jobs: with: node-version: 18 - run: npm install globals + - run: npm install @eslint/eslintrc + - run: npm install @eslint/js - run: npx eslint . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1a78801 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v9.6.0 + hooks: + - id: eslint \ No newline at end of file