-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy path.eslintrc.json
54 lines (54 loc) · 1.63 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
{
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"eslint-config-prettier"
],
"plugins": ["prettier"],
"rules": {
"@typescript-eslint/no-explicit-any": "off", // 允许使用any
"@typescript-eslint/ban-ts-comment": "off", // 允许使用@ts-ignore
"@typescript-eslint/no-non-null-assertion": "off", // 允许使用非空断言
"@typescript-eslint/no-var-requires": "off", // 允许使用CommonJS的写法
"@typescript-eslint/no-unused-vars": "warn", // 允许未使用的变量
"no-debugger": "warn",
"import/order": [
"error",
{
// 按照分组顺序进行排序
"groups": ["builtin", "external", "parent", "sibling", "index", "internal", "object", "type"],
// 通过路径自定义分组
"pathGroups": [
{
"pattern": "react*",
"group": "builtin",
"position": "before"
},
{
"pattern": "@/components/**",
"group": "parent",
"position": "before"
},
{
"pattern": "@/utils/**",
"group": "parent",
"position": "after"
},
{
"pattern": "@/apis/**",
"group": "parent",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": ["react"],
"newlines-between": "never", // 每个分组之间换行
// 根据字母顺序对每个组内的顺序进行排序
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
]
}
}