This repository has been archived by the owner on Oct 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
240 lines (239 loc) · 8.45 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
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
module.exports = {
"env": {
"browser": true,
"es6": true,
"jquery": true,
"mocha": true,
"node": true,
},
"extends": "eslint:recommended",
"rules": {
/* errors */
// enforce the more conscise brace style
"brace-style": [
"error",
"1tbs"
],
// enforce braces around arrow-lambda functions
"arrow-body-style": [
"error",
"always"
],
// enforce parens around arrow function parameters, as in:
// (foo) => {};
"arrow-parens": ["error"],
// require spaces around the arrow function operator
"arrow-spacing": [
"error",
{"before": true, "after": true, }
],
// enforce 4 space indent
"indent": [
"warn",
4,
{"MemberExpression": 0, }
],
// do not allow extra unnecessary empty lines
"no-multiple-empty-lines": [
"error",
{"max": 2, }
],
// do not allow extra unnecessary spaces except where alignment may be
// beneficial to increase legibility
"no-multi-spaces": [
"error",
{
"ignoreEOLComments": true,
"exceptions": {
"Property": true,
"VariableDeclarator": true,
"ImportDeclaration": true,
},
}
],
// enforce blank-lines after directives
"padding-line-between-statements": [
"error",
{"blankLine": "always", "prev": "directive", "next": "*", },
{"blankLine": "never", "prev": "directive", "next": "directive", },
],
// do not all multiple variable declaration on a single line as in,
// var foo, bar, baz; // not allowed
// let fizz, buzz; // not allowed
// const a, b, c; // not allowed
"one-var": [
"error",
{"var": "never", "let": "never", "const": "never", }
],
// require spaces before and after keywords such as 'if', 'for', ...
"keyword-spacing": [
"error",
{"before": true, "after": true, }
],
// always break before lines before binary operators
"operator-linebreak": [
"error",
"before"
],
// always require spaces around unary word operators like 'new',
// never around unary symbolic operators like '++'
"space-unary-ops": [
"error",
{"words": true, "nonwords": false, }
],
// never permit padding array brackets with spaces, as in:
// let arr = [ 'foo', 'bar' ]; // not allowed
"array-bracket-spacing": [
"error",
"never"
],
// enforce consistent array bracketing style over multiple lines for
// long arrays
//"array-element-newline": [
// "error",
// {"multiline": true, "minItems": 4, }
//],
// never permit padding parentheses with spaces, as in:
// function( 'foo', 'bar' ); // not allowed
"space-in-parens": [
"error",
"never"
],
// only permit one space after a comma, and no spaces before
"comma-spacing": [
"error",
{"before": false, "after": true, }
],
// commas must be preceded by something; they are not allowed to be
// first on a line
"comma-style": [
"error",
"last"
],
// require trailing commas on object properties
"comma-dangle": [
"error",
{
"arrays": "only-multiline",
"objects": "always",
"functions": "never",
}
],
// do not allow spaces before semi-colons
"semi-spacing": [
"error",
{"before": false, "after": true, }
],
// always require semi-colons to terminate statements
"semi": [
"error",
"always"
],
// do not all terminating lines with extra semi-colons
"no-extra-semi": ["error"],
// always use unix line-endings
"linebreak-style": [
"error",
"unix"
],
// always use double quotes for strings
"quotes": [
"error",
"double"
],
// always require curly braces around if, for, do, while ...
"curly": [
"error",
"all"
],
// require that when Object.property access is split over lines, the dot
// stays with the property, as in:
// Object
// .property()
// .another()
"dot-location": [
"error",
"property"
],
// enforce comparison with typesafe === operator, except when comparing
// with null, where comparing `a == null` can be a useful shorthand
"eqeqeq": [
"error",
"always",
{"null": "ignore", }
],
// simplify if-else statements by not allowing singular if statements
// at the top level of an else block;
// i.e. always use `if else` when possible
"no-lonely-if": ["error"],
// simplify if-else statements with conditional returns
"no-else-return": [
"error",
{ "allowElseIf": false, }
],
// always require floating points have a leading or trailing zero after
// the decimal point, as in:
// -42, 73, 0, 0.5, -0.7, 2.0, 0.0
"no-floating-decimal": ["error"],
// do not allow hard to read implicit type conversions, as in:
// !!foo; +foo; foo += ""; // etc
"no-implicit-coercion": ["error"],
// do not allow reckless Boolean casts as in:
// !!foo; /* or */ Boolean(foo);
"no-extra-boolean-cast": ["error"],
// do not allow initialization of a variable to be undefined, as in:
// let foo = undefined; // not allowed
"no-undef-init": ["error"],
// do not allow labeled statements
"no-labels": ["error"],
// do not allow functions to have arguments with the same name
"no-dupe-args": ["error"],
// do not allow switches to have duplicate cases
"no-duplicate-case": ["error"],
// do not allow use of process.exit(), because this can be called at any
// time, sometimes unexpectedly during an async call and ruin everything
"no-process-exit": ["error"],
// sort es6 imports alphabetically
"sort-imports": ["error"],
// never allow comparisons where "literal" === variable, as in:
// true == flag
// "string" === value
// 0 <= x
"yoda": [
"error",
"never"
],
/* warnings */
// warn when a variable could be declared constant
//"prefer-const": ["warn"],
// warn about `new Object()` usage for creation of generic objects
// the literal syntax is better
"no-new-object": ["warn"],
// warn about extended classes that define constructors that just call
// the superclass constructor without modifications
"no-useless-constructor": ["warn"],
// warn about `console.log()` usage
"no-console": ["warn"],
// warn about unused variables
"no-unused-vars": ["warn"],
// warn about require() statements that are not at the top-level of a
// module
"global-require": ["warn"],
// warn about using constructors from a require statement, as in:
// var foo = new require("bar");
"no-new-require": ["warn"],
// warn about concatonating __dirname and __filename with the + operator
// it's more clear to instead use path.join()
"no-path-concat": ["warn"],
// warn about using process.env since this can be abused to create
// reliance on global environment variables which may not reliable
"no-process-env": ["warn"],
// warn about arrow functions where they may be confused as comparison
"no-confusing-arrow": [
"warn",
{"allowParens": false, }
],
// warn about switch statements without default cases
"default-case": ["warn"],
},
};