-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
73 lines (60 loc) · 1.69 KB
/
.eslintrc.js
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
71
72
73
const OFF = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
"parser": "babel-eslint",
// 指定解析器选项
"parserOptions": {
// 启用ES8语法支持
"ecmaVersion": 2017,
// module表示ECMAScript模块
"sourceType": "module",
// 使用额外的语言特性
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true,
"modules": true,
}
},
// 指定脚本的运行环境
"env": {
"browser": true,
"jquery": true,
"node": true,
"commonjs": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier"
],
"plugins": [
"react",
"react-hooks"
],
// 别人可以直接使用你配置好的ESLint
"root": true,
// 启用的规则及其各自的错误级别
// 每个规则对应的0,1,2分别表示off, warning, error三个错误级别
"rules": {
// 定义了变量却没有在代码中使用,这是防止产生多余没用的变量
"no-unused-vars": OFF,
// 禁用 console
"no-console": OFF,
// 禁用未声明的变量
"no-undef": OFF,
"no-useless-escape": OFF,
"react/no-deprecated": OFF,
"react/no-find-dom-node": OFF,
"react/display-name": OFF,
"react/prop-types": OFF,
"react-hooks/rules-of-hooks": ERROR,
"react-hooks/exhaustive-deps": WARN,
"react/jsx-key": WARN,
"no-case-declarations": WARN,
"react/jsx-uses-react": OFF,
"react/react-in-jsx-scope": OFF,
}
};