-
Notifications
You must be signed in to change notification settings - Fork 13
/
.eslintrc.cjs
51 lines (50 loc) · 1.6 KB
/
.eslintrc.cjs
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
/*
* @Date: 2023-11-22 11:52:48
* @Description: Modify here please
*/
module.exports = {
root: true,
env: {
node: true
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020
},
overrides: [
{
files: ["*.json", "*.json5", "*.jsonc"],
parser: "jsonc-eslint-parser"
},
{
files: ["**/*.md/*.js", "**/*.md/*.ts"],
rules: {
"no-console": "off",
"import/no-unresolved": "off"
}
}
],
rules: {
// JavaScript/ESLint 推荐的规则
"no-console": "off", // 不允许使用 console.log 等
"no-unused-vars": "warn", // 不允许存在未使用的变量
"no-undef": "off", // 不允许使用未定义的变量
"no-mixed-spaces-and-tabs": "off",
quotes: "off",
"no-unsafe-optional-chaining": "off",
"prefer-const": "off",
// TypeScript/ESLint 推荐的规则
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": "warn", // 不允许存在未使用的 TypeScript 变量
"@typescript-eslint/explicit-module-boundary-types": "off", // 允许不显式指定导出函数的返回类型
"@typescript-eslint/no-explicit-any": "off", // 允许使用 any 类型
"react-refresh/only-export-components": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": ["off"]
},
plugins: ["react-refresh"],
ignorePatterns: ["node_modules/", "dist/"]
};