From 02ee92902909cd1a03ef704735e2be870c0bdf2b Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Wed, 4 Feb 2026 12:01:41 +0800 Subject: [PATCH] =?UTF-8?q?eslint=E9=85=8D=E7=BD=AE=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=88=B0=E6=89=81=E5=B9=B3=E6=A8=A1=E5=BC=8F=E3=80=82=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E6=B2=A1bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eslint.config.js.bak | 6 +- .../eslint.config.ts | 55 ++++++++++++++++++- .../regulatory-management-util/src/App.vue | 12 ++-- .../src/layout/console/components/Header.vue | 2 +- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/code/web/regulatory-management-util/eslint.config.js.bak b/code/web/regulatory-management-util/eslint.config.js.bak index d050fb1..4e58052 100644 --- a/code/web/regulatory-management-util/eslint.config.js.bak +++ b/code/web/regulatory-management-util/eslint.config.js.bak @@ -68,10 +68,8 @@ export default defineConfig([ pluginVue.configs["flat/essential"], { files: ["**/*.vue",], - languageOptions: { - sourceType: "module", - ecmaVersion: "latest", - parserOptions: { parser: tseslint.parser } + languageOptions: { + parserOptions: { parser: tseslint.parser, }, }, // rules: { // "vue/html-indent": ["error", 4,], diff --git a/code/web/regulatory-management-util/eslint.config.ts b/code/web/regulatory-management-util/eslint.config.ts index 1212fac..5121bde 100644 --- a/code/web/regulatory-management-util/eslint.config.ts +++ b/code/web/regulatory-management-util/eslint.config.ts @@ -7,7 +7,7 @@ import stylistic from "@stylistic/eslint-plugin"; export default defineConfig([ { - files: ["**/*.{js,mjs,cjs,ts,mts,cts}",], + files: ["**/*.{js,mjs,cjs,ts,mts,cts,vue}",], plugins: { js, }, extends: ["js/recommended",], languageOptions: { @@ -56,6 +56,55 @@ export default defineConfig([ }, }, pluginVue.configs["flat/essential"], - { files: ["**/*.vue",], - languageOptions: { parserOptions: { parser: tseslint.parser, }, }, }, + { + files: ["**/*.vue",], + plugins: { + "@stylistic": stylistic, + }, + languageOptions: { + parserOptions: { parser: tseslint.parser, }, + }, + rules: { + "vue/html-indent": ["error", 4,], + "vue/max-attributes-per-line": ["error", { + "singleline": { + "max": 1, + }, + "multiline": { + "max": 1, + }, + },], + "spaced-comment": "error", + "space-before-function-paren": "off", + "semi-spacing": ["error", {"before": false, + "after": true,},], + "@typescript-eslint/no-unused-vars": "warn", + "@stylistic/indent": ["error", 4, { SwitchCase: 1, },], + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-extra-semi": "off", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/ban-ts-comment": "warn", + "@typescript-eslint/member-delimiter-style": "off", + "@stylistic/semi": ["error", "always",], // 控制行尾部分号 + "@stylistic/brace-style": ["error", "allman", { allowSingleLine: true, },], + "@stylistic/comma-dangle": [ + "error", + { + arrays: "always", + objects: "always", + imports: "never", + exports: "never", + functions: "never", + }, + ], // 数组和对象键值对最后一个逗号 + "@stylistic/quotes": ["error", "double",], + "@typescript-eslint/space-before-function-paren": "off", + "@typescript-eslint/comma-spacing": ["off", { before: false, + after: true, },], // 使用eslint的,不用ts的 + // "@typescript-eslint/strict-boolean-expressions": ["error", { + // allowString: false, + // },], + "@stylistic/object-property-newline": "warn", + }, + }, ]); diff --git a/code/web/regulatory-management-util/src/App.vue b/code/web/regulatory-management-util/src/App.vue index 684c0b2..fc0fc5e 100644 --- a/code/web/regulatory-management-util/src/App.vue +++ b/code/web/regulatory-management-util/src/App.vue @@ -1,11 +1,15 @@