@spscommerce/eslint-config-typescript 0.0.2 → 0.0.3
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/lib/index.js +11 -15
- package/lib/rules/bestPractices.js +487 -309
- package/lib/rules/es6.js +181 -110
- package/lib/rules/imports/helpfulWarnings.js +28 -14
- package/lib/rules/imports/moduleSystems.js +20 -10
- package/lib/rules/imports/staticAnalysis.js +56 -28
- package/lib/rules/imports/styleGuide.js +64 -32
- package/lib/rules/possibleErrors.js +231 -142
- package/lib/rules/strictMode.js +6 -3
- package/lib/rules/stylisticIssues.js +525 -327
- package/lib/rules/typescript.js +431 -250
- package/lib/rules/variables.js +74 -49
- package/package.json +10 -6
|
@@ -1,330 +1,508 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bestPractices = void 0;
|
|
4
|
+
// ✅ = recommended, 🔧 = fixable
|
|
4
5
|
exports.bestPractices = {
|
|
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
|
-
|
|
6
|
+
/**
|
|
7
|
+
* enforces getter/setter pairs in objects
|
|
8
|
+
* https://eslint.org/docs/rules/accessor-pairs
|
|
9
|
+
* Off because getters and setters are forbidden
|
|
10
|
+
*/
|
|
11
|
+
"accessor-pairs": "off",
|
|
12
|
+
/**
|
|
13
|
+
* enforces return statements in callbacks of array's methods
|
|
14
|
+
* https://eslint.org/docs/rules/array-callback-return
|
|
15
|
+
*/
|
|
16
|
+
"array-callback-return": ["error", { allowImplicit: true }],
|
|
17
|
+
/**
|
|
18
|
+
* treat var statements as if they were block scoped
|
|
19
|
+
* https://eslint.org/docs/rules/block-scoped-var
|
|
20
|
+
* Off because `var` is forbidden
|
|
21
|
+
*/
|
|
22
|
+
"block-scoped-var": "off",
|
|
23
|
+
/**
|
|
24
|
+
* specify the maximum cyclomatic complexity allowed in a program
|
|
25
|
+
* https://eslint.org/docs/rules/complexity
|
|
26
|
+
*/
|
|
27
|
+
complexity: "off",
|
|
28
|
+
/**
|
|
29
|
+
* enforce that class methods use "this"
|
|
30
|
+
* https://eslint.org/docs/rules/class-methods-use-this
|
|
31
|
+
*/
|
|
32
|
+
"class-methods-use-this": "error",
|
|
33
|
+
/**
|
|
34
|
+
* require return statements to either always or never specify values
|
|
35
|
+
* https://eslint.org/docs/rules/consistent-return
|
|
36
|
+
*/
|
|
37
|
+
"consistent-return": "off",
|
|
38
|
+
/**
|
|
39
|
+
* specify curly brace conventions for all control statements 🔧
|
|
40
|
+
* https://eslint.org/docs/rules/curly
|
|
41
|
+
*/
|
|
42
|
+
curly: ["error", "multi-line"],
|
|
43
|
+
/**
|
|
44
|
+
* require default case in switch statements
|
|
45
|
+
* https://eslint.org/docs/rules/default-case
|
|
46
|
+
*/
|
|
47
|
+
"default-case": ["error", { commentPattern: "^no default$" }],
|
|
48
|
+
/**
|
|
49
|
+
* Enforce default clauses in switch statements to be last
|
|
50
|
+
* https://eslint.org/docs/rules/default-case-last
|
|
51
|
+
*/
|
|
52
|
+
"default-case-last": "error",
|
|
53
|
+
/**
|
|
54
|
+
* enforce default parameters to be last
|
|
55
|
+
* https://eslint.org/docs/rules/default-param-last
|
|
56
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/default-param-last.md
|
|
57
|
+
*/
|
|
58
|
+
"default-param-last": "off",
|
|
59
|
+
"@typescript-eslint/default-param-last": "error",
|
|
60
|
+
/**
|
|
61
|
+
* enforces consistent newlines before or after dots
|
|
62
|
+
* https://eslint.org/docs/rules/dot-location
|
|
63
|
+
*/
|
|
64
|
+
"dot-location": ["error", "property"],
|
|
65
|
+
/**
|
|
66
|
+
* encourages use of dot notation whenever possible 🔧
|
|
67
|
+
* https://eslint.org/docs/rules/dot-notation
|
|
68
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
69
|
+
*/
|
|
70
|
+
"dot-notation": "off",
|
|
71
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
72
|
+
/**
|
|
73
|
+
* require the use of === and !== 🔧
|
|
74
|
+
* https://eslint.org/docs/rules/eqeqeq
|
|
75
|
+
*/
|
|
76
|
+
eqeqeq: "error",
|
|
77
|
+
/**
|
|
78
|
+
* Require grouped accessor pairs in object literals and classes
|
|
79
|
+
* https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
80
|
+
* Off because getters and setters are forbidden
|
|
81
|
+
*/
|
|
82
|
+
"grouped-accessor-pairs": "off",
|
|
83
|
+
/**
|
|
84
|
+
* make sure for-in loops have an if statement
|
|
85
|
+
* https://eslint.org/docs/rules/guard-for-in
|
|
86
|
+
* Off because for-in is forbidden
|
|
87
|
+
*/
|
|
88
|
+
"guard-for-in": "off",
|
|
89
|
+
/**
|
|
90
|
+
* enforce a maximum number of classes per file
|
|
91
|
+
* https://eslint.org/docs/rules/max-classes-per-file
|
|
92
|
+
*/
|
|
93
|
+
"max-classes-per-file": ["error", 1],
|
|
94
|
+
/**
|
|
95
|
+
* disallow the use of alert, confirm, and prompt
|
|
96
|
+
* https://eslint.org/docs/rules/no-alert
|
|
97
|
+
*/
|
|
98
|
+
"no-alert": "error",
|
|
99
|
+
/**
|
|
100
|
+
* disallow use of arguments.caller or arguments.callee
|
|
101
|
+
* https://eslint.org/docs/rules/no-caller
|
|
102
|
+
*/
|
|
103
|
+
"no-caller": "error",
|
|
104
|
+
/**
|
|
105
|
+
* disallow lexical declarations in case/default clauses ✅
|
|
106
|
+
* https://eslint.org/docs/rules/no-case-declarations
|
|
107
|
+
*/
|
|
108
|
+
"no-case-declarations": "error",
|
|
109
|
+
/**
|
|
110
|
+
* Disallow returning value in constructor
|
|
111
|
+
* https://eslint.org/docs/rules/no-constructor-return
|
|
112
|
+
*/
|
|
113
|
+
"no-constructor-return": "error",
|
|
114
|
+
/**
|
|
115
|
+
* disallow division operators explicitly at beginning of regular expression 🔧
|
|
116
|
+
* https://eslint.org/docs/rules/no-div-regex
|
|
117
|
+
*/
|
|
118
|
+
"no-div-regex": "off",
|
|
119
|
+
/**
|
|
120
|
+
* disallow else after a return in an if 🔧
|
|
121
|
+
* https://eslint.org/docs/rules/no-else-return
|
|
122
|
+
*/
|
|
123
|
+
"no-else-return": "off",
|
|
124
|
+
/**
|
|
125
|
+
* disallow empty functions
|
|
126
|
+
* https://eslint.org/docs/rules/no-empty-function
|
|
127
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
128
|
+
*/
|
|
129
|
+
"no-empty-function": "off",
|
|
130
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
131
|
+
/**
|
|
132
|
+
* disallow empty destructuring patterns ✅
|
|
133
|
+
* https://eslint.org/docs/rules/no-empty-pattern
|
|
134
|
+
*/
|
|
135
|
+
"no-empty-pattern": "error",
|
|
136
|
+
/**
|
|
137
|
+
* disallow comparisons to null without a type-checking operator
|
|
138
|
+
* https://eslint.org/docs/rules/no-eq-null
|
|
139
|
+
* Off because it's superceded by eqeqeq
|
|
140
|
+
*/
|
|
141
|
+
"no-eq-null": "off",
|
|
142
|
+
/**
|
|
143
|
+
* disallow use of eval()
|
|
144
|
+
* https://eslint.org/docs/rules/no-eval
|
|
145
|
+
*/
|
|
146
|
+
"no-eval": "error",
|
|
147
|
+
/**
|
|
148
|
+
* disallow adding to native types
|
|
149
|
+
* https://eslint.org/docs/rules/no-extend-native
|
|
150
|
+
*/
|
|
151
|
+
"no-extend-native": "error",
|
|
152
|
+
/**
|
|
153
|
+
* disallow unnecessary function binding 🔧
|
|
154
|
+
* https://eslint.org/docs/rules/no-extra-bind
|
|
155
|
+
*/
|
|
156
|
+
"no-extra-bind": "error",
|
|
157
|
+
/**
|
|
158
|
+
* disallow Unnecessary Labels 🔧
|
|
159
|
+
* https://eslint.org/docs/rules/no-extra-label
|
|
160
|
+
*/
|
|
161
|
+
"no-extra-label": "error",
|
|
162
|
+
/**
|
|
163
|
+
* disallow fallthrough of case statements ✅
|
|
164
|
+
* https://eslint.org/docs/rules/no-fallthrough
|
|
165
|
+
*/
|
|
166
|
+
"no-fallthrough": "error",
|
|
167
|
+
/**
|
|
168
|
+
* disallow the use of leading or trailing decimal points in numeric literals 🔧
|
|
169
|
+
* https://eslint.org/docs/rules/no-floating-decimal
|
|
170
|
+
*/
|
|
171
|
+
"no-floating-decimal": "error",
|
|
172
|
+
/**
|
|
173
|
+
* disallow reassignments of native objects or read-only globals ✅
|
|
174
|
+
* https://eslint.org/docs/rules/no-global-assign
|
|
175
|
+
*/
|
|
176
|
+
"no-global-assign": "error",
|
|
177
|
+
/**
|
|
178
|
+
* disallow implicit type conversions 🔧
|
|
179
|
+
* https://eslint.org/docs/rules/no-implicit-coercion
|
|
180
|
+
*/
|
|
181
|
+
"no-implicit-coercion": [
|
|
182
|
+
"error",
|
|
116
183
|
{
|
|
117
184
|
boolean: false,
|
|
118
185
|
number: true,
|
|
119
186
|
string: true,
|
|
120
187
|
},
|
|
121
188
|
],
|
|
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
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* disallow var and named functions in global scope
|
|
191
|
+
* https://eslint.org/docs/rules/no-implicit-globals
|
|
192
|
+
* disabled because it can't distinguish between a file with no imports and a browser script
|
|
193
|
+
*/
|
|
194
|
+
"no-implicit-globals": "off",
|
|
195
|
+
/**
|
|
196
|
+
* disallow use of eval()-like methods
|
|
197
|
+
* https://eslint.org/docs/rules/no-implied-eval
|
|
198
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
199
|
+
*/
|
|
200
|
+
"no-implied-eval": "off",
|
|
201
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
202
|
+
/**
|
|
203
|
+
* disallow this keywords outside of classes or class-like objects
|
|
204
|
+
* https://eslint.org/docs/rules/no-invalid-this
|
|
205
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-this.md
|
|
206
|
+
*/
|
|
207
|
+
"no-invalid-this": "off",
|
|
208
|
+
"@typescript-eslint/no-invalid-this": "off",
|
|
209
|
+
/**
|
|
210
|
+
* disallow usage of __iterator__ property
|
|
211
|
+
* https://eslint.org/docs/rules/no-iterator
|
|
212
|
+
*/
|
|
213
|
+
"no-iterator": "error",
|
|
214
|
+
/**
|
|
215
|
+
* disallow use of labels for anything other than loops and switches
|
|
216
|
+
* https://eslint.org/docs/rules/no-labels
|
|
217
|
+
*/
|
|
218
|
+
"no-labels": "error",
|
|
219
|
+
/**
|
|
220
|
+
* disallow unnecessary nested blocks
|
|
221
|
+
* https://eslint.org/docs/rules/no-lone-blocks
|
|
222
|
+
*/
|
|
223
|
+
"no-lone-blocks": "error",
|
|
224
|
+
/**
|
|
225
|
+
* disallow creation of functions within loops
|
|
226
|
+
* https://eslint.org/docs/rules/no-loop-func
|
|
227
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
228
|
+
*/
|
|
229
|
+
"no-loop-func": "off",
|
|
230
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
231
|
+
/**
|
|
232
|
+
* disallow magic numbers
|
|
233
|
+
* https://eslint.org/docs/rules/no-magic-numbers
|
|
234
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
235
|
+
*/
|
|
236
|
+
"no-magic-numbers": "off",
|
|
237
|
+
"@typescript-eslint/no-magic-numbers": [
|
|
238
|
+
"error",
|
|
239
|
+
{
|
|
240
|
+
ignore: [0,
|
|
241
|
+
1,
|
|
242
|
+
2],
|
|
243
|
+
ignoreArrayIndexes: true,
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
/**
|
|
247
|
+
* disallow use of multiple spaces 🔧
|
|
248
|
+
* https://eslint.org/docs/rules/no-multi-spaces
|
|
249
|
+
*/
|
|
250
|
+
"no-multi-spaces": "error",
|
|
251
|
+
/**
|
|
252
|
+
* disallow use of multiline strings
|
|
253
|
+
* https://eslint.org/docs/rules/no-multi-str
|
|
254
|
+
*/
|
|
255
|
+
"no-multi-str": "error",
|
|
256
|
+
/**
|
|
257
|
+
* disallow use of new operator when not part of the assignment or comparison
|
|
258
|
+
* https://eslint.org/docs/rules/no-new
|
|
259
|
+
*/
|
|
260
|
+
"no-new": "error",
|
|
261
|
+
/**
|
|
262
|
+
* disallow use of new operator for Function object
|
|
263
|
+
* https://eslint.org/docs/rules/no-new-func
|
|
264
|
+
*/
|
|
265
|
+
"no-new-func": "error",
|
|
266
|
+
/**
|
|
267
|
+
* disallows creating new instances of String, Number, and Boolean
|
|
268
|
+
* https://eslint.org/docs/rules/no-new-wrappers
|
|
269
|
+
*/
|
|
270
|
+
"no-new-wrappers": "error",
|
|
271
|
+
/**
|
|
272
|
+
* Disallow \8 and \9 escape sequences in string literals ✅
|
|
273
|
+
* https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
274
|
+
*/
|
|
275
|
+
"no-nonoctal-decimal-escape": "error",
|
|
276
|
+
/**
|
|
277
|
+
* disallow use of (old style) octal literals ✅
|
|
278
|
+
* https://eslint.org/docs/rules/no-octal
|
|
279
|
+
*/
|
|
280
|
+
"no-octal": "error",
|
|
281
|
+
/**
|
|
282
|
+
* disallow use of octal escape sequences in string literals, such as
|
|
283
|
+
* https://eslint.org/docs/rules/no-octal-escape
|
|
284
|
+
*/
|
|
285
|
+
"no-octal-escape": "error",
|
|
286
|
+
/**
|
|
287
|
+
* disallow reassignment of function parameters, and
|
|
180
288
|
* disallow parameter object manipulation except for specific exclusions
|
|
181
|
-
* rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
182
|
-
|
|
183
|
-
|
|
289
|
+
* rule: https://eslint.org/docs/rules/no-param-reassign.html
|
|
290
|
+
*/
|
|
291
|
+
"no-param-reassign": [
|
|
292
|
+
"error",
|
|
184
293
|
{
|
|
185
294
|
props: true,
|
|
186
295
|
ignorePropertyModificationsFor: [
|
|
187
|
-
|
|
188
|
-
'accumulator', // for reduce accumulators
|
|
296
|
+
"acc", "accumulator",
|
|
189
297
|
],
|
|
190
298
|
},
|
|
191
299
|
],
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
300
|
+
/**
|
|
301
|
+
* disallow usage of __proto__ property
|
|
302
|
+
* https://eslint.org/docs/rules/no-proto
|
|
303
|
+
*/
|
|
304
|
+
"no-proto": "error",
|
|
305
|
+
/**
|
|
306
|
+
* disallow declaring the same variable more than once ✅
|
|
307
|
+
* https://eslint.org/docs/rules/no-redeclare
|
|
308
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
309
|
+
*/
|
|
310
|
+
"no-redeclare": "off",
|
|
311
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
312
|
+
/**
|
|
313
|
+
* disallow certain object properties
|
|
314
|
+
* https://eslint.org/docs/rules/no-restricted-properties
|
|
315
|
+
*/
|
|
316
|
+
"no-restricted-properties": [
|
|
317
|
+
"error",
|
|
318
|
+
{
|
|
319
|
+
object: "arguments",
|
|
320
|
+
property: "callee",
|
|
321
|
+
message: "arguments.callee is deprecated",
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
object: "global",
|
|
325
|
+
property: "isFinite",
|
|
326
|
+
message: "Please use Number.isFinite instead",
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
object: "self",
|
|
330
|
+
property: "isFinite",
|
|
331
|
+
message: "Please use Number.isFinite instead",
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
object: "window",
|
|
335
|
+
property: "isFinite",
|
|
336
|
+
message: "Please use Number.isFinite instead",
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
object: "global",
|
|
340
|
+
property: "isNaN",
|
|
341
|
+
message: "Please use Number.isNaN instead",
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
object: "self",
|
|
345
|
+
property: "isNaN",
|
|
346
|
+
message: "Please use Number.isNaN instead",
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
object: "window",
|
|
350
|
+
property: "isNaN",
|
|
351
|
+
message: "Please use Number.isNaN instead",
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
property: "__defineGetter__",
|
|
355
|
+
message: "Please use Object.defineProperty instead.",
|
|
356
|
+
},
|
|
204
357
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
message: 'arguments.callee is deprecated',
|
|
208
|
-
}, {
|
|
209
|
-
object: 'global',
|
|
210
|
-
property: 'isFinite',
|
|
211
|
-
message: 'Please use Number.isFinite instead',
|
|
212
|
-
}, {
|
|
213
|
-
object: 'self',
|
|
214
|
-
property: 'isFinite',
|
|
215
|
-
message: 'Please use Number.isFinite instead',
|
|
216
|
-
}, {
|
|
217
|
-
object: 'window',
|
|
218
|
-
property: 'isFinite',
|
|
219
|
-
message: 'Please use Number.isFinite instead',
|
|
220
|
-
}, {
|
|
221
|
-
object: 'global',
|
|
222
|
-
property: 'isNaN',
|
|
223
|
-
message: 'Please use Number.isNaN instead',
|
|
224
|
-
}, {
|
|
225
|
-
object: 'self',
|
|
226
|
-
property: 'isNaN',
|
|
227
|
-
message: 'Please use Number.isNaN instead',
|
|
228
|
-
}, {
|
|
229
|
-
object: 'window',
|
|
230
|
-
property: 'isNaN',
|
|
231
|
-
message: 'Please use Number.isNaN instead',
|
|
232
|
-
}, {
|
|
233
|
-
property: '__defineGetter__',
|
|
234
|
-
message: 'Please use Object.defineProperty instead.',
|
|
235
|
-
}, {
|
|
236
|
-
property: '__defineSetter__',
|
|
237
|
-
message: 'Please use Object.defineProperty instead.',
|
|
358
|
+
property: "__defineSetter__",
|
|
359
|
+
message: "Please use Object.defineProperty instead.",
|
|
238
360
|
},
|
|
239
361
|
],
|
|
240
|
-
/**
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
362
|
+
/**
|
|
363
|
+
* disallow use of assignment in return statement
|
|
364
|
+
* https://eslint.org/docs/rules/no-return-assign
|
|
365
|
+
*/
|
|
366
|
+
"no-return-assign": "error",
|
|
367
|
+
/**
|
|
368
|
+
* disallow redundant `return await`
|
|
369
|
+
* https://eslint.org/docs/rules/no-return-await
|
|
370
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
|
|
371
|
+
*/
|
|
372
|
+
"no-return-await": "off",
|
|
373
|
+
"@typescript-eslint/return-await": "error",
|
|
374
|
+
/**
|
|
375
|
+
* disallow use of `javascript:` urls.
|
|
376
|
+
* https://eslint.org/docs/rules/no-script-url
|
|
377
|
+
*/
|
|
378
|
+
"no-script-url": "error",
|
|
379
|
+
/**
|
|
380
|
+
* disallow self assignment ✅
|
|
381
|
+
* https://eslint.org/docs/rules/no-self-assign
|
|
382
|
+
*/
|
|
383
|
+
"no-self-assign": "error",
|
|
384
|
+
/**
|
|
385
|
+
* disallow comparisons where both sides are exactly the same
|
|
386
|
+
* https://eslint.org/docs/rules/no-self-compare
|
|
387
|
+
*/
|
|
388
|
+
"no-self-compare": "error",
|
|
389
|
+
/**
|
|
390
|
+
* disallow use of comma operator
|
|
391
|
+
* https://eslint.org/docs/rules/no-sequences
|
|
392
|
+
*/
|
|
393
|
+
"no-sequences": "error",
|
|
394
|
+
/**
|
|
395
|
+
* restrict what can be thrown as an exception
|
|
396
|
+
* https://eslint.org/docs/rules/no-throw-literal
|
|
397
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
398
|
+
*/
|
|
399
|
+
"no-throw-literal": "off",
|
|
400
|
+
"@typescript-eslint/no-throw-literal": "error",
|
|
401
|
+
/**
|
|
402
|
+
* disallow unmodified conditions of loops
|
|
403
|
+
* https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
404
|
+
*/
|
|
405
|
+
"no-unmodified-loop-condition": "off",
|
|
406
|
+
/**
|
|
407
|
+
* disallow usage of expressions in statement position
|
|
408
|
+
* https://eslint.org/docs/rules/no-unused-expressions
|
|
409
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
410
|
+
*/
|
|
411
|
+
"no-unused-expressions": "off",
|
|
412
|
+
"@typescript-eslint/no-unused-expressions": ["error", { allowTaggedTemplates: false }],
|
|
413
|
+
/**
|
|
414
|
+
* disallow unused labels ✅ 🔧
|
|
415
|
+
* https://eslint.org/docs/rules/no-unused-labels
|
|
416
|
+
*/
|
|
417
|
+
"no-unused-labels": "error",
|
|
418
|
+
/**
|
|
419
|
+
* disallow unnecessary .call() and .apply()
|
|
420
|
+
* https://eslint.org/docs/rules/no-useless-call
|
|
421
|
+
*/
|
|
422
|
+
"no-useless-call": "off",
|
|
423
|
+
/**
|
|
424
|
+
* Disallow unnecessary catch clauses ✅
|
|
425
|
+
* https://eslint.org/docs/rules/no-useless-catch
|
|
426
|
+
*/
|
|
427
|
+
"no-useless-catch": "error",
|
|
428
|
+
/**
|
|
429
|
+
* disallow useless string concatenation
|
|
430
|
+
* https://eslint.org/docs/rules/no-useless-concat
|
|
431
|
+
*/
|
|
432
|
+
"no-useless-concat": "error",
|
|
433
|
+
/**
|
|
434
|
+
* disallow unnecessary string escaping ✅
|
|
435
|
+
* https://eslint.org/docs/rules/no-useless-escape
|
|
436
|
+
*/
|
|
437
|
+
"no-useless-escape": "error",
|
|
438
|
+
/**
|
|
439
|
+
* disallow redundant return; keywords 🔧
|
|
440
|
+
* https://eslint.org/docs/rules/no-useless-return
|
|
441
|
+
*/
|
|
442
|
+
"no-useless-return": "error",
|
|
443
|
+
/**
|
|
444
|
+
* disallow use of void operator
|
|
445
|
+
* https://eslint.org/docs/rules/no-void
|
|
446
|
+
*/
|
|
447
|
+
"no-void": "error",
|
|
448
|
+
/**
|
|
449
|
+
* disallow usage of configurable warning terms in comments: e.g. todo
|
|
450
|
+
* https://eslint.org/docs/rules/no-warning-comments
|
|
451
|
+
*/
|
|
452
|
+
"no-warning-comments": "off",
|
|
453
|
+
/**
|
|
454
|
+
* disallow use of the with statement ✅
|
|
455
|
+
* https://eslint.org/docs/rules/no-with
|
|
456
|
+
*/
|
|
457
|
+
"no-with": "error",
|
|
458
|
+
/**
|
|
459
|
+
* require using Error objects as Promise rejection reasons
|
|
460
|
+
* https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
461
|
+
*/
|
|
462
|
+
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
463
|
+
/**
|
|
464
|
+
* Suggest using named capture group in regular expression
|
|
465
|
+
* https://eslint.org/docs/rules/prefer-named-capture-group
|
|
466
|
+
*/
|
|
467
|
+
"prefer-named-capture-group": "off",
|
|
468
|
+
/**
|
|
469
|
+
* disallow use of the `RegExp` constructor in favor of regular expression literals
|
|
470
|
+
* https://eslint.org/docs/rules/prefer-regex-literals
|
|
471
|
+
*/
|
|
472
|
+
"prefer-regex-literals": "error",
|
|
473
|
+
/**
|
|
474
|
+
* require use of the second argument for parseInt()
|
|
475
|
+
* https://eslint.org/docs/rules/radix
|
|
476
|
+
*/
|
|
477
|
+
radix: "error",
|
|
478
|
+
/**
|
|
479
|
+
* require `await` in `async function` (note: this is a horrible rule that should never be used)
|
|
480
|
+
* https://eslint.org/docs/rules/require-await
|
|
481
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
482
|
+
*/
|
|
483
|
+
"require-await": "off",
|
|
484
|
+
"@typescript-eslint/require-await": "off",
|
|
485
|
+
/**
|
|
486
|
+
* Enforce the use of u flag on RegExp
|
|
487
|
+
* https://eslint.org/docs/rules/require-unicode-regexp
|
|
488
|
+
*/
|
|
489
|
+
"require-unicode-regexp": "off",
|
|
490
|
+
/**
|
|
491
|
+
* requires to declare all vars on top of their containing scope
|
|
492
|
+
* https://eslint.org/docs/rules/vars-on-top
|
|
493
|
+
* Off because var is forbidden
|
|
494
|
+
*/
|
|
495
|
+
"vars-on-top": "off",
|
|
496
|
+
/**
|
|
497
|
+
* require immediate function invocation to be wrapped in parentheses
|
|
498
|
+
* https://eslint.org/docs/rules/wrap-iife.html
|
|
499
|
+
*/
|
|
500
|
+
"wrap-iife": ["error",
|
|
501
|
+
"outside",
|
|
502
|
+
{ functionPrototypeMethods: false }],
|
|
503
|
+
/**
|
|
504
|
+
* require or disallow Yoda conditions 🔧
|
|
505
|
+
* https://eslint.org/docs/rules/yoda
|
|
506
|
+
*/
|
|
507
|
+
yoda: "error",
|
|
330
508
|
};
|