From 8917deb5db8ffffaf64b235cf88db2d13f2b79c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Tue, 23 Apr 2024 20:34:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20=E4=BF=AE=E5=A4=8Dqodana?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.yml | 133 ------------------------------------------- eslint.config.js | 13 ++++- eslint/jsonEslint.js | 4 +- eslint/vueEslint.js | 4 +- eslint/ymlEslint.js | 5 +- tsconfig.json | 4 +- 6 files changed, 19 insertions(+), 144 deletions(-) delete mode 100644 .eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 7d145fb4..00000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,133 +0,0 @@ -root: true -env: - browser: true - es2021: true -extends: - - plugin:vue/vue3-essential - - prettier - - plugin:prettier/recommended - - plugin:yml/standard - - plugin:jsonc/recommended-with-json -parserOptions: - ecmaVersion: latest - sourceType: module - tsconfigRootDir: . - project: ./tsconfig.json -globals: - TGApp: readonly - window: readonly -rules: - vue/multi-word-component-names: off - vue/valid-template-root: off -overrides: - - files: ["*.ts"] - extends: love - # 将此处规则 copy 到下面的 .vue 文件的 rules 中 - rules: &typescript-rules - import/order: - - error - - groups: - - builtin - - external - - [internal, parent, sibling, index] - - unknown - newlines-between: always - alphabetize: - order: asc - caseInsensitive: true - "@typescript-eslint/indent": off - "@typescript-eslint/quotes": - - error - - double - "@typescript-eslint/semi": - - error - - always - "@typescript-eslint/comma-dangle": - - error - - always-multiline - "@typescript-eslint/space-before-function-paren": - - error - - anonymous: always - named: never - asyncArrow: always - "@typescript-eslint/member-delimiter-style": - - error - - multiline: - delimiter: semi - requireLast: true - "@typescript-eslint/no-import-type-side-effects": error - "@typescript-eslint/strict-boolean-expressions": off - "@typescript-eslint/consistent-type-assertions": - - warn - - assertionStyle: angle-bracket # 使用尖括号 - "@typescript-eslint/naming-convention": - - warn - - selector: variableLike - format: [camelCase, UPPER_CASE, PascalCase, snake_case] - leadingUnderscore: allow - trailingUnderscore: allow - "@typescript-eslint/no-non-null-assertion": warn - "@typescript-eslint/no-misused-promises": off - "@typescript-eslint/restrict-template-expressions": warn - - files: ["*.vue"] - parser: vue-eslint-parser - parserOptions: - parser: "@typescript-eslint/parser" - extraFileExtensions: [.vue] - rules: - <<: *typescript-rules - - files: [package.json, tsconfig.json] - parser: jsonc-eslint-parser - rules: - jsonc/sort-array-values: - - error - - pathPattern: .* - order: - type: asc - jsonc/sort-keys: - - error - - pathPattern: ^$ - order: - - name - - version - - description - - private - - packageManager - - scripts - - lint-staged - - keywords - - author - - license - - repository - - homepage - - bugs - - dependencies - - devDependencies - - files: ["*.yaml", "*.yml"] - parser: yaml-eslint-parser - parserOptions: - defaultYAMLVersion: "1.2" - rules: - yml/indent: - - error - - 2 - yml/no-multiple-empty-lines: error - yml/key-spacing: error - yml/quotes: - - error - - prefer: double - avoidEscape: true - yml/sort-keys: - - error - - pathPattern: ^$ - order: - - root - - env - - extends - - parserOptions - - globals - - rules - - overrides - - pathPattern: ^rules$ - order: - type: asc diff --git a/eslint.config.js b/eslint.config.js index 096d05b4..962d634b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,6 +7,17 @@ export default [ ymlEslintConfig, ...vueEslintConfig, { - ignores: ["dist", "src-tauri/target", "pnpm-lock.yaml", "src/data/**/*.json"], + ignores: [ + "dist", + "src-tauri/target", + "pnpm-lock.yaml", + "src/data/**/*.json", + "src-tauri/tauri.conf.json", + "qodana.yaml", + ".github", + ".vscode", + ".prettierrc.yml", + ".stylelintrc.yml", + ], }, ]; diff --git a/eslint/jsonEslint.js b/eslint/jsonEslint.js index 8c507683..65ac6046 100644 --- a/eslint/jsonEslint.js +++ b/eslint/jsonEslint.js @@ -26,7 +26,7 @@ const pkgJsonConfig = { "keywords", "author", "license", - "respository", + "repository", "homepage", "bugs", "dependencies", @@ -66,7 +66,7 @@ const tscJsonConfig = { }; const jsoncConfig = { - files: ["source/data/out/**/*.json"], + files: ["source/data/out/**/*.json", ".vscode/**/*.json"], plugins: { jsonc: eslint_jsonc, }, diff --git a/eslint/vueEslint.js b/eslint/vueEslint.js index 15320a08..feb2f32a 100644 --- a/eslint/vueEslint.js +++ b/eslint/vueEslint.js @@ -15,8 +15,8 @@ const tsConfigRules = { }, ], "@typescript-eslint/no-import-type-side-effects": "error", - "@typescript-eslint/strict-boolean-expressions": "warn", - "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/no-explicit-any": "off", "import/order": [ "error", { diff --git a/eslint/ymlEslint.js b/eslint/ymlEslint.js index 84b7ff40..0356fe12 100644 --- a/eslint/ymlEslint.js +++ b/eslint/ymlEslint.js @@ -1,18 +1,15 @@ -import eslint_import from "eslint-plugin-import"; import eslint_yml from "eslint-plugin-yml"; import yml_parser from "yaml-eslint-parser"; const ymlEslintConfig = { - files: ["*.yaml", "*.yml"], + files: ["**/*.yml", "**/*.yaml"], plugins: { yml: eslint_yml, - import: eslint_import, }, languageOptions: { parser: yml_parser, parserOptions: { defaultYAMLVersion: "1.2", - project: "./tsconfig.json", extraFileExtensions: [".yaml", ".yml"], }, }, diff --git a/tsconfig.json b/tsconfig.json index 0019404a..7a165c90 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,8 +16,8 @@ "composite": true }, "include": [ - "**/*.yml", - "**/*.yaml", + "*.yml", + "*.yaml", "package.json", "src/**/*.d.ts", "src/**/*.ts",