🚨 修复qodana报错

This commit is contained in:
目棃
2024-04-23 20:34:05 +08:00
parent 065019cdc6
commit 8917deb5db
6 changed files with 19 additions and 144 deletions

View File

@@ -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

View File

@@ -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",
],
},
];

View File

@@ -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,
},

View File

@@ -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",
{

View File

@@ -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"],
},
},

View File

@@ -16,8 +16,8 @@
"composite": true
},
"include": [
"**/*.yml",
"**/*.yaml",
"*.yml",
"*.yaml",
"package.json",
"src/**/*.d.ts",
"src/**/*.ts",