-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy path.eslintrc
70 lines (70 loc) · 2.29 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
{
//文件名 .eslintrc.json
"env": {
"browser": true,
"es6": true,
"node": true,
"commonjs": true
},
"extends": "airbnb",
"installedESLint": true,
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true,
"arrowFunctions": true,
"classes": true,
"modules": true,
"defaultParams": true
},
"sourceType": "module"
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
// 警告
"semi": 1,
"no-unused-vars": 1,
// 缩进调整为 4 空格,airbnb 为 2 空格
"indent": [2, 4, { "SwitchCase": 1 }],
"react/jsx-filename-extension": "off",
// 不禁用 console
"no-console": "off",
// 不强制函数表达式有名字
"func-names": "off",
// 不禁用 amd 的 require
"import/no-amd": "off",
// 不禁用 ES6 import 无法解析的模块
"import/no-unresolved": "off",
// 不强制全局 require
"global-require": "off",
// 由于是 4 空格缩进,将每行最大长度放宽到 240,airbnb 为 100
"max-len": [2, 240, 2, { "ignoreUrls": true, "ignoreComments": false }],
// 不禁止 for in 循环
"no-restricted-syntax": [2, "DebuggerStatement", "LabeledStatement", "WithStatement"],
// 不禁止使用下划线作为变量名前缀
"no-underscore-dangle": ["off"],
// 不强制 return
"consistent-return": ["off"],
// 不强制使用 => 代替函数
"prefer-arrow-callback": ["off"],
// 不强制使用 camel case 命名
"camelcase": ["error"],
// 允许修改参数
"no-param-reassign": ["off"],
// 不强制链式操作另起一行
"newline-per-chained-call": ["off"],
"new-parens": "off",
"arrow-parens": "off",
"no-plusplus": "off",
"no-mixed-operators": "off",
"import/extensions": "off",
"import/newline-after-import": "off",
"import/no-extraneous-dependencies": "off",
"import/no-dynamic-require": "off",
"import/imports-first": "off",
"no-unused-expressions": "off",
}
}