-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
247 lines (247 loc) · 6.85 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
{
//脚本目标的运行环境
"env": {
"browser": true,
"node": true,
"es6": true,
"commonjs": true
},
// 配置,extends 属性值可以省略包名的前缀 'eslint-config-'
"extends": [
"airbnb"
],
// 插件,plugins 属性值可以省略包名的前缀 'eslint-plugin-'
"plugins": [],
// 全局变量
"globals": {
"__DEV__": true,
"__WECHAT__": true,
"__ALIPAY__": true,
"App": true,
"Page": true,
"Component": true,
"Behavior": true,
"wx": true,
"getApp": true
},
// 转换设置
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
// 规则
"rules": {
// For more information about these rules, see: http://eslint.org/docs/rules/
// Possible Errors
// require or disallow trailing commas
"comma-dangle": [
2,
"never"
],
"global-require": [
0
],
"no-return-await": [
0
],
"max-len": [
"error",
{
"code": 120
}
],
// disallow use of Object.prototypes builtins directly
"no-prototype-builtins": 2,
// enforce valid JSDoc comments
"valid-jsdoc": [
2,
{
"requireReturn": false
}
],
// Best Practices
// enforce consistent brace style for all control statements
"curly": [
2,
"all"
],
// require for-in loops to include an if statement
"guard-for-in": [
1
],
// disallow new operators outside of assignments or comparisons
"no-new": [
0
],
// disallow reassigning function parameters
"no-param-reassign": [
1
],
// Variables
// disallow var declarations from shadowing variables in the outer scope
"no-shadow": [
1
],
// disallow the use of variables before they are defined
"no-use-before-define": [
"error",
{
"functions": false,
"classes": true
}
],
// Node.js and CommonJS
// require error handling in callbacks
"handle-callback-err": [
2,
"err"
],
// Stylistic Issues
// enforce consistent brace style for blocks
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": false
}
],
// enforce camelcase naming convention
"camelcase": [
2,
{
"properties": "always"
}
],
// enforce consistent naming when capturing the current execution context
"consistent-this": [
2,
"self"
],
// disallow specified identifiers
"id-blacklist": 0,
// enforce consistent indentation
"indent": [
2,
4,
{
"SwitchCase": 1,
"VariableDeclarator": 1
}
],
// enforce the consistent use of either double or single quotes in JSX attributes
"jsx-quotes": [
1,
"prefer-double"
],
// require empty lines around comments
"lines-around-comment": [
2,
{
"beforeBlockComment": true,
"beforeLineComment": true,
"allowBlockStart": true,
"allowObjectStart": true,
"allowArrayStart": true
}
],
// enforce a maximum depth that blocks can be nested
"max-depth": [
2,
4
],
// enforce a maximum depth that callbacks can be nested
"max-nested-callbacks": [
2,
4
],
// enforce a maximum number of parameters in function definitions
"max-params": [
2,
4
],
// enforce a maximum number of statements allowed per line
"max-statements-per-line": [
2,
{
"max": 1
}
],
// require parentheses when invoking a constructor with no arguments
"new-parens": 2,
// require or disallow an empty line after var declarations
"newline-after-var": [
2,
"always"
],
// require an empty line before return statements
"newline-before-return": 2,
// disallow use of chained assignment expressions
"no-multi-assign": 1,
// disallow multiple empty lines
"no-multiple-empty-lines": [
2,
{
"max": 3,
"maxEOF": 1
}
],
// disallow specified syntax
"no-restricted-syntax": [
2,
"DebuggerStatement",
"LabeledStatement",
"WithStatement"
],
// disallow dangling underscores in identifiers
"no-underscore-dangle": 0,
// enforce consistent line breaks inside braces
"object-curly-newline": [
2,
{
"multiline": true,
"minProperties": 1
}
],
// enforce placing object properties on separate lines
"object-property-newline": 2,
// enforce consistent linebreak style for operators
"operator-linebreak": [
2,
"after"
],
// require or disallow padding within blocks
"padded-blocks": 1,
// require JSDoc comments
"require-jsdoc": 2,
// require or disallow the Unicode BOM
"unicode-bom": [
2,
"never"
],
// ES6
// enforce consistent spacing around * operators in generator functions
"generator-star-spacing": [
2,
"after"
],
// disallow this/super before calling super() in constructors
"no-this-before-super": 2,
// disallow renaming import, export, and destructured assignments to the same name
"no-useless-rename": 2,
// plugin/import
// rorbid the use of extraneous packages
"import/no-extraneous-dependencies": 1,
// ensure imports point to a file/module that can be resolved
"import/no-unresolved": 1,
// Forbid require() calls with expressions
"import/no-dynamic-require": 1,
"import/prefer-default-export": 1,
// Ensure consistent use of file extension within the import path
"import/extensions": 1,
"func-names": [
1,
"as-needed"
],
"prefer-destructuring": "off"
}
}