From 34941c79dfc6e1cbf03f3617f8e4b7b728984d49 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 7 Oct 2024 15:11:52 +0200 Subject: [PATCH] migrate to flat config, bump minimum nodejs version --- .eslintrc.json | 25 ------------------------- .github/workflows/nodejs.yml | 2 +- eslint.config.js | 33 +++++++++++++++++++++++++++++++++ package-lock.json | 2 +- package.json | 2 +- 5 files changed, 36 insertions(+), 28 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index ffb6ac06..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es2020": true, - "node": true, - "mocha": true - }, - "extends": ["eslint:recommended", "plugin:prettier/recommended"], - "plugins": ["import"], - "rules": { - "eol-last": "error", - "import/extensions": ["error", "always"], - "no-console": "error", - "no-constant-condition": ["error", { "checkLoops": false }], - "no-eval": "error", - "no-implied-eval": "error", - "no-trailing-spaces": "error", - "prefer-const": "error", - "semi": "error" - }, - "parserOptions": { - "sourceType": "module" - } -} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d0fa7f40..43120e1a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 16, 18] + node-version: [16, 18, 20, 22] steps: - uses: actions/checkout@v1 diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..db04f528 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,33 @@ +import js from "@eslint/js"; +import globals from "globals"; +import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import importPlugin from 'eslint-plugin-import'; + +export default [ + js.configs.recommended, + eslintPluginPrettierRecommended, + importPlugin.flatConfigs.recommended, + { + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + globals: { + ...globals.browser, + ...globals.node, + ...globals.mocha, + } + }, + rules: { + "eol-last": "error", + "import/extensions": ["error", "always"], + 'import/no-unresolved': 0, // https://github.com/import-js/eslint-plugin-import/issues/3082 + "no-console": "error", + "no-constant-condition": ["error", { "checkLoops": false }], + "no-eval": "error", + "no-implied-eval": "error", + "no-trailing-spaces": "error", + "prefer-const": "error", + "semi": "error" + }, + }, +]; diff --git a/package-lock.json b/package-lock.json index b13de482..c67fbb2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "webpack-cli": "^5.1.4" }, "engines": { - "node": ">= 14" + "node": ">= 16" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 5ee20ee7..498f8032 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "Timothy Gu " ], "engines": { - "node": ">= 14" + "node": ">= 16" }, "license": "W3C", "devDependencies": {