@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,125 +1,196 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stylisticIssues = void 0;
|
|
4
|
+
// ✅ = recommended, 🔧 = fixable
|
|
4
5
|
exports.stylisticIssues = {
|
|
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
|
-
|
|
6
|
+
/**
|
|
7
|
+
* enforce line breaks after opening and before closing array brackets 🔧
|
|
8
|
+
* https://eslint.org/docs/rules/array-bracket-newline
|
|
9
|
+
*/
|
|
10
|
+
"array-bracket-newline": ["error", "consistent"],
|
|
11
|
+
/**
|
|
12
|
+
* enforce spacing inside array brackets 🔧
|
|
13
|
+
* https://eslint.org/docs/rules/array-bracket-spacing
|
|
14
|
+
*/
|
|
15
|
+
"array-bracket-spacing": ["error", "never"],
|
|
16
|
+
/**
|
|
17
|
+
* enforce line breaks between array elements 🔧
|
|
18
|
+
* https://eslint.org/docs/rules/array-element-newline
|
|
19
|
+
*/
|
|
20
|
+
"array-element-newline": ["error", { multiline: true, minItems: 3 }],
|
|
21
|
+
/**
|
|
22
|
+
* enforce spacing inside single-line blocks 🔧
|
|
23
|
+
* https://eslint.org/docs/rules/block-spacing
|
|
24
|
+
*/
|
|
25
|
+
"block-spacing": ["error", "always"],
|
|
26
|
+
/**
|
|
27
|
+
* enforce one true brace style 🔧
|
|
28
|
+
* https://eslint.org/docs/rules/brace-style
|
|
29
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/brace-style.md
|
|
30
|
+
*/
|
|
31
|
+
"brace-style": "off",
|
|
32
|
+
"@typescript-eslint/brace-style": "error",
|
|
33
|
+
/**
|
|
34
|
+
* require camel case names
|
|
35
|
+
* https://eslint.org/docs/rules/camelcase
|
|
36
|
+
*/
|
|
37
|
+
camelcase: ["error", { properties: "never" }],
|
|
38
|
+
/**
|
|
39
|
+
* enforce or disallow capitalization of the first letter of a comment 🔧
|
|
40
|
+
* https://eslint.org/docs/rules/capitalized-comments
|
|
41
|
+
*/
|
|
42
|
+
"capitalized-comments": "off",
|
|
43
|
+
/**
|
|
44
|
+
* require trailing commas in multiline object literals 🔧
|
|
45
|
+
* https://eslint.org/docs/rules/comma-dangle
|
|
46
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
47
|
+
*/
|
|
48
|
+
"comma-dangle": "off",
|
|
49
|
+
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
|
|
50
|
+
/**
|
|
51
|
+
* enforce spacing before/after comma 🔧
|
|
52
|
+
* https://eslint.org/docs/rules/comma-spacing
|
|
53
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
54
|
+
*/
|
|
55
|
+
"comma-spacing": "off",
|
|
56
|
+
"@typescript-eslint/comma-spacing": "error",
|
|
57
|
+
/**
|
|
58
|
+
* enforce one true comma style 🔧
|
|
59
|
+
* https://eslint.org/docs/rules/comma-style
|
|
60
|
+
*/
|
|
61
|
+
"comma-style": "error",
|
|
62
|
+
/**
|
|
63
|
+
* disallow padding inside computed properties 🔧
|
|
64
|
+
* https://eslint.org/docs/rules/computed-property-spacing
|
|
65
|
+
*/
|
|
66
|
+
"computed-property-spacing": "error",
|
|
67
|
+
/**
|
|
68
|
+
* enforces consistent naming when capturing the current execution context
|
|
69
|
+
* https://eslint.org/docs/rules/consistent-this
|
|
70
|
+
* doing this at all is forbidden
|
|
71
|
+
*/
|
|
72
|
+
"consistent-this": "off",
|
|
73
|
+
/**
|
|
74
|
+
* enforce newline at the end of file, with no multiple empty lines 🔧
|
|
75
|
+
* https://eslint.org/docs/rules/eol-last
|
|
76
|
+
*/
|
|
77
|
+
"eol-last": "error",
|
|
78
|
+
/**
|
|
79
|
+
* enforce spacing between functions and their invocations 🔧
|
|
80
|
+
* https://eslint.org/docs/rules/func-call-spacing
|
|
81
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
82
|
+
*/
|
|
83
|
+
"func-call-spacing": "off",
|
|
84
|
+
"@typescript-eslint/func-call-spacing": "error",
|
|
85
|
+
/**
|
|
86
|
+
* requires function names to match the name of the
|
|
87
|
+
* variable or property to which they are assigned
|
|
88
|
+
* https://eslint.org/docs/rules/func-name-matching
|
|
89
|
+
*/
|
|
90
|
+
"func-name-matching": "off",
|
|
91
|
+
/**
|
|
92
|
+
* require function expressions to have a name
|
|
93
|
+
* https://eslint.org/docs/rules/func-names
|
|
94
|
+
*/
|
|
95
|
+
"func-names": "off",
|
|
96
|
+
/**
|
|
97
|
+
* enforces use of function declarations or expressions
|
|
98
|
+
* https://eslint.org/docs/rules/func-style
|
|
99
|
+
*/
|
|
100
|
+
"func-style": ["off", "expression"],
|
|
101
|
+
/**
|
|
102
|
+
* enforce line breaks between arguments of a function call 🔧
|
|
103
|
+
* https://eslint.org/docs/rules/function-call-argument-newline
|
|
104
|
+
*/
|
|
105
|
+
"function-call-argument-newline": ["off", "consistent"],
|
|
106
|
+
/**
|
|
107
|
+
* enforce consistent line breaks inside function parentheses 🔧
|
|
108
|
+
* https://eslint.org/docs/rules/function-paren-newline
|
|
109
|
+
*/
|
|
110
|
+
"function-paren-newline": ["error", "consistent"],
|
|
111
|
+
/**
|
|
112
|
+
* Blacklist certain identifiers to prevent them being used
|
|
113
|
+
* https://eslint.org/docs/rules/id-blacklist
|
|
114
|
+
*/
|
|
115
|
+
"id-blacklist": "off",
|
|
116
|
+
/**
|
|
117
|
+
* disallow specified identifiers
|
|
118
|
+
* https://eslint.org/docs/rules/id-denylist
|
|
119
|
+
*/
|
|
120
|
+
"id-denylist": "off",
|
|
121
|
+
/**
|
|
122
|
+
* this option enforces minimum and maximum identifier
|
|
123
|
+
* lengths (variable names, property names etc.)
|
|
124
|
+
* https://eslint.org/docs/rules/id-length
|
|
125
|
+
*/
|
|
126
|
+
"id-length": "off",
|
|
127
|
+
/**
|
|
128
|
+
* require identifiers to match the provided regular expression
|
|
129
|
+
* https://eslint.org/docs/rules/id-match
|
|
130
|
+
*/
|
|
131
|
+
"id-match": "off",
|
|
132
|
+
/**
|
|
133
|
+
* Enforce the location of arrow function bodies with implicit returns 🔧
|
|
134
|
+
* https://eslint.org/docs/rules/implicit-arrow-linebreak
|
|
135
|
+
*/
|
|
136
|
+
"implicit-arrow-linebreak": "error",
|
|
137
|
+
/**
|
|
138
|
+
* this option sets a specific tab width for your code 🔧
|
|
139
|
+
* https://eslint.org/docs/rules/indent
|
|
140
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
|
|
141
|
+
*/
|
|
142
|
+
indent: "off",
|
|
143
|
+
"@typescript-eslint/indent": ["error", 2],
|
|
144
|
+
/**
|
|
145
|
+
* specify whether double or single quotes should be used in JSX attributes 🔧
|
|
146
|
+
* https://eslint.org/docs/rules/jsx-quotes
|
|
147
|
+
*/
|
|
148
|
+
"jsx-quotes": "error",
|
|
149
|
+
/**
|
|
150
|
+
* enforces spacing between keys and values in object literal properties 🔧
|
|
151
|
+
* https://eslint.org/docs/rules/key-spacing
|
|
152
|
+
*/
|
|
153
|
+
"key-spacing": "error",
|
|
154
|
+
/**
|
|
155
|
+
* require a space before & after certain keywords 🔧
|
|
156
|
+
* https://eslint.org/docs/rules/keyword-spacing
|
|
157
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
158
|
+
*/
|
|
159
|
+
"keyword-spacing": "off",
|
|
160
|
+
"@typescript-eslint/keyword-spacing": "error",
|
|
161
|
+
/**
|
|
162
|
+
* enforce position of line comments
|
|
163
|
+
* https://eslint.org/docs/rules/line-comment-position
|
|
164
|
+
*/
|
|
165
|
+
"line-comment-position": "error",
|
|
166
|
+
/**
|
|
167
|
+
* disallow mixed 'LF' and 'CRLF' as linebreaks 🔧
|
|
168
|
+
* https://eslint.org/docs/rules/linebreak-style
|
|
169
|
+
*/
|
|
170
|
+
"linebreak-style": "error",
|
|
171
|
+
/**
|
|
172
|
+
* enforces empty lines around comments 🔧
|
|
173
|
+
* https://eslint.org/docs/rules/lines-around-comment
|
|
174
|
+
*/
|
|
175
|
+
"lines-around-comment": "off",
|
|
176
|
+
/**
|
|
177
|
+
* require or disallow an empty line between class members 🔧
|
|
178
|
+
* https://eslint.org/docs/rules/lines-between-class-members
|
|
179
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
180
|
+
*/
|
|
181
|
+
"lines-between-class-members": "off",
|
|
182
|
+
"@typescript-eslint/lines-between-class-members": "error",
|
|
183
|
+
/**
|
|
184
|
+
* specify the maximum depth that blocks can be nested
|
|
185
|
+
* https://eslint.org/docs/rules/max-depth
|
|
186
|
+
*/
|
|
187
|
+
"max-depth": "warn",
|
|
188
|
+
/**
|
|
189
|
+
* specify the maximum length of a line in your program
|
|
190
|
+
* https://eslint.org/docs/rules/max-len
|
|
191
|
+
*/
|
|
192
|
+
"max-len": [
|
|
193
|
+
"error",
|
|
123
194
|
{
|
|
124
195
|
code: 100,
|
|
125
196
|
tabWidth: 2,
|
|
@@ -130,233 +201,360 @@ exports.stylisticIssues = {
|
|
|
130
201
|
ignoreTemplateLiterals: true,
|
|
131
202
|
},
|
|
132
203
|
],
|
|
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
|
-
|
|
204
|
+
/**
|
|
205
|
+
* specify the max number of lines in a file
|
|
206
|
+
* https://eslint.org/docs/rules/max-lines
|
|
207
|
+
*/
|
|
208
|
+
"max-lines": "off",
|
|
209
|
+
/**
|
|
210
|
+
* enforce a maximum function length
|
|
211
|
+
* https://eslint.org/docs/rules/max-lines-per-function
|
|
212
|
+
*/
|
|
213
|
+
"max-lines-per-function": "off",
|
|
214
|
+
/**
|
|
215
|
+
* specify the maximum depth callbacks can be nested
|
|
216
|
+
* https://eslint.org/docs/rules/max-nested-callbacks
|
|
217
|
+
*/
|
|
218
|
+
"max-nested-callbacks": "off",
|
|
219
|
+
/**
|
|
220
|
+
* limits the number of parameters that can be used in the function declaration.
|
|
221
|
+
* https://eslint.org/docs/rules/max-params
|
|
222
|
+
*/
|
|
223
|
+
"max-params": "off",
|
|
224
|
+
/**
|
|
225
|
+
* specify the maximum number of statement allowed in a function
|
|
226
|
+
* https://eslint.org/docs/rules/max-statements
|
|
227
|
+
*/
|
|
228
|
+
"max-statements": "off",
|
|
229
|
+
/**
|
|
230
|
+
* restrict the number of statements per line
|
|
231
|
+
* https://eslint.org/docs/rules/max-statements-per-line
|
|
232
|
+
*/
|
|
233
|
+
"max-statements-per-line": "off",
|
|
234
|
+
/**
|
|
235
|
+
* enforce a particular style for multiline comments 🔧
|
|
236
|
+
* https://eslint.org/docs/rules/multiline-comment-style
|
|
237
|
+
*/
|
|
238
|
+
"multiline-comment-style": "error",
|
|
239
|
+
/**
|
|
240
|
+
* require multiline ternary 🔧
|
|
241
|
+
* https://eslint.org/docs/rules/multiline-ternary
|
|
242
|
+
*/
|
|
243
|
+
"multiline-ternary": "off",
|
|
244
|
+
/**
|
|
245
|
+
* require a capital letter for constructors
|
|
246
|
+
* https://eslint.org/docs/rules/new-cap
|
|
247
|
+
*/
|
|
248
|
+
"new-cap": "error",
|
|
249
|
+
/**
|
|
250
|
+
* disallow the omission of parentheses when invoking a constructor with no arguments 🔧
|
|
251
|
+
* https://eslint.org/docs/rules/new-parens
|
|
252
|
+
*/
|
|
253
|
+
"new-parens": "error",
|
|
254
|
+
/**
|
|
255
|
+
* enforces new line after each method call in the chain
|
|
256
|
+
* to make it more readable and easy to maintain 🔧
|
|
257
|
+
* https://eslint.org/docs/rules/newline-per-chained-call
|
|
258
|
+
*/
|
|
259
|
+
"newline-per-chained-call": "error",
|
|
260
|
+
/**
|
|
261
|
+
* disallow use of the Array constructor
|
|
262
|
+
* https://eslint.org/docs/rules/no-array-constructor
|
|
263
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
264
|
+
*/
|
|
265
|
+
"no-array-constructor": "off",
|
|
266
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
267
|
+
/**
|
|
268
|
+
* disallow use of bitwise operators
|
|
269
|
+
* https://eslint.org/docs/rules/no-bitwise
|
|
270
|
+
*/
|
|
271
|
+
"no-bitwise": "warn",
|
|
272
|
+
/**
|
|
273
|
+
* disallow use of the continue statement
|
|
274
|
+
* https://eslint.org/docs/rules/no-continue
|
|
275
|
+
*/
|
|
276
|
+
"no-continue": "error",
|
|
277
|
+
/**
|
|
278
|
+
* disallow comments inline after code
|
|
279
|
+
* https://eslint.org/docs/rules/no-inline-comments
|
|
280
|
+
*/
|
|
281
|
+
"no-inline-comments": "error",
|
|
282
|
+
/**
|
|
283
|
+
* disallow if as the only statement in an else block 🔧
|
|
284
|
+
* https://eslint.org/docs/rules/no-lonely-if
|
|
285
|
+
*/
|
|
286
|
+
"no-lonely-if": "error",
|
|
287
|
+
/**
|
|
288
|
+
* disallow un-paren'd mixes of different operators
|
|
289
|
+
* https://eslint.org/docs/rules/no-mixed-operators
|
|
290
|
+
*/
|
|
291
|
+
"no-mixed-operators": "error",
|
|
292
|
+
/**
|
|
293
|
+
* disallow mixed spaces and tabs for indentation ✅
|
|
294
|
+
* https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
|
|
295
|
+
*/
|
|
296
|
+
"no-mixed-spaces-and-tabs": "error",
|
|
297
|
+
/**
|
|
298
|
+
* disallow use of chained assignment expressions
|
|
299
|
+
* https://eslint.org/docs/rules/no-multi-assign
|
|
300
|
+
*/
|
|
301
|
+
"no-multi-assign": "error",
|
|
302
|
+
/**
|
|
303
|
+
* disallow multiple empty lines, only one newline at the end, and no new lines at the beginning 🔧
|
|
304
|
+
* https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
305
|
+
*/
|
|
306
|
+
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
307
|
+
/**
|
|
308
|
+
* disallow negated conditions
|
|
309
|
+
* https://eslint.org/docs/rules/no-negated-condition
|
|
310
|
+
*/
|
|
311
|
+
"no-negated-condition": "off",
|
|
312
|
+
/**
|
|
313
|
+
* disallow nested ternary expressions
|
|
314
|
+
* https://eslint.org/docs/rules/no-nested-ternary
|
|
315
|
+
*/
|
|
316
|
+
"no-nested-ternary": "error",
|
|
317
|
+
/**
|
|
318
|
+
* disallow use of the Object constructor
|
|
319
|
+
* https://eslint.org/docs/rules/no-new-object
|
|
320
|
+
*/
|
|
321
|
+
"no-new-object": "error",
|
|
322
|
+
/**
|
|
323
|
+
* disallow use of unary operators, ++ and --
|
|
324
|
+
* https://eslint.org/docs/rules/no-plusplus
|
|
325
|
+
*/
|
|
326
|
+
"no-plusplus": "error",
|
|
327
|
+
/**
|
|
328
|
+
* disallow certain syntax forms
|
|
329
|
+
* https://eslint.org/docs/rules/no-restricted-syntax
|
|
330
|
+
*/
|
|
331
|
+
"no-restricted-syntax": [
|
|
332
|
+
"error",
|
|
211
333
|
{
|
|
212
|
-
selector:
|
|
213
|
-
message:
|
|
334
|
+
selector: "ForInStatement",
|
|
335
|
+
message: "for-in loops are disallowed. (https://github.com/SPSCommerce/javascript#iterators--no-for-in)",
|
|
214
336
|
},
|
|
215
337
|
{
|
|
216
|
-
selector:
|
|
217
|
-
message:
|
|
338
|
+
selector: "LabeledStatement",
|
|
339
|
+
message: "Labeled statements are disallowed. (https://github.com/SPSCommerce/javascript#control-statements--value-selection)",
|
|
218
340
|
},
|
|
219
341
|
],
|
|
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
|
-
|
|
342
|
+
/**
|
|
343
|
+
* disallow tab characters entirely
|
|
344
|
+
* https://eslint.org/docs/rules/no-tabs
|
|
345
|
+
*/
|
|
346
|
+
"no-tabs": "error",
|
|
347
|
+
/**
|
|
348
|
+
* disallow the use of ternary operators
|
|
349
|
+
* https://eslint.org/docs/rules/no-ternary
|
|
350
|
+
*/
|
|
351
|
+
"no-ternary": "off",
|
|
352
|
+
/**
|
|
353
|
+
* disallow trailing whitespace at the end of lines 🔧
|
|
354
|
+
* https://eslint.org/docs/rules/no-trailing-spaces
|
|
355
|
+
*/
|
|
356
|
+
"no-trailing-spaces": "error",
|
|
357
|
+
/**
|
|
358
|
+
* disallow dangling underscores in identifiers
|
|
359
|
+
* https://eslint.org/docs/rules/no-underscore-dangle
|
|
360
|
+
*/
|
|
361
|
+
"no-underscore-dangle": ["error", { enforceInMethodNames: true }],
|
|
362
|
+
/**
|
|
363
|
+
* prefer `a || b` over `a ? a : b` 🔧
|
|
364
|
+
* https://eslint.org/docs/rules/no-unneeded-ternary
|
|
365
|
+
*/
|
|
366
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
367
|
+
/**
|
|
368
|
+
* disallow whitespace before properties 🔧
|
|
369
|
+
* https://eslint.org/docs/rules/no-whitespace-before-property
|
|
370
|
+
*/
|
|
371
|
+
"no-whitespace-before-property": "error",
|
|
372
|
+
/**
|
|
373
|
+
* enforce the location of single-line statements 🔧
|
|
374
|
+
* https://eslint.org/docs/rules/nonblock-statement-body-position
|
|
375
|
+
*/
|
|
376
|
+
"nonblock-statement-body-position": "error",
|
|
377
|
+
/**
|
|
378
|
+
* enforce line breaks between braces 🔧
|
|
379
|
+
* https://eslint.org/docs/rules/object-curly-newline
|
|
380
|
+
*/
|
|
381
|
+
"object-curly-newline": [
|
|
382
|
+
"error",
|
|
245
383
|
{
|
|
246
384
|
minProperties: 4,
|
|
247
385
|
multiline: true,
|
|
248
386
|
consistent: true,
|
|
249
387
|
},
|
|
250
388
|
],
|
|
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
|
-
|
|
389
|
+
/**
|
|
390
|
+
* require padding inside curly braces 🔧
|
|
391
|
+
* https://eslint.org/docs/rules/object-curly-spacing
|
|
392
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/object-curly-spacing.md
|
|
393
|
+
*/
|
|
394
|
+
"object-curly-spacing": "off",
|
|
395
|
+
"@typescript-eslint/object-curly-spacing": ["error", "always"],
|
|
396
|
+
/**
|
|
397
|
+
* enforce "same line" or "multiple line" on object properties. 🔧
|
|
398
|
+
* https://eslint.org/docs/rules/object-property-newline
|
|
399
|
+
*/
|
|
400
|
+
"object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
401
|
+
/**
|
|
402
|
+
* allow just one variable declaration per function 🔧
|
|
403
|
+
* https://eslint.org/docs/rules/one-var
|
|
404
|
+
* nb: despite 'var' being in the name, does apply to let and const
|
|
405
|
+
*/
|
|
406
|
+
"one-var": ["error", "never"],
|
|
407
|
+
/**
|
|
408
|
+
* require a newline around variable declaration 🔧
|
|
409
|
+
* https://eslint.org/docs/rules/one-var-declaration-per-line
|
|
410
|
+
*/
|
|
411
|
+
"one-var-declaration-per-line": ["error", "always"],
|
|
412
|
+
/**
|
|
413
|
+
* require assignment operator shorthand where possible or prohibit it entirely 🔧
|
|
414
|
+
* https://eslint.org/docs/rules/operator-assignment
|
|
415
|
+
*/
|
|
416
|
+
"operator-assignment": "error",
|
|
417
|
+
/**
|
|
418
|
+
* Requires operator at the beginning of the line in multiline statements 🔧
|
|
419
|
+
* https://eslint.org/docs/rules/operator-linebreak
|
|
420
|
+
*/
|
|
421
|
+
"operator-linebreak": ["error",
|
|
422
|
+
"before",
|
|
423
|
+
{ overrides: { "=": "none" } }],
|
|
424
|
+
/**
|
|
425
|
+
* disallow padding within blocks 🔧
|
|
426
|
+
* https://eslint.org/docs/rules/padded-blocks
|
|
427
|
+
*/
|
|
428
|
+
"padded-blocks": [
|
|
429
|
+
"error",
|
|
276
430
|
{
|
|
277
|
-
blocks:
|
|
278
|
-
classes:
|
|
279
|
-
switches:
|
|
431
|
+
blocks: "never",
|
|
432
|
+
classes: "never",
|
|
433
|
+
switches: "never",
|
|
280
434
|
},
|
|
281
435
|
{
|
|
282
436
|
allowSingleLineBlocks: true,
|
|
283
437
|
},
|
|
284
438
|
],
|
|
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
|
-
|
|
439
|
+
/**
|
|
440
|
+
* Require or disallow padding lines between statements 🔧
|
|
441
|
+
* https://eslint.org/docs/rules/padding-line-between-statements
|
|
442
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/padding-line-between-statements.md
|
|
443
|
+
*/
|
|
444
|
+
"padding-line-between-statements": "off",
|
|
445
|
+
"@typescript-eslint/padding-line-between-statements": "off",
|
|
446
|
+
/**
|
|
447
|
+
* Disallow the use of Math.pow in favor of the ** operator 🔧
|
|
448
|
+
* https://eslint.org/docs/rules/prefer-exponentiation-operator
|
|
449
|
+
*/
|
|
450
|
+
"prefer-exponentiation-operator": "off",
|
|
451
|
+
/**
|
|
452
|
+
* Prefer use of an object spread over Object.assign 🔧
|
|
453
|
+
* https://eslint.org/docs/rules/prefer-object-spread
|
|
454
|
+
*/
|
|
455
|
+
"prefer-object-spread": "error",
|
|
456
|
+
/**
|
|
457
|
+
* require quotes around object literal property names 🔧
|
|
458
|
+
* https://eslint.org/docs/rules/quote-props
|
|
459
|
+
*/
|
|
460
|
+
"quote-props": ["error",
|
|
461
|
+
"as-needed",
|
|
462
|
+
{ keywords: false, numbers: false }],
|
|
463
|
+
/**
|
|
464
|
+
* specify whether double or single quotes should be used 🔧
|
|
465
|
+
* https://eslint.org/docs/rules/quotes
|
|
466
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
|
|
467
|
+
*/
|
|
468
|
+
quotes: "off",
|
|
469
|
+
"@typescript-eslint/quotes": ["error",
|
|
470
|
+
"double",
|
|
471
|
+
{ avoidEscape: true }],
|
|
472
|
+
/**
|
|
473
|
+
* require or disallow use of semicolons instead of ASI 🔧
|
|
474
|
+
* https://eslint.org/docs/rules/
|
|
475
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
476
|
+
*/
|
|
477
|
+
semi: "off",
|
|
478
|
+
"@typescript-eslint/semi": "error",
|
|
479
|
+
/**
|
|
480
|
+
* enforce spacing before and after semicolons 🔧
|
|
481
|
+
* https://eslint.org/docs/rules/semi-spacing
|
|
482
|
+
*/
|
|
483
|
+
"semi-spacing": "error",
|
|
484
|
+
/**
|
|
485
|
+
* Enforce location of semicolons 🔧
|
|
486
|
+
* https://eslint.org/docs/rules/semi-style
|
|
487
|
+
*/
|
|
488
|
+
"semi-style": "error",
|
|
489
|
+
/**
|
|
490
|
+
* requires object keys to be sorted
|
|
491
|
+
* https://eslint.org/docs/rules/sort-keys
|
|
492
|
+
*/
|
|
493
|
+
"sort-keys": "off",
|
|
494
|
+
/**
|
|
495
|
+
* sort variables within the same declaration block 🔧
|
|
496
|
+
* https://eslint.org/docs/rules/sort-vars
|
|
497
|
+
*/
|
|
498
|
+
"sort-vars": "off",
|
|
499
|
+
/**
|
|
500
|
+
* require or disallow space before blocks 🔧
|
|
501
|
+
* https://eslint.org/docs/rules/space-before-blocks
|
|
502
|
+
*/
|
|
503
|
+
"space-before-blocks": "error",
|
|
504
|
+
/**
|
|
505
|
+
* require or disallow space before function opening parenthesis 🔧
|
|
506
|
+
* https://eslint.org/docs/rules/space-before-function-paren
|
|
507
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
508
|
+
*/
|
|
509
|
+
"space-before-function-paren": "off",
|
|
510
|
+
"@typescript-eslint/space-before-function-paren": [
|
|
511
|
+
"error",
|
|
330
512
|
{
|
|
331
|
-
anonymous:
|
|
332
|
-
named:
|
|
333
|
-
asyncArrow:
|
|
513
|
+
anonymous: "always",
|
|
514
|
+
named: "never",
|
|
515
|
+
asyncArrow: "always",
|
|
334
516
|
},
|
|
335
517
|
],
|
|
336
|
-
/**
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
518
|
+
/**
|
|
519
|
+
* require or disallow spaces inside parentheses 🔧
|
|
520
|
+
* https://eslint.org/docs/rules/space-in-parens
|
|
521
|
+
*/
|
|
522
|
+
"space-in-parens": "error",
|
|
523
|
+
/**
|
|
524
|
+
* require spaces around operators 🔧
|
|
525
|
+
* https://eslint.org/docs/rules/space-infix-ops
|
|
526
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
527
|
+
*/
|
|
528
|
+
"space-infix-ops": "off",
|
|
529
|
+
"@typescript-eslint/space-infix-ops": "error",
|
|
530
|
+
/**
|
|
531
|
+
* Require or disallow spaces before/after unary operators 🔧
|
|
532
|
+
* https://eslint.org/docs/rules/space-unary-ops
|
|
533
|
+
*/
|
|
534
|
+
"space-unary-ops": "error",
|
|
535
|
+
/**
|
|
536
|
+
* require or disallow a space immediately following the // or /* in a comment 🔧
|
|
537
|
+
* https://eslint.org/docs/rules/spaced-comment
|
|
538
|
+
*/
|
|
539
|
+
"spaced-comment": "error",
|
|
540
|
+
/**
|
|
541
|
+
* Enforce spacing around colons of switch statements 🔧
|
|
542
|
+
* https://eslint.org/docs/rules/switch-colon-spacing
|
|
543
|
+
*/
|
|
544
|
+
"switch-colon-spacing": "error",
|
|
545
|
+
/**
|
|
546
|
+
* Require or disallow spacing between template tags and their literals 🔧
|
|
547
|
+
* https://eslint.org/docs/rules/template-tag-spacing
|
|
548
|
+
*/
|
|
549
|
+
"template-tag-spacing": "error",
|
|
550
|
+
/**
|
|
551
|
+
* require or disallow the Unicode Byte Order Mark 🔧
|
|
552
|
+
* https://eslint.org/docs/rules/unicode-bom
|
|
553
|
+
*/
|
|
554
|
+
"unicode-bom": "error",
|
|
555
|
+
/**
|
|
556
|
+
* require regex literals to be wrapped in parentheses 🔧
|
|
557
|
+
* https://eslint.org/docs/rules/wrap-regex
|
|
558
|
+
*/
|
|
559
|
+
"wrap-regex": "off",
|
|
362
560
|
};
|