@@ -37,12 +37,12 @@ export function createTypings(
37
37
} ,
38
38
querySubtree ( subtree : any , query : string ) : any [ ] {
39
39
return astq . query ( subtree , query ) ;
40
- }
40
+ } ,
41
41
} ;
42
42
const reactComponentName = getReactComponentName ( ast ) ;
43
43
const importedPropTypes : ImportedPropTypes = {
44
44
propTypesName : getPropTypesName ( ast ) ,
45
- propTypes : getImportedPropTypes ( ast )
45
+ propTypes : getImportedPropTypes ( ast ) ,
46
46
} ;
47
47
const importedTypes = getInstanceOfPropTypes ( ast , importedPropTypes ) ;
48
48
const importStatements = getImportStatements (
@@ -53,15 +53,15 @@ export function createTypings(
53
53
const componentNames = getUniqueNames ( [
54
54
...getComponentNamesByPropTypeAssignment ( ast ) ,
55
55
...getComponentNamesByStaticPropTypeAttribute ( ast ) ,
56
- ...getComponentNamesByJsxInBody ( ast )
56
+ ...getComponentNamesByJsxInBody ( ast ) ,
57
57
] ) ;
58
58
const tripleSlashDirectives : dom . TripleSlashDirective [ ] = [ ] ;
59
59
const m = dom . create . module ( moduleName || 'moduleName' ) ;
60
60
61
61
m . members . push ( dom . create . importAll ( 'React' , reactImport ) ) ;
62
62
63
63
if ( importStatements . length > 0 ) {
64
- importStatements . forEach ( importStatement => {
64
+ importStatements . forEach ( ( importStatement ) => {
65
65
if ( importStatement . name === undefined ) {
66
66
m . members . push (
67
67
dom . create . importDefault ( importStatement . local , importStatement . path )
@@ -71,7 +71,7 @@ export function createTypings(
71
71
}
72
72
} ) ;
73
73
}
74
- componentNames . forEach ( componentName => {
74
+ componentNames . forEach ( ( componentName ) => {
75
75
const exportType = getComponentExportType ( ast , componentName ) ;
76
76
const propTypes = getPropTypes ( ast , componentName ) ;
77
77
if ( exportType ) {
@@ -89,7 +89,7 @@ export function createTypings(
89
89
} ) ;
90
90
91
91
if ( moduleName === null ) {
92
- return m . members . map ( member => dom . emit ( member ) ) . join ( '' ) ;
92
+ return m . members . map ( ( member ) => dom . emit ( member ) ) . join ( '' ) ;
93
93
} else {
94
94
return dom . emit ( m , { tripleSlashDirectives } ) ;
95
95
}
@@ -196,7 +196,7 @@ function createPropTypeTypings(
196
196
/ ObjectProperty
197
197
`
198
198
) ;
199
- res . forEach ( propertyAst => {
199
+ res . forEach ( ( propertyAst ) => {
200
200
const typeDecl = types . get (
201
201
ast ,
202
202
propertyAst . value ,
@@ -217,9 +217,9 @@ function createPropTypeTypings(
217
217
} ;
218
218
property . jsDocComment = ( propertyAst . leadingComments [ 0 ] . value as string )
219
219
. split ( '\n' )
220
- . map ( line => line . trim ( ) )
221
- . map ( line => line . replace ( / ^ \* \* ? / , '' ) )
222
- . map ( line => line . trim ( ) )
220
+ . map ( ( line ) => line . trim ( ) )
221
+ . map ( ( line ) => line . replace ( / ^ \* \* ? / , '' ) )
222
+ . map ( ( line ) => line . trim ( ) )
223
223
. filter ( trimLines ( ) )
224
224
. reverse ( )
225
225
. filter ( trimLines ( ) )
@@ -235,7 +235,7 @@ function extractComplexTypes(
235
235
interf : dom . InterfaceDeclaration ,
236
236
componentName : string
237
237
) : void {
238
- interf . members . forEach ( member => {
238
+ interf . members . forEach ( ( member ) => {
239
239
if ( member . kind === 'property' && isExtractableType ( member . type ) ) {
240
240
const name = `${ componentName } ${ pascalCase ( member . name ) } ` ;
241
241
const extractedMember = createModuleMember ( name , member . type ) ;
@@ -371,7 +371,7 @@ function getImportedPropTypes(ast: AstQuery): ImportedPropType[] {
371
371
)
372
372
. map ( ( { imported, local } ) => ( {
373
373
importedName : imported . name ,
374
- localName : local . name
374
+ localName : local . name ,
375
375
} ) ) ;
376
376
}
377
377
@@ -400,7 +400,7 @@ function getInstanceOfPropTypes(
400
400
/:arguments *
401
401
` ) ;
402
402
403
- return res . map ( identifer => identifer . name ) ;
403
+ return res . map ( ( identifer ) => identifer . name ) ;
404
404
}
405
405
406
406
interface ImportStatement {
@@ -414,7 +414,7 @@ function getImportStatements(
414
414
instanceOfResolver : InstanceOfResolver | undefined
415
415
) : ImportStatement [ ] {
416
416
return typeNames
417
- . map ( name => {
417
+ . map ( ( name ) => {
418
418
const res = ast . query ( `
419
419
// ImportDeclaration[
420
420
/:specifiers * /:local Identifier[@name == '${ name } ']
@@ -426,10 +426,10 @@ function getImportStatements(
426
426
? res [ 0 ] . specifiers [ 0 ] . imported . name
427
427
: undefined ,
428
428
local : name ,
429
- path : res . length > 0 ? res [ 0 ] . source . value : undefined
429
+ path : res . length > 0 ? res [ 0 ] . source . value : undefined ,
430
430
} ;
431
431
} )
432
- . map ( importStatement => {
432
+ . map ( ( importStatement ) => {
433
433
if ( importStatement && instanceOfResolver ) {
434
434
const resolvedPath = importStatement . name
435
435
? instanceOfResolver ( importStatement . name )
@@ -440,7 +440,7 @@ function getImportStatements(
440
440
}
441
441
return importStatement ;
442
442
} )
443
- . filter ( importStatement => Boolean ( importStatement . path ) ) ;
443
+ . filter ( ( importStatement ) => Boolean ( importStatement . path ) ) ;
444
444
}
445
445
446
446
function getComponentNamesByPropTypeAssignment ( ast : AstQuery ) : string [ ] {
@@ -452,7 +452,7 @@ function getComponentNamesByPropTypeAssignment(ast: AstQuery): string[] {
452
452
]
453
453
` ) ;
454
454
if ( res . length > 0 ) {
455
- return res . map ( match => match . object . name ) ;
455
+ return res . map ( ( match ) => match . object . name ) ;
456
456
}
457
457
return [ ] ;
458
458
}
@@ -464,7 +464,7 @@ function getComponentNamesByStaticPropTypeAttribute(ast: AstQuery): string[] {
464
464
]
465
465
` ) ;
466
466
if ( res . length > 0 ) {
467
- return res . map ( match => ( match . id ? match . id . name : '' ) ) ;
467
+ return res . map ( ( match ) => ( match . id ? match . id . name : '' ) ) ;
468
468
}
469
469
return [ ] ;
470
470
}
@@ -483,7 +483,7 @@ function getComponentNamesByJsxInBody(ast: AstQuery): string[] {
483
483
]
484
484
` ) ;
485
485
if ( res . length > 0 ) {
486
- return res . map ( match => ( match . id ? match . id . name : '' ) ) ;
486
+ return res . map ( ( match ) => ( match . id ? match . id . name : '' ) ) ;
487
487
}
488
488
return [ ] ;
489
489
}
0 commit comments