@pob/eslint-config 55.3.0 → 56.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/_base.js +9 -9
- package/lib/base/commonjs.js +3 -3
- package/lib/base/module.js +3 -3
- package/lib/index.js +8 -8
- package/lib/node/_base.js +24 -24
- package/lib/node/commonjs.js +7 -7
- package/lib/node/module.js +13 -13
- package/lib/node-commonjs.js +11 -11
- package/lib/node-module.js +11 -11
- package/lib/plugins/import/import-base.js +38 -38
- package/lib/plugins/import/import-commonjs.js +2 -2
- package/lib/plugins/import/import-module.js +2 -2
- package/lib/plugins/unicorn.js +115 -115
- package/lib/root-commonjs.js +3 -3
- package/lib/root-module.js +3 -3
- package/lib/rules/best-practices.js +174 -174
- package/lib/rules/code-quality.js +3 -3
- package/lib/rules/dev-only.js +4 -4
- package/lib/rules/errors.js +41 -41
- package/lib/rules/modules/base.js +2 -2
- package/lib/rules/modules/commonjs.js +3 -3
- package/lib/rules/modules/esm.js +5 -5
- package/lib/rules/style.js +8 -8
- package/package.json +1 -1
- package/utils.js +3 -3
|
@@ -1,241 +1,241 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
const confusingBrowserGlobals = require(
|
|
3
|
+
const confusingBrowserGlobals = require("confusing-browser-globals");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
rules: {
|
|
7
7
|
// https://eslint.org/docs/rules/accessor-pairs
|
|
8
|
-
|
|
8
|
+
"accessor-pairs": "off",
|
|
9
9
|
|
|
10
10
|
// https://eslint.org/docs/rules/array-callback-return
|
|
11
|
-
|
|
11
|
+
"array-callback-return": "error",
|
|
12
12
|
|
|
13
13
|
// https://eslint.org/docs/rules/block-scoped-var
|
|
14
|
-
|
|
14
|
+
"block-scoped-var": "error",
|
|
15
15
|
|
|
16
16
|
// http://eslint.org/docs/rules/class-methods-use-this
|
|
17
|
-
|
|
17
|
+
"class-methods-use-this": "off",
|
|
18
18
|
|
|
19
19
|
// https://eslint.org/docs/rules/constructor-super
|
|
20
|
-
|
|
20
|
+
"constructor-super": "error",
|
|
21
21
|
|
|
22
22
|
// http://eslint.org/docs/rules/consistent-return
|
|
23
|
-
|
|
23
|
+
"consistent-return": "off",
|
|
24
24
|
|
|
25
25
|
// http://eslint.org/docs/rules/default-case
|
|
26
|
-
|
|
26
|
+
"default-case": ["error", { commentPattern: "^no default$" }],
|
|
27
27
|
|
|
28
28
|
// http://eslint.org/docs/rules/default-case-last
|
|
29
|
-
|
|
29
|
+
"default-case-last": "error",
|
|
30
30
|
|
|
31
31
|
// https://eslint.org/docs/rules/default-param-last
|
|
32
|
-
|
|
32
|
+
"default-param-last": "error",
|
|
33
33
|
|
|
34
34
|
// https://eslint.org/docs/rules/dot-notation
|
|
35
|
-
|
|
35
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
36
36
|
|
|
37
37
|
// https://eslint.org/docs/rules/eqeqeq
|
|
38
|
-
eqeqeq: [
|
|
38
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
39
39
|
|
|
40
40
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
41
|
-
|
|
41
|
+
"grouped-accessor-pairs": "error",
|
|
42
42
|
|
|
43
43
|
// https://eslint.org/docs/rules/guard-for-in
|
|
44
|
-
|
|
44
|
+
"guard-for-in": "error",
|
|
45
45
|
|
|
46
46
|
// https://eslint.org/docs/rules/max-classes-per-file
|
|
47
|
-
|
|
47
|
+
"max-classes-per-file": "off",
|
|
48
48
|
|
|
49
49
|
// https://eslint.org/docs/rules/max-params
|
|
50
|
-
|
|
50
|
+
"max-params": "warn",
|
|
51
51
|
|
|
52
52
|
// require a capital letter for constructors
|
|
53
53
|
// https://eslint.org/docs/rules/new-cap
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
"new-cap": [
|
|
55
|
+
"error",
|
|
56
56
|
{
|
|
57
57
|
newIsCap: true,
|
|
58
58
|
newIsCapExceptions: [],
|
|
59
59
|
capIsNew: false,
|
|
60
60
|
capIsNewExceptions: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
"Immutable.Map",
|
|
62
|
+
"Immutable.Set",
|
|
63
|
+
"Immutable.List",
|
|
64
64
|
],
|
|
65
65
|
},
|
|
66
66
|
],
|
|
67
67
|
|
|
68
68
|
// TODO: enable
|
|
69
69
|
// https://eslint.org/docs/rules/no-alert
|
|
70
|
-
|
|
70
|
+
"no-alert": "warn",
|
|
71
71
|
|
|
72
72
|
// https://eslint.org/docs/rules/no-array-constructor
|
|
73
|
-
|
|
73
|
+
"no-array-constructor": "error",
|
|
74
74
|
|
|
75
75
|
// https://eslint.org/docs/rules/no-buffer-constructor
|
|
76
|
-
|
|
76
|
+
"no-buffer-constructor": "error",
|
|
77
77
|
|
|
78
78
|
// https://eslint.org/docs/rules/no-bitwise
|
|
79
|
-
|
|
79
|
+
"no-bitwise": "error",
|
|
80
80
|
|
|
81
81
|
// https://eslint.org/docs/rules/no-caller
|
|
82
|
-
|
|
82
|
+
"no-caller": "error",
|
|
83
83
|
|
|
84
84
|
// https://eslint.org/docs/rules/no-case-declarations
|
|
85
|
-
|
|
85
|
+
"no-case-declarations": "error",
|
|
86
86
|
|
|
87
87
|
// https://eslint.org/docs/rules/no-constructor-return
|
|
88
|
-
|
|
88
|
+
"no-constructor-return": "error",
|
|
89
89
|
|
|
90
90
|
// https://eslint.org/docs/rules/no-continue
|
|
91
|
-
|
|
91
|
+
"no-continue": "off",
|
|
92
92
|
|
|
93
93
|
// https://eslint.org/docs/rules/no-class-assign
|
|
94
|
-
|
|
94
|
+
"no-class-assign": "error",
|
|
95
95
|
|
|
96
96
|
// https://eslint.org/docs/rules/no-const-assign
|
|
97
|
-
|
|
97
|
+
"no-const-assign": "error",
|
|
98
98
|
|
|
99
99
|
// https://eslint.org/docs/rules/no-dupe-class-members
|
|
100
|
-
|
|
100
|
+
"no-dupe-class-members": "error",
|
|
101
101
|
|
|
102
102
|
// https://eslint.org/docs/rules/no-empty-function
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
"no-empty-function": [
|
|
104
|
+
"error",
|
|
105
105
|
{
|
|
106
|
-
allow: [
|
|
106
|
+
allow: ["arrowFunctions", "functions", "methods"],
|
|
107
107
|
},
|
|
108
108
|
],
|
|
109
109
|
|
|
110
110
|
// https://eslint.org/docs/rules/no-empty-pattern
|
|
111
|
-
|
|
111
|
+
"no-empty-pattern": "error",
|
|
112
112
|
|
|
113
113
|
// https://eslint.org/docs/latest/rules/no-empty-static-block
|
|
114
|
-
|
|
114
|
+
"no-empty-static-block": "error",
|
|
115
115
|
|
|
116
116
|
// https://eslint.org/docs/rules/no-eq-null
|
|
117
|
-
|
|
117
|
+
"no-eq-null": "off",
|
|
118
118
|
|
|
119
119
|
// https://eslint.org/docs/rules/no-eval
|
|
120
|
-
|
|
120
|
+
"no-eval": "error",
|
|
121
121
|
|
|
122
122
|
// https://eslint.org/docs/rules/no-extend-native
|
|
123
|
-
|
|
123
|
+
"no-extend-native": "error",
|
|
124
124
|
|
|
125
125
|
// https://eslint.org/docs/rules/no-extra-bind
|
|
126
|
-
|
|
126
|
+
"no-extra-bind": "error",
|
|
127
127
|
|
|
128
128
|
// https://eslint.org/docs/rules/no-extra-label
|
|
129
|
-
|
|
129
|
+
"no-extra-label": "error",
|
|
130
130
|
|
|
131
131
|
// https://eslint.org/docs/rules/no-fallthrough
|
|
132
|
-
|
|
132
|
+
"no-fallthrough": "error",
|
|
133
133
|
|
|
134
134
|
// https://eslint.org/docs/rules/no-floating-decimal
|
|
135
|
-
|
|
135
|
+
"no-floating-decimal": "error",
|
|
136
136
|
|
|
137
137
|
// https://eslint.org/docs/rules/no-global-assign
|
|
138
|
-
|
|
138
|
+
"no-global-assign": "error",
|
|
139
139
|
|
|
140
140
|
// https://eslint.org/docs/rules/no-implicit-globals
|
|
141
141
|
// TODO to enable
|
|
142
|
-
|
|
142
|
+
"no-implicit-globals": "warn",
|
|
143
143
|
|
|
144
144
|
// https://eslint.org/docs/rules/no-implied-eval
|
|
145
|
-
|
|
145
|
+
"no-implied-eval": "error",
|
|
146
146
|
|
|
147
147
|
// https://eslint.org/docs/rules/no-labels
|
|
148
|
-
|
|
148
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
149
149
|
|
|
150
150
|
// https://eslint.org/docs/rules/no-label-var
|
|
151
|
-
|
|
151
|
+
"no-label-var": "error",
|
|
152
152
|
|
|
153
153
|
// https://eslint.org/docs/rules/no-lone-blocks
|
|
154
|
-
|
|
154
|
+
"no-lone-blocks": "error",
|
|
155
155
|
|
|
156
156
|
// https://eslint.org/docs/rules/no-lonely-if
|
|
157
|
-
|
|
157
|
+
"no-lonely-if": "error",
|
|
158
158
|
|
|
159
159
|
// https://eslint.org/docs/rules/no-loop-func
|
|
160
|
-
|
|
160
|
+
"no-loop-func": "error",
|
|
161
161
|
|
|
162
162
|
// https://eslint.org/docs/rules/no-mixed-operators
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
"no-mixed-operators": [
|
|
164
|
+
"error",
|
|
165
165
|
{
|
|
166
166
|
// the list of arithmetic groups disallows mixing `%` and `**`
|
|
167
167
|
// with other arithmetic operators.
|
|
168
168
|
groups: [
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
169
|
+
["%", "**"],
|
|
170
|
+
["%", "+"],
|
|
171
|
+
["%", "-"],
|
|
172
|
+
["%", "*"],
|
|
173
|
+
["%", "/"],
|
|
174
|
+
["/", "*"],
|
|
175
|
+
["&", "|", "<<", ">>", ">>>"],
|
|
176
|
+
["==", "!=", "===", "!=="],
|
|
177
|
+
["&&", "||"],
|
|
178
178
|
],
|
|
179
179
|
allowSamePrecedence: false,
|
|
180
180
|
},
|
|
181
181
|
],
|
|
182
182
|
|
|
183
183
|
// https://eslint.org/docs/rules/no-multi-assign
|
|
184
|
-
|
|
184
|
+
"no-multi-assign": "error",
|
|
185
185
|
|
|
186
186
|
// https://eslint.org/docs/rules/no-multi-str
|
|
187
|
-
|
|
187
|
+
"no-multi-str": "error",
|
|
188
188
|
|
|
189
189
|
// https://eslint.org/docs/rules/no-nested-ternary
|
|
190
|
-
|
|
190
|
+
"no-nested-ternary": "error",
|
|
191
191
|
|
|
192
192
|
// https://eslint.org/docs/rules/no-new
|
|
193
|
-
|
|
193
|
+
"no-new": "error",
|
|
194
194
|
|
|
195
195
|
// https://eslint.org/docs/rules/no-new-func
|
|
196
|
-
|
|
196
|
+
"no-new-func": "error",
|
|
197
197
|
|
|
198
198
|
// https://eslint.org/docs/rules/no-new-object
|
|
199
|
-
|
|
199
|
+
"no-new-object": "error",
|
|
200
200
|
|
|
201
201
|
// https://eslint.org/docs/rules/no-new-wrappers
|
|
202
|
-
|
|
202
|
+
"no-new-wrappers": "error",
|
|
203
203
|
|
|
204
204
|
// https://eslint.org/docs/rules/no-new-native-nonconstructor
|
|
205
|
-
|
|
205
|
+
"no-new-native-nonconstructor": "error",
|
|
206
206
|
|
|
207
207
|
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
208
|
-
|
|
208
|
+
"no-nonoctal-decimal-escape": "error",
|
|
209
209
|
|
|
210
210
|
// https://eslint.org/docs/rules/no-octal
|
|
211
|
-
|
|
211
|
+
"no-octal": "error",
|
|
212
212
|
|
|
213
213
|
// https://eslint.org/docs/rules/no-octal-escape
|
|
214
|
-
|
|
214
|
+
"no-octal-escape": "error",
|
|
215
215
|
|
|
216
216
|
// rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
217
|
-
|
|
217
|
+
"no-param-reassign": "off",
|
|
218
218
|
|
|
219
219
|
// https://eslint.org/docs/rules/no-plusplus
|
|
220
|
-
|
|
220
|
+
"no-plusplus": "off",
|
|
221
221
|
|
|
222
222
|
// https://eslint.org/docs/rules/no-proto
|
|
223
|
-
|
|
223
|
+
"no-proto": "error",
|
|
224
224
|
|
|
225
225
|
// https://eslint.org/docs/rules/no-redeclare
|
|
226
|
-
|
|
226
|
+
"no-redeclare": "error",
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
"no-restricted-globals": [
|
|
229
|
+
"error",
|
|
230
230
|
{
|
|
231
|
-
name:
|
|
231
|
+
name: "isFinite",
|
|
232
232
|
message:
|
|
233
|
-
|
|
233
|
+
"Use Number.isFinite instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite",
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
|
-
name:
|
|
236
|
+
name: "isNaN",
|
|
237
237
|
message:
|
|
238
|
-
|
|
238
|
+
"Use Number.isNaN instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN",
|
|
239
239
|
},
|
|
240
240
|
...confusingBrowserGlobals.map((g) => ({
|
|
241
241
|
name: g,
|
|
@@ -244,92 +244,92 @@ module.exports = {
|
|
|
244
244
|
],
|
|
245
245
|
|
|
246
246
|
// https://eslint.org/docs/rules/no-restricted-properties
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
"no-restricted-properties": [
|
|
248
|
+
"error",
|
|
249
249
|
{
|
|
250
|
-
object:
|
|
251
|
-
property:
|
|
252
|
-
message:
|
|
250
|
+
object: "global",
|
|
251
|
+
property: "isFinite",
|
|
252
|
+
message: "Use Number.isFinite instead",
|
|
253
253
|
},
|
|
254
254
|
{
|
|
255
|
-
object:
|
|
256
|
-
property:
|
|
257
|
-
message:
|
|
255
|
+
object: "self",
|
|
256
|
+
property: "isFinite",
|
|
257
|
+
message: "Use Number.isFinite instead",
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
|
-
object:
|
|
261
|
-
property:
|
|
262
|
-
message:
|
|
260
|
+
object: "window",
|
|
261
|
+
property: "isFinite",
|
|
262
|
+
message: "Use Number.isFinite instead",
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
|
-
object:
|
|
266
|
-
property:
|
|
267
|
-
message:
|
|
265
|
+
object: "global",
|
|
266
|
+
property: "isNaN",
|
|
267
|
+
message: "Use Number.isNaN instead",
|
|
268
268
|
},
|
|
269
269
|
{
|
|
270
|
-
object:
|
|
271
|
-
property:
|
|
272
|
-
message:
|
|
270
|
+
object: "self",
|
|
271
|
+
property: "isNaN",
|
|
272
|
+
message: "Use Number.isNaN instead",
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
|
-
object:
|
|
276
|
-
property:
|
|
277
|
-
message:
|
|
275
|
+
object: "window",
|
|
276
|
+
property: "isNaN",
|
|
277
|
+
message: "Use Number.isNaN instead",
|
|
278
278
|
},
|
|
279
279
|
{
|
|
280
|
-
property:
|
|
281
|
-
message:
|
|
280
|
+
property: "__defineGetter__",
|
|
281
|
+
message: "Use Object.defineProperty instead.",
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
|
-
property:
|
|
285
|
-
message:
|
|
284
|
+
property: "__defineSetter__",
|
|
285
|
+
message: "Use Object.defineProperty instead.",
|
|
286
286
|
},
|
|
287
287
|
],
|
|
288
288
|
|
|
289
289
|
// https://eslint.org/docs/rules/no-return-assign
|
|
290
|
-
|
|
290
|
+
"no-return-assign": ["error", "always"],
|
|
291
291
|
|
|
292
292
|
// https://eslint.org/docs/rules/no-return-await
|
|
293
|
-
|
|
293
|
+
"no-return-await": "error",
|
|
294
294
|
|
|
295
295
|
// https://eslint.org/docs/rules/no-script-url
|
|
296
|
-
|
|
296
|
+
"no-script-url": "error",
|
|
297
297
|
|
|
298
298
|
// https://eslint.org/docs/rules/no-self-assign
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
"no-self-assign": [
|
|
300
|
+
"error",
|
|
301
301
|
{
|
|
302
302
|
props: true,
|
|
303
303
|
},
|
|
304
304
|
],
|
|
305
305
|
|
|
306
306
|
// https://eslint.org/docs/rules/no-self-compare
|
|
307
|
-
|
|
307
|
+
"no-self-compare": "error",
|
|
308
308
|
|
|
309
309
|
// https://eslint.org/docs/rules/no-sequences
|
|
310
|
-
|
|
310
|
+
"no-sequences": "error",
|
|
311
311
|
|
|
312
312
|
// disallow shadowing of names such as arguments
|
|
313
|
-
|
|
313
|
+
"no-shadow-restricted-names": "error",
|
|
314
314
|
|
|
315
315
|
// https://eslint.org/docs/rules/no-this-before-super
|
|
316
|
-
|
|
316
|
+
"no-this-before-super": "error",
|
|
317
317
|
|
|
318
318
|
// https://eslint.org/docs/rules/no-throw-literal
|
|
319
|
-
|
|
319
|
+
"no-throw-literal": "error",
|
|
320
320
|
|
|
321
321
|
// https://eslint.org/docs/rules/no-undef
|
|
322
|
-
|
|
322
|
+
"no-undef": "error",
|
|
323
323
|
|
|
324
324
|
// https://eslint.org/docs/rules/no-undef-init
|
|
325
|
-
|
|
325
|
+
"no-undef-init": "error",
|
|
326
326
|
|
|
327
327
|
// https://eslint.org/docs/rules/no-unneeded-ternary
|
|
328
|
-
|
|
328
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
329
329
|
|
|
330
330
|
// https://eslint.org/docs/rules/no-unused-expressions
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
"no-unused-expressions": [
|
|
332
|
+
"error",
|
|
333
333
|
{
|
|
334
334
|
allowShortCircuit: false,
|
|
335
335
|
allowTernary: false,
|
|
@@ -338,38 +338,38 @@ module.exports = {
|
|
|
338
338
|
],
|
|
339
339
|
|
|
340
340
|
// https://eslint.org/docs/rules/no-unused-labels
|
|
341
|
-
|
|
341
|
+
"no-unused-labels": "error",
|
|
342
342
|
|
|
343
343
|
// https://eslint.org/docs/rules/no-unused-vars
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
{ vars:
|
|
344
|
+
"no-unused-vars": [
|
|
345
|
+
"error",
|
|
346
|
+
{ vars: "all", args: "none", ignoreRestSiblings: true },
|
|
347
347
|
],
|
|
348
348
|
|
|
349
349
|
// https://eslint.org/docs/rules/no-use-before-define
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
"no-use-before-define": [
|
|
351
|
+
"error",
|
|
352
352
|
{ functions: true, classes: true, variables: true },
|
|
353
353
|
],
|
|
354
354
|
|
|
355
355
|
// https://eslint.org/docs/rules/no-useless-catch
|
|
356
|
-
|
|
356
|
+
"no-useless-catch": "error",
|
|
357
357
|
|
|
358
358
|
// https://eslint.org/docs/rules/no-useless-concat
|
|
359
|
-
|
|
359
|
+
"no-useless-concat": "error",
|
|
360
360
|
|
|
361
361
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
362
|
-
|
|
362
|
+
"no-useless-computed-key": "error",
|
|
363
363
|
|
|
364
364
|
// https://eslint.org/docs/rules/no-useless-constructor
|
|
365
|
-
|
|
365
|
+
"no-useless-constructor": "error",
|
|
366
366
|
|
|
367
367
|
// https://eslint.org/docs/rules/no-useless-escape
|
|
368
|
-
|
|
368
|
+
"no-useless-escape": "error",
|
|
369
369
|
|
|
370
370
|
// https://eslint.org/docs/rules/no-useless-rename
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
"no-useless-rename": [
|
|
372
|
+
"error",
|
|
373
373
|
{
|
|
374
374
|
ignoreDestructuring: false,
|
|
375
375
|
ignoreImport: false,
|
|
@@ -378,21 +378,21 @@ module.exports = {
|
|
|
378
378
|
],
|
|
379
379
|
|
|
380
380
|
// https://eslint.org/docs/rules/no-useless-return
|
|
381
|
-
|
|
381
|
+
"no-useless-return": "error",
|
|
382
382
|
|
|
383
383
|
// https://eslint.org/docs/rules/no-var
|
|
384
|
-
|
|
384
|
+
"no-var": "error",
|
|
385
385
|
|
|
386
386
|
// https://eslint.org/docs/rules/no-void
|
|
387
|
-
|
|
387
|
+
"no-void": "error",
|
|
388
388
|
|
|
389
389
|
// https://eslint.org/docs/rules/no-with
|
|
390
|
-
|
|
390
|
+
"no-with": "error",
|
|
391
391
|
|
|
392
392
|
// https://eslint.org/docs/rules/object-shorthand
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
"object-shorthand": [
|
|
394
|
+
"error",
|
|
395
|
+
"always",
|
|
396
396
|
{
|
|
397
397
|
ignoreConstructors: false,
|
|
398
398
|
avoidQuotes: true,
|
|
@@ -400,8 +400,8 @@ module.exports = {
|
|
|
400
400
|
],
|
|
401
401
|
|
|
402
402
|
// https://eslint.org/docs/rules/prefer-arrow-callback
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
"prefer-arrow-callback": [
|
|
404
|
+
"error",
|
|
405
405
|
{
|
|
406
406
|
allowNamedFunctions: false,
|
|
407
407
|
allowUnboundThis: true,
|
|
@@ -409,74 +409,74 @@ module.exports = {
|
|
|
409
409
|
],
|
|
410
410
|
|
|
411
411
|
// https://eslint.org/docs/rules/prefer-const
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
"prefer-const": [
|
|
413
|
+
"error",
|
|
414
414
|
{
|
|
415
|
-
destructuring:
|
|
415
|
+
destructuring: "any",
|
|
416
416
|
ignoreReadBeforeAssign: true,
|
|
417
417
|
},
|
|
418
418
|
],
|
|
419
419
|
|
|
420
420
|
// https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
421
|
-
|
|
421
|
+
"prefer-exponentiation-operator": "error",
|
|
422
422
|
|
|
423
423
|
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
424
|
-
|
|
424
|
+
"prefer-numeric-literals": "error",
|
|
425
425
|
|
|
426
426
|
// https://eslint.org/docs/rules/prefer-object-has-own
|
|
427
|
-
|
|
427
|
+
"prefer-object-has-own": "error",
|
|
428
428
|
|
|
429
429
|
// https://eslint.org/docs/rules/prefer-object-spread
|
|
430
|
-
|
|
430
|
+
"prefer-object-spread": "error",
|
|
431
431
|
|
|
432
432
|
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
433
|
-
|
|
433
|
+
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
434
434
|
|
|
435
435
|
// https://eslint.org/docs/rules/prefer-regex-literals
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
"prefer-regex-literals": [
|
|
437
|
+
"error",
|
|
438
438
|
{
|
|
439
439
|
disallowRedundantWrapping: true,
|
|
440
440
|
},
|
|
441
441
|
],
|
|
442
442
|
|
|
443
443
|
// https://eslint.org/docs/rules/prefer-rest-params
|
|
444
|
-
|
|
444
|
+
"prefer-rest-params": "error",
|
|
445
445
|
|
|
446
446
|
// https://eslint.org/docs/rules/prefer-spread
|
|
447
|
-
|
|
447
|
+
"prefer-spread": "error",
|
|
448
448
|
|
|
449
449
|
// https://eslint.org/docs/rules/prefer-template
|
|
450
|
-
|
|
450
|
+
"prefer-template": "error",
|
|
451
451
|
|
|
452
452
|
// https://eslint.org/docs/rules/radix
|
|
453
|
-
radix:
|
|
453
|
+
radix: "error",
|
|
454
454
|
|
|
455
455
|
// https://eslint.org/docs/rules/require-await
|
|
456
|
-
|
|
456
|
+
"require-await": "error",
|
|
457
457
|
|
|
458
458
|
// https://eslint.org/docs/rules/require-yield
|
|
459
|
-
|
|
459
|
+
"require-yield": "error",
|
|
460
460
|
|
|
461
461
|
// https://eslint.org/docs/rules/symbol-description
|
|
462
|
-
|
|
462
|
+
"symbol-description": "error",
|
|
463
463
|
|
|
464
464
|
// https://eslint.org/docs/rules/template-curly-spacing
|
|
465
|
-
|
|
465
|
+
"template-curly-spacing": "error",
|
|
466
466
|
|
|
467
467
|
// https://eslint.org/docs/rules/unicode-bom
|
|
468
|
-
|
|
468
|
+
"unicode-bom": ["error", "never"],
|
|
469
469
|
|
|
470
470
|
// https://eslint.org/docs/rules/yoda
|
|
471
|
-
yoda:
|
|
471
|
+
yoda: "error",
|
|
472
472
|
|
|
473
473
|
// Allow for-of, now supported by node 6 and modern browsers
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
"no-restricted-syntax": [
|
|
475
|
+
"error",
|
|
476
476
|
{
|
|
477
|
-
selector:
|
|
477
|
+
selector: "ForInStatement",
|
|
478
478
|
message:
|
|
479
|
-
|
|
479
|
+
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
480
480
|
},
|
|
481
481
|
// => allow 'ForOfStatement',
|
|
482
482
|
// {
|
|
@@ -484,14 +484,14 @@ module.exports = {
|
|
|
484
484
|
// message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
|
|
485
485
|
// },
|
|
486
486
|
{
|
|
487
|
-
selector:
|
|
487
|
+
selector: "LabeledStatement",
|
|
488
488
|
message:
|
|
489
|
-
|
|
489
|
+
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
490
490
|
},
|
|
491
491
|
{
|
|
492
|
-
selector:
|
|
492
|
+
selector: "WithStatement",
|
|
493
493
|
message:
|
|
494
|
-
|
|
494
|
+
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
495
495
|
},
|
|
496
496
|
],
|
|
497
497
|
},
|