@@ -181,16 +181,17 @@ export default createRule<Options, MessageIds>({
181
181
} as TSESTree . PropertyDefinition ;
182
182
}
183
183
184
- return Object . assign ( { } , rules , {
184
+ return {
185
+ ...rules ,
185
186
// overwrite the base rule here so we can use our KNOWN_NODES list instead
186
- '*:exit' ( node : TSESTree . Node ) {
187
+ '*:exit' ( node : TSESTree . Node ) : void {
187
188
// For nodes we care about, skip the default handling, because it just marks the node as ignored...
188
189
if ( ! KNOWN_NODES . has ( node . type ) ) {
189
190
rules [ '*:exit' ] ( node ) ;
190
191
}
191
192
} ,
192
193
193
- VariableDeclaration ( node : TSESTree . VariableDeclaration ) {
194
+ VariableDeclaration ( node : TSESTree . VariableDeclaration ) : void {
194
195
// https://github.com/typescript-eslint/typescript-eslint/issues/441
195
196
if ( node . declarations . length === 0 ) {
196
197
return ;
@@ -199,7 +200,7 @@ export default createRule<Options, MessageIds>({
199
200
return rules . VariableDeclaration ( node ) ;
200
201
} ,
201
202
202
- TSAsExpression ( node : TSESTree . TSAsExpression ) {
203
+ TSAsExpression ( node : TSESTree . TSAsExpression ) : void {
203
204
// transform it to a BinaryExpression
204
205
return rules [ 'BinaryExpression, LogicalExpression' ] ( {
205
206
type : AST_NODE_TYPES . BinaryExpression ,
@@ -215,7 +216,7 @@ export default createRule<Options, MessageIds>({
215
216
} ) ;
216
217
} ,
217
218
218
- TSConditionalType ( node : TSESTree . TSConditionalType ) {
219
+ TSConditionalType ( node : TSESTree . TSConditionalType ) : void {
219
220
// transform it to a ConditionalExpression
220
221
return rules . ConditionalExpression ( {
221
222
type : AST_NODE_TYPES . ConditionalExpression ,
@@ -245,7 +246,7 @@ export default createRule<Options, MessageIds>({
245
246
246
247
'TSEnumDeclaration, TSTypeLiteral' (
247
248
node : TSESTree . TSEnumDeclaration | TSESTree . TSTypeLiteral ,
248
- ) {
249
+ ) : void {
249
250
// transform it to an ObjectExpression
250
251
return rules [ 'ObjectExpression, ObjectPattern' ] ( {
251
252
type : AST_NODE_TYPES . ObjectExpression ,
@@ -263,7 +264,9 @@ export default createRule<Options, MessageIds>({
263
264
} ) ;
264
265
} ,
265
266
266
- TSImportEqualsDeclaration ( node : TSESTree . TSImportEqualsDeclaration ) {
267
+ TSImportEqualsDeclaration (
268
+ node : TSESTree . TSImportEqualsDeclaration ,
269
+ ) : void {
267
270
// transform it to an VariableDeclaration
268
271
// use VariableDeclaration instead of ImportDeclaration because it's essentially the same thing
269
272
const { id, moduleReference } = node ;
@@ -317,7 +320,7 @@ export default createRule<Options, MessageIds>({
317
320
} ) ;
318
321
} ,
319
322
320
- TSIndexedAccessType ( node : TSESTree . TSIndexedAccessType ) {
323
+ TSIndexedAccessType ( node : TSESTree . TSIndexedAccessType ) : void {
321
324
// convert to a MemberExpression
322
325
return rules [ 'MemberExpression, JSXMemberExpression, MetaProperty' ] ( {
323
326
type : AST_NODE_TYPES . MemberExpression ,
@@ -333,7 +336,7 @@ export default createRule<Options, MessageIds>({
333
336
} ) ;
334
337
} ,
335
338
336
- TSInterfaceBody ( node : TSESTree . TSInterfaceBody ) {
339
+ TSInterfaceBody ( node : TSESTree . TSInterfaceBody ) : void {
337
340
// transform it to an ClassBody
338
341
return rules [ 'BlockStatement, ClassBody' ] ( {
339
342
type : AST_NODE_TYPES . ClassBody ,
@@ -354,7 +357,7 @@ export default createRule<Options, MessageIds>({
354
357
355
358
'TSInterfaceDeclaration[extends.length > 0]' (
356
359
node : TSESTree . TSInterfaceDeclaration ,
357
- ) {
360
+ ) : void {
358
361
// transform it to a ClassDeclaration
359
362
return rules [
360
363
'ClassDeclaration[superClass], ClassExpression[superClass]'
@@ -379,7 +382,7 @@ export default createRule<Options, MessageIds>({
379
382
} ) ;
380
383
} ,
381
384
382
- TSMappedType ( node : TSESTree . TSMappedType ) {
385
+ TSMappedType ( node : TSESTree . TSMappedType ) : void {
383
386
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
384
387
const squareBracketStart = context . sourceCode . getTokenBefore (
385
388
node . typeParameter ,
@@ -423,7 +426,7 @@ export default createRule<Options, MessageIds>({
423
426
} ) ;
424
427
} ,
425
428
426
- TSModuleBlock ( node : TSESTree . TSModuleBlock ) {
429
+ TSModuleBlock ( node : TSESTree . TSModuleBlock ) : void {
427
430
// transform it to a BlockStatement
428
431
return rules [ 'BlockStatement, ClassBody' ] ( {
429
432
type : AST_NODE_TYPES . BlockStatement ,
@@ -436,7 +439,7 @@ export default createRule<Options, MessageIds>({
436
439
} ) ;
437
440
} ,
438
441
439
- TSQualifiedName ( node : TSESTree . TSQualifiedName ) {
442
+ TSQualifiedName ( node : TSESTree . TSQualifiedName ) : void {
440
443
return rules [ 'MemberExpression, JSXMemberExpression, MetaProperty' ] ( {
441
444
type : AST_NODE_TYPES . MemberExpression ,
442
445
object : node . left as any ,
@@ -451,7 +454,7 @@ export default createRule<Options, MessageIds>({
451
454
} ) ;
452
455
} ,
453
456
454
- TSTupleType ( node : TSESTree . TSTupleType ) {
457
+ TSTupleType ( node : TSESTree . TSTupleType ) : void {
455
458
// transform it to an ArrayExpression
456
459
return rules [ 'ArrayExpression, ArrayPattern' ] ( {
457
460
type : AST_NODE_TYPES . ArrayExpression ,
@@ -464,7 +467,9 @@ export default createRule<Options, MessageIds>({
464
467
} ) ;
465
468
} ,
466
469
467
- TSTypeParameterDeclaration ( node : TSESTree . TSTypeParameterDeclaration ) {
470
+ TSTypeParameterDeclaration (
471
+ node : TSESTree . TSTypeParameterDeclaration ,
472
+ ) : void {
468
473
if ( ! node . params . length ) {
469
474
return ;
470
475
}
@@ -487,6 +492,6 @@ export default createRule<Options, MessageIds>({
487
492
loc : node . loc ,
488
493
} ) ;
489
494
} ,
490
- } ) ;
495
+ } ;
491
496
} ,
492
497
} ) ;
0 commit comments