-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
70 lines (70 loc) · 2.57 KB
/
.eslintrc.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
"root": true,
"extends": ["prettier", "plugin:prettier/recommended", "plugin:@typescript-eslint/recommended", "plugin:import/recommended", "plugin:promise/recommended", "eslint:recommended"],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"globals": {
"JSX": "readonly" // 告诉 ESLint JSX 是一个只读的全局变量
},
"parserOptions": {
"ecmaVersion": 13,
"sourceType": "module",
// "project": ["./tsconfig.json"],
"ecmaFeatures": {
"jsx": true // 启用 JSX 支持
}
},
"plugins": ["prettier", "@typescript-eslint", "import", "promise"],
"rules": {
"prettier/prettier": "error",
"vue/multi-word-component-names": "off", // 禁用对 组件名字检查
"@typescript-eslint/semi": "off", // 禁用对函数最后的 ; 检查
"@typescript-eslint/space-before-function-paren": "off", // 禁用对 函数前面空一格检查
"no-console": "off", // 禁用对 console 的检查
"@typescript-eslint/member-delimiter-style": "off", // 禁用对 ; 检查
"@typescript-eslint/no-floating-promises": "off", // 禁用每个方法都需要async await
"@typescript-eslint/strict-boolean-expressions": "off", // 禁用不能直接 undefined
"@typescript-eslint/prefer-function-type": "off",
"no-lonely-if": "off", // 取消if但是没有else
"eqeqeq": "off", // 取消用 ==,
"array-callback-return": "off",
"import/named": "off", // 禁用 import/named 规则
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off", // 禁止使用any
"@typescript-eslint/explicit-function-return-type": "off", // 禁止 return 需要类型
"import/no-unresolved": "off", // 禁止导入的时候需要后缀
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^h$" // 忽略名为 'h' 的变量
}
],
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "^h$" // 忽略名为 'h' 的变量
}
],
"@typescript-eslint/ban-ts-comment": "off" // 禁止检测 @ts-ignore 等功能
},
"overrides": [
{
"files": ["./src/**/*.{.js,.ts,.tsx,.jsx}", "./src/*.{.js,.ts,.tsx,.jsx}"]
},
{
"files": ["*.json"],
"rules": {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": "off"
}
}
],
"ignorePatterns": ["test-ui"] // 排除该文件
}