-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
46 lines (45 loc) · 1.76 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
{
"env": {
"browser": true,
"es6": true
},
"parser": "babel-eslint",
"plugins": [
"react",
"import"
],
"rules": {
"eqeqeq": "error", // 要求使用 === 和 !==
"indent": ["error", 2, { "SwitchCase": 1 }], // 要求使用两个空格缩进
"no-mixed-spaces-and-tabs": "error", // 禁止使用 空格 和 tab 混合缩进
"constructor-super": "error", // 验证构造函数中 super() 的调用
"arrow-spacing": "error", // 要求箭头函数的箭头之前或之后有空格
"no-var": "error", // 要求使用 let 或 const 而不是 var
"comma-style": ["error", "last"], // 要求逗号放在数组元素、对象属性或变量声明之后,且在同一行
"key-spacing": ["error", {
"beforeColon": false,
"afterColon": true
}],
"default-case": "error", // 要求 Switch 语句中有 Default 分支
"max-len": ["error", 100], // 强制行的最大长度
"keyword-spacing": ["error", { "before": true }],
"block-spacing": "error",
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"jsx-quotes": ["error", "prefer-single"],
"new-parens": "error",
"no-multiple-empty-lines": ["error", {
"max": 1,
"maxBOF": 0
}],
"object-curly-spacing": ["error", "always"],
"space-infix-ops": "error",
"semi": ["error", "never"],
// 引用全局包会导致该包报错,提示应该npm install 该包
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"react/jsx-filename-extension": "off",
"import/extensions": "off",
"react/require-default-props": "off",
"jsx-a11y/no-static-element-interactions": "off"
}
}