-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
80 lines (80 loc) · 2.35 KB
/
.eslintrc
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
74
75
76
77
78
79
80
{
// 环境,这里可以设置环来做区别判断
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
// 使用的扩展库
"extends": ["airbnb"],
// 解析器用于解析代码
"parser": "babel-eslint",
// 解析器配置
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
// 可以全局使用变量
"globals": {
"Babel": true,
"React": true
},
// 第三方插件
"plugins": [
"react"
],
// 规则配置
"rules": {
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
//缩进风格
"indent": [2,4],
"react/jsx-indent-props":[2,4],
"react/jsx-indent":[2,4],
//不限制每一行的字符数
"max-len": 0,
// 不区分是否在 despendencies
"import/no-extraneous-dependencies": 0,
// 引用时候根据根目录基础
"import/no-unresolved": 0,
// 允许在 .js 和 .jsx 文件中使用 jsx
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
//必须使用全等于 ===
"eqeqeq": 0,
//禁止object对象出现换行,或者换行后仅允许一行存在
"object-curly-newline": ["error", {
"ObjectExpression": { "multiline": true },
"ObjectPattern": { "multiline": true },
"ImportDeclaration": "never",
"ExportDeclaration": { "multiline": true, "minProperties": 3 }
}],
"max-statements": ["error", 100],
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true,
"FunctionExpression": true
}
}],
//关闭 非Button的 onClick 事件需要至少一个键盘事件 规则
"jsx-a11y/no-static-element-interactions":0,
"jsx-a11y/click-events-have-key-events":0,
"no-console": ["error", { allow: ["warn", "error"] }],
"react/prop-types": [2, { ignore: ['children'] }]
}
}