You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
55 lines
1.8 KiB
{
|
|
"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的写法
|
|
"no-console": ["warn", { "allow": ["warn", "error"] }], // 提交时不允许有console.log
|
|
"@typescript-eslint/no-unused-vars": "off", // 允许存在未使用的变量
|
|
"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": "always", // 每个分组之间换行
|
|
// 根据字母顺序对每个组内的顺序进行排序
|
|
"alphabetize": {
|
|
"order": "asc",
|
|
"caseInsensitive": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|