From e2d6cd31b2a8781a9242281ef23f09b3f91631f2 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 6 Apr 2024 15:28:33 +0800 Subject: [PATCH] WebUI: migrate to ESLint v9 --- src/webui/www/.eslintrc.json | 29 ----------------------- src/webui/www/eslint.config.mjs | 41 +++++++++++++++++++++++++++++++++ src/webui/www/package.json | 4 ++-- 3 files changed, 43 insertions(+), 31 deletions(-) delete mode 100644 src/webui/www/.eslintrc.json create mode 100644 src/webui/www/eslint.config.mjs diff --git a/src/webui/www/.eslintrc.json b/src/webui/www/.eslintrc.json deleted file mode 100644 index 69e9d3abf..000000000 --- a/src/webui/www/.eslintrc.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "env": { - "browser": true, - "es2022": true - }, - "extends": [ - "eslint:recommended", - "plugin:@stylistic/disable-legacy" - ], - "plugins": [ - "html", - "@stylistic" - ], - "rules": { - "eqeqeq": "error", - "no-undef": "off", - "no-unused-vars": "off", - "@stylistic/no-mixed-operators": [ - "error", - { - "groups": [ - ["&", "|", "^", "~", "<<", ">>", ">>>", "==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"] - ] - } - ], - "@stylistic/nonblock-statement-body-position": ["error", "below"], - "@stylistic/semi": "error" - } -} diff --git a/src/webui/www/eslint.config.mjs b/src/webui/www/eslint.config.mjs new file mode 100644 index 000000000..1e84f9d6e --- /dev/null +++ b/src/webui/www/eslint.config.mjs @@ -0,0 +1,41 @@ +import Globals from 'globals'; +import Html from 'eslint-plugin-html'; +import Js from '@eslint/js'; +import Stylistic from '@stylistic/eslint-plugin'; + +export default [ + Js.configs.recommended, + Stylistic.configs["disable-legacy"], + { + files: [ + "**/*.html", + "**/*.js", + "**/*.mjs" + ], + languageOptions: { + ecmaVersion: 2022, + globals: { + ...Globals.browser + } + }, + plugins: { + Html, + Stylistic + }, + rules: { + "eqeqeq": "error", + "no-undef": "off", + "no-unused-vars": "off", + "Stylistic/no-mixed-operators": [ + "error", + { + "groups": [ + ["&", "|", "^", "~", "<<", ">>", ">>>", "==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"] + ] + } + ], + "Stylistic/nonblock-statement-body-position": ["error", "below"], + "Stylistic/semi": "error" + } + } +]; diff --git a/src/webui/www/package.json b/src/webui/www/package.json index 95e8ad9dc..7b11828f0 100644 --- a/src/webui/www/package.json +++ b/src/webui/www/package.json @@ -12,8 +12,8 @@ }, "devDependencies": { "@stylistic/eslint-plugin": "*", - "eslint": "^8", - "eslint-plugin-html": "^8", + "eslint": "*", + "eslint-plugin-html": "*", "html-validate": "*", "i18next-parser": "*", "js-beautify": "*",