-
Notifications
You must be signed in to change notification settings - Fork 4
/
.eslintrc.cjs
49 lines (49 loc) · 1.55 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
module.exports = {
// 以此文件为准 不往上查找 eslint 配置文件
root: true,
parser: "@typescript-eslint/parser",
// 环境
env: {
browser: true,
es2021: true,
commonjs: true,
},
globals: {
process: "writable",
__dirname: "readonly",
},
// 继承插件特性
extends: ["eslint:recommended", "plugin:react/recommended", "plugin:react/jsx-runtime", "plugin:react-hooks/recommended", "plugin:@typescript-eslint/recommended"],
// 解析选项
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 13,
sourceType: "module",
},
// 共享配置
settings: {
react: {
createClass: "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
pragma: "React", // Pragma to use, default to "React"
fragment: "Fragment", // Fragment to use (may be a property of <pragma>), default to "Fragment"
version: "detect", // React version. "detect" automatically picks the version you have installed.
flowVersion: "0.53", // Flow version
},
},
// 插件
plugins: ["prettier", "react", "@typescript-eslint"],
// 检查规则
rules: {
"prettier/prettier": ["error", { arrowParens: "avoid", singleQuote: false, printWidth: 170 }],
"react/prop-types": 0,
"no-use-before-define": "error",
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-empty-interface": 0,
},
// 过滤文件
ignorePatterns: ["dist", "node_modules", "pnpm-lock", "env"],
};