From b2820a30515e9ba0e9f6e3e5128ea73961c86049 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 19 Apr 2026 17:46:12 +0000 Subject: [PATCH] update eslint to v10 --- configs/.eslintrc.json | 42 --------------------------------------- configs/eslint.config.mjs | 36 +++++++++++++++++++++++++++++++++ package.json | 15 +++++++------- 3 files changed, 43 insertions(+), 50 deletions(-) delete mode 100644 configs/.eslintrc.json create mode 100644 configs/eslint.config.mjs diff --git a/configs/.eslintrc.json b/configs/.eslintrc.json deleted file mode 100644 index aa730af..0000000 --- a/configs/.eslintrc.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": "standard", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "rules": { - "no-tabs": [ - "error", - { - "allowIndentationTabs": true - } - ], - "indent": [ - "error", - "tab" - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "double" - ], - "semi": [ - "error", - "always" - ], - "brace-style": [ - "error", - "stroustrup", - { - "allowSingleLine": false - } - ] - } -} diff --git a/configs/eslint.config.mjs b/configs/eslint.config.mjs new file mode 100644 index 0000000..15a9eef --- /dev/null +++ b/configs/eslint.config.mjs @@ -0,0 +1,36 @@ +import { defineConfig } from "eslint/config"; +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 defineConfig([js.configs.recommended,{ + languageOptions: { + globals: { + ...globals.browser, + }, + ecmaVersion: "latest", + sourceType: "module", + }, + rules: { + "no-tabs": ["error", { + allowIndentationTabs: true, + }], + indent: ["error", "tab"], + "linebreak-style": ["error", "unix"], + quotes: ["error", "double"], + semi: ["error", "always"], + "brace-style": ["error", "stroustrup", { + allowSingleLine: false, + }], + }, +}]); \ No newline at end of file diff --git a/package.json b/package.json index 4b8f139..012ed57 100644 --- a/package.json +++ b/package.json @@ -4,17 +4,16 @@ "description": "Front-end for ProxmoxAAS", "type": "module", "scripts": { - "lint": "html-validate --config configs/.htmlvalidate.json web/html/*; stylelint --config configs/.stylelintrc.json --formatter verbose --fix web/css/*.css; DEBUG=eslint:cli-engine eslint --config configs/.eslintrc.json --fix web/scripts/", + "lint": "html-validate --config configs/.htmlvalidate.json web/html/*; stylelint --config configs/.stylelintrc.json --formatter verbose --fix web/css/*.css; DEBUG=eslint:cli-engine eslint --config configs/eslint.config.mjs --fix web/scripts/", "update-modules": "rm -rf web/modules/wfa.js web/modules/wfa.wasm; curl https://git.tronnet.net/alu/WFA-JS/releases/download/latest/wfa.js -o web/modules/wfa.js; curl https://git.tronnet.net/alu/WFA-JS/releases/download/latest/wfa.wasm -o web/modules/wfa.wasm" }, "devDependencies": { - "eslint": "^8.43.0", - "eslint-config-standard": "^17.1.0", - "eslint-plugin-import": "^2.27.5", - "eslint-plugin-n": "^16.0.1", - "eslint-plugin-promise": "^6.1.1", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "^10.0.1", + "eslint": "^10.2.1", + "globals": "^17.5.0", + "html-validate": "^9.4.0", "stylelint": "^15.9.0", - "stylelint-config-standard": "^33.0.0", - "html-validate": "^9.4.0" + "stylelint-config-standard": "^33.0.0" } }