-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
106 lines (85 loc) · 3.16 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
module.exports = {
"env": {
"node": true,
"es6": true,
"amd": true,
"mocha": true,
"jest": true
},
"globals": {
"__data": true
},
"plugins": ["node"],
"extends": ["eslint:recommended", "plugin:node/recommended"],
"settings": {
"node": {
"allowModules": ["chalk"],
"no-unpublished-require": 0,
"no-missing-require": 0
}
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"impliedStrict": true
},
"sourceType": "module",
},
/**
* "off" 或 0 - 关闭规则
* "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出),
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/
"rules": {
"node/no-missing-require": 0,
"node/no-unpublished-require": 0,
"no-process-exit": 0,
// 'strict': [2, "global"],
// 禁止条件表达式中出现赋值操作符
"no-cond-assign": 2,
// 变量声明方式
"one-var": [1, "never"],
// template 预处理
"prefer-template": 2,
// 箭头函数
"prefer-arrow-callback": 2,
// 禁用 console
"no-console": 0,
// 禁止在正则表达式中使用控制字符 :new RegExp("\x1f")
"no-control-regex": 2,
// 数组和对象键值对最后一个逗号, never参数:不能带末尾的逗号, always参数:必须带末尾的逗号,
// always-multiline:多行模式必须带逗号,单行模式不能带逗号
"comma-dangle": [2, "never"],
// 禁止空语句块
"no-empty": [1, { "allowEmptyCatch": true }],
// 禁止不必要的布尔转换
"no-extra-boolean-cast": 0,
// 禁止 case 语句落空
"no-fallthrough": "off",
// 控制逗号前后的空格
"comma-spacing": ['warn', { "before": false, "after": true }],
// 空格控制
"indent": [ "warn", 2 , {"SwitchCase": 1}],
// 强制使用一致的换行风格
"linebreak-style": [ "error" ],
// 强制使用一致的反勾号、双引号或单引号
"quotes": [ "warn", "single" ],
// 要求或禁止使用分号而不是 ASI(这个才是控制行尾部分号的,)
"semi": [ "error", "always" ],
// 关键字 后面必须跟空格
"keyword-spacing": [1, {"before": true, "after": true}],
// 要求或禁止语句块之前的空格
"space-before-blocks": [1, "always"],
// 要求或禁止块内填充
"padded-blocks": [1, {"blocks": "never"}],
// 一行代码最大长度
"max-len": [1, {"code": 100, "ignoreStrings": true, "ignoreRegExpLiterals": true, "ignoreComments": true, "ignoreTemplateLiterals": true}],
"no-trailing-spaces": [1, {"ignoreComments": true}],
// 大括号风格要求
"brace-style": [2],
// 要求遵循大括号约定
"curly": [2],
// async 语句需要有 await
"require-await": "error"
}
};