mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🔧 优化 eslint 配置
This commit is contained in:
189
.eslintrc.yml
189
.eslintrc.yml
@@ -3,29 +3,69 @@ env:
|
||||
browser: true
|
||||
es2021: true
|
||||
extends:
|
||||
- plugin:vue/vue3-recommended
|
||||
- standard-with-typescript
|
||||
- plugin:vue/vue3-essential
|
||||
- prettier
|
||||
- plugin:prettier/recommended
|
||||
parser: vue-eslint-parser
|
||||
- plugin:yml/standard
|
||||
- plugin:jsonc/recommended-with-json
|
||||
parserOptions:
|
||||
extraFileExtensions:
|
||||
- .vue
|
||||
parser: "@typescript-eslint/parser"
|
||||
project:
|
||||
- tsconfig.json
|
||||
- tsconfig.node.json
|
||||
ecmaVersion: latest
|
||||
sourceType: module
|
||||
tsconfigRootDir: .
|
||||
project: ./tsconfig.json
|
||||
globals:
|
||||
TGApp: readonly
|
||||
window: readonly
|
||||
plugins:
|
||||
- vue
|
||||
- prettier
|
||||
rules:
|
||||
# normal
|
||||
array-callback-return: warn
|
||||
# TypeScript
|
||||
"@typescript-eslint/strict-boolean-expressions": off
|
||||
vue/multi-word-component-names: warn
|
||||
overrides:
|
||||
- files: ["*.ts"]
|
||||
extends: standard-with-typescript
|
||||
# 将此处规则 copy 到下面的 .vue 文件的 rules 中
|
||||
rules:
|
||||
import/order:
|
||||
- error
|
||||
- groups:
|
||||
- builtin
|
||||
- external
|
||||
- [internal, parent, sibling, index]
|
||||
- unknown
|
||||
newlines-between: always
|
||||
alphabetize:
|
||||
order: asc
|
||||
caseInsensitive: true
|
||||
"@typescript-eslint/indent":
|
||||
- warn
|
||||
- 2
|
||||
"@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":
|
||||
- warn
|
||||
- allowString: false
|
||||
allowNumber: false
|
||||
allowNullableObject: false
|
||||
allowNullableBoolean: false
|
||||
allowNullableString: false
|
||||
allowNullableNumber: false
|
||||
allowAny: false
|
||||
"@typescript-eslint/consistent-type-assertions":
|
||||
- warn
|
||||
- assertionStyle: angle-bracket # 使用尖括号
|
||||
@@ -37,5 +77,118 @@ rules:
|
||||
trailingUnderscore: "allow"
|
||||
"@typescript-eslint/no-non-null-assertion": warn
|
||||
"@typescript-eslint/no-misused-promises": warn
|
||||
# Vue
|
||||
"vue/multi-word-component-names": off
|
||||
- files: ["*.vue"]
|
||||
parser: vue-eslint-parser
|
||||
parserOptions:
|
||||
parser: "@typescript-eslint/parser"
|
||||
extraFileExtensions: [".vue"]
|
||||
rules:
|
||||
import/order:
|
||||
- error
|
||||
- groups:
|
||||
- builtin
|
||||
- external
|
||||
- [internal, parent, sibling, index]
|
||||
- unknown
|
||||
newlines-between: always
|
||||
alphabetize:
|
||||
order: asc
|
||||
caseInsensitive: true
|
||||
"@typescript-eslint/indent":
|
||||
- warn
|
||||
- 2
|
||||
"@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":
|
||||
- warn
|
||||
- allowString: false
|
||||
allowNumber: false
|
||||
allowNullableObject: false
|
||||
allowNullableBoolean: false
|
||||
allowNullableString: false
|
||||
allowNullableNumber: false
|
||||
allowAny: false
|
||||
"@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": warn
|
||||
- files: ["*.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
|
||||
|
||||
10
package.json
10
package.json
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"version": "0.3.3",
|
||||
"author": "BTMuli <bt-muli@outlook.com>",
|
||||
"packageManager": "pnpm@8.8.0",
|
||||
"packageManager": "pnpm@8.9.0",
|
||||
"scripts": {
|
||||
"build": "tauri build",
|
||||
"debug": "tauri build --debug",
|
||||
@@ -81,13 +81,16 @@
|
||||
"concurrently": "^8.2.1",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-config-standard-with-typescript": "^39.1.0",
|
||||
"eslint-config-standard-with-typescript": "^39.1.1",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-plugin-jsonc": "^2.10.0",
|
||||
"eslint-plugin-n": "^16.1.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-vue": "^9.17.0",
|
||||
"eslint-plugin-yml": "^1.10.0",
|
||||
"husky": "^8.0.3",
|
||||
"jsonc-eslint-parser": "^2.3.0",
|
||||
"lint-staged": "^14.0.1",
|
||||
"prettier": "3.0.3",
|
||||
"stylelint": "^15.10.3",
|
||||
@@ -99,6 +102,7 @@
|
||||
"stylelint-prettier": "^4.0.2",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-vuetify": "^1.0.2"
|
||||
"vite-plugin-vuetify": "^1.0.2",
|
||||
"yaml-eslint-parser": "^1.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
77
pnpm-lock.yaml
generated
77
pnpm-lock.yaml
generated
@@ -98,11 +98,14 @@ devDependencies:
|
||||
specifier: ^9.0.0
|
||||
version: 9.0.0(eslint@8.50.0)
|
||||
eslint-config-standard-with-typescript:
|
||||
specifier: ^39.1.0
|
||||
version: 39.1.0(@typescript-eslint/eslint-plugin@6.7.3)(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0)(typescript@5.2.2)
|
||||
specifier: ^39.1.1
|
||||
version: 39.1.1(@typescript-eslint/eslint-plugin@6.7.3)(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0)(typescript@5.2.2)
|
||||
eslint-plugin-import:
|
||||
specifier: ^2.28.1
|
||||
version: 2.28.1(@typescript-eslint/parser@6.7.3)(eslint@8.50.0)
|
||||
eslint-plugin-jsonc:
|
||||
specifier: ^2.10.0
|
||||
version: 2.10.0(eslint@8.50.0)
|
||||
eslint-plugin-n:
|
||||
specifier: ^16.1.0
|
||||
version: 16.1.0(eslint@8.50.0)
|
||||
@@ -115,9 +118,15 @@ devDependencies:
|
||||
eslint-plugin-vue:
|
||||
specifier: ^9.17.0
|
||||
version: 9.17.0(eslint@8.50.0)
|
||||
eslint-plugin-yml:
|
||||
specifier: ^1.10.0
|
||||
version: 1.10.0(eslint@8.50.0)
|
||||
husky:
|
||||
specifier: ^8.0.3
|
||||
version: 8.0.3
|
||||
jsonc-eslint-parser:
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
lint-staged:
|
||||
specifier: ^14.0.1
|
||||
version: 14.0.1
|
||||
@@ -154,6 +163,9 @@ devDependencies:
|
||||
vite-plugin-vuetify:
|
||||
specifier: ^1.0.2
|
||||
version: 1.0.2(vite@4.4.9)(vue@3.3.4)(vuetify@3.3.19)
|
||||
yaml-eslint-parser:
|
||||
specifier: ^1.2.2
|
||||
version: 1.2.2
|
||||
|
||||
packages:
|
||||
|
||||
@@ -1912,6 +1924,15 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/eslint-compat-utils@0.1.2(eslint@8.50.0):
|
||||
resolution: {integrity: sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==}
|
||||
engines: {node: '>=12'}
|
||||
peerDependencies:
|
||||
eslint: '>=6.0.0'
|
||||
dependencies:
|
||||
eslint: 8.50.0
|
||||
dev: true
|
||||
|
||||
/eslint-config-prettier@9.0.0(eslint@8.50.0):
|
||||
resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==}
|
||||
hasBin: true
|
||||
@@ -1921,8 +1942,8 @@ packages:
|
||||
eslint: 8.50.0
|
||||
dev: true
|
||||
|
||||
/eslint-config-standard-with-typescript@39.1.0(@typescript-eslint/eslint-plugin@6.7.3)(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0)(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-5+SPKis3yr6T1X6wSA7HhDuumTRMrTDMcsTrIWhdZuI+sX3e8SPGZYzuJxVxdc239Yo718dEVEVyJhHI6jUjrQ==}
|
||||
/eslint-config-standard-with-typescript@39.1.1(@typescript-eslint/eslint-plugin@6.7.3)(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.50.0)(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-t6B5Ep8E4I18uuoYeYxINyqcXb2UbC0SOOTxRtBSt2JUs+EzeXbfe2oaiPs71AIdnoWhXDO2fYOHz8df3kV84A==}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/eslint-plugin': ^6.4.0
|
||||
eslint: ^8.0.1
|
||||
@@ -2043,6 +2064,19 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-jsonc@2.10.0(eslint@8.50.0):
|
||||
resolution: {integrity: sha512-9d//o6Jyh4s1RxC9fNSt1+MMaFN2ruFdXPG9XZcb/mR2KkfjADYiNL/hbU6W0Cyxfg3tS/XSFuhl5LgtMD8hmw==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: '>=6.0.0'
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.0(eslint@8.50.0)
|
||||
eslint: 8.50.0
|
||||
eslint-compat-utils: 0.1.2(eslint@8.50.0)
|
||||
jsonc-eslint-parser: 2.3.0
|
||||
natural-compare: 1.4.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-n@16.1.0(eslint@8.50.0):
|
||||
resolution: {integrity: sha512-3wv/TooBst0N4ND+pnvffHuz9gNPmk/NkLwAxOt2JykTl/hcuECe6yhTtLJcZjIxtZwN+GX92ACp/QTLpHA3Hg==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
@@ -2109,6 +2143,22 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-yml@1.10.0(eslint@8.50.0):
|
||||
resolution: {integrity: sha512-53SUwuNDna97lVk38hL/5++WXDuugPM9SUQ1T645R0EHMRCdBIIxGye/oOX2qO3FQ7aImxaUZJU/ju+NMUBrLQ==}
|
||||
engines: {node: ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: '>=6.0.0'
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
eslint: 8.50.0
|
||||
eslint-compat-utils: 0.1.2(eslint@8.50.0)
|
||||
lodash: 4.17.21
|
||||
natural-compare: 1.4.0
|
||||
yaml-eslint-parser: 1.2.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-scope@7.2.2:
|
||||
resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -3059,6 +3109,16 @@ packages:
|
||||
minimist: 1.2.8
|
||||
dev: true
|
||||
|
||||
/jsonc-eslint-parser@2.3.0:
|
||||
resolution: {integrity: sha512-9xZPKVYp9DxnM3sd1yAsh/d59iIaswDkai8oTxbursfKYbg/ibjX0IzFt35+VZ8iEW453TVTXztnRvYUQlAfUQ==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
acorn: 8.10.0
|
||||
eslint-visitor-keys: 3.4.3
|
||||
espree: 9.6.1
|
||||
semver: 7.5.4
|
||||
dev: true
|
||||
|
||||
/jsonfile@4.0.0:
|
||||
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}
|
||||
optionalDependencies:
|
||||
@@ -5048,6 +5108,15 @@ packages:
|
||||
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
|
||||
dev: true
|
||||
|
||||
/yaml-eslint-parser@1.2.2:
|
||||
resolution: {integrity: sha512-pEwzfsKbTrB8G3xc/sN7aw1v6A6c/pKxLAkjclnAyo5g5qOh6eL9WGu0o3cSDQZKrTNk4KL4lQSwZW+nBkANEg==}
|
||||
engines: {node: ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
eslint-visitor-keys: 3.4.3
|
||||
lodash: 4.17.21
|
||||
yaml: 2.3.1
|
||||
dev: true
|
||||
|
||||
/yaml@2.3.1:
|
||||
resolution: {integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
@@ -12,12 +12,17 @@
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"skipLibCheck": true,
|
||||
"types": ["vite/client"]
|
||||
"types": ["vite/client"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"composite": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.vue",
|
||||
"vite.config.ts",
|
||||
"tsconfig.json",
|
||||
".yml",
|
||||
"package.json"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"composite": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts", "src/utils/TGBuild.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user