8
8
PackageJsonDependency ,
9
9
TypingsDataRaw ,
10
10
TypingsVersionsRaw ,
11
- DirectoryParsedTypingVersion
11
+ DirectoryParsedTypingVersion ,
12
12
} from "../packages" ;
13
13
import { getAllowedPackageJsonDependencies } from "./settings" ;
14
14
import {
@@ -26,7 +26,7 @@ import {
26
26
unmangleScopedPackage ,
27
27
removeVersionFromPackageName ,
28
28
hasVersionNumberInMapping ,
29
- mangleScopedPackage
29
+ mangleScopedPackage ,
30
30
} from "@definitelytyped/utils" ;
31
31
import { TypeScriptVersion } from "@definitelytyped/typescript-versions" ;
32
32
@@ -58,7 +58,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
58
58
}
59
59
const [ rootDirectoryLs , olderVersionDirectories ] = split < string , OlderVersionDir > (
60
60
fs . readdir ( ) ,
61
- fileOrDirectoryName => {
61
+ ( fileOrDirectoryName ) => {
62
62
const version = parseVersionFromDirectoryName ( fileOrDirectoryName ) ;
63
63
return version === undefined ? undefined : { directoryName : fileOrDirectoryName , version } ;
64
64
}
@@ -68,7 +68,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
68
68
69
69
const latestData : TypingsDataRaw = {
70
70
libraryVersionDirectoryName : undefined ,
71
- ...( await combineDataForAllTypesVersions ( packageName , rootDirectoryLs , fs , undefined ) )
71
+ ...( await combineDataForAllTypesVersions ( packageName , rootDirectoryLs , fs , undefined ) ) ,
72
72
} ;
73
73
74
74
const older = await Promise . all (
@@ -87,7 +87,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
87
87
const ls = fs . readdir ( directoryName ) ;
88
88
const data : TypingsDataRaw = {
89
89
libraryVersionDirectoryName : formatTypingVersion ( directoryVersion ) ,
90
- ...( await combineDataForAllTypesVersions ( packageName , ls , fs . subDir ( directoryName ) , directoryVersion ) )
90
+ ...( await combineDataForAllTypesVersions ( packageName , ls , fs . subDir ( directoryName ) , directoryVersion ) ) ,
91
91
} ;
92
92
93
93
if ( ! matchesVersion ( data , directoryVersion , considerLibraryMinorVersion ) ) {
@@ -122,8 +122,8 @@ interface LsMinusTypesVersionsAndPackageJson {
122
122
readonly hasPackageJson : boolean ;
123
123
}
124
124
function getTypesVersionsAndPackageJson ( ls : readonly string [ ] ) : LsMinusTypesVersionsAndPackageJson {
125
- const withoutPackageJson = ls . filter ( name => name !== packageJsonName ) ;
126
- const [ remainingLs , typesVersions ] = split ( withoutPackageJson , fileOrDirectoryName => {
125
+ const withoutPackageJson = ls . filter ( ( name ) => name !== packageJsonName ) ;
126
+ const [ remainingLs , typesVersions ] = split ( withoutPackageJson , ( fileOrDirectoryName ) => {
127
127
const match = / ^ t s ( \d + \. \d + ) $ / . exec ( fileOrDirectoryName ) ;
128
128
if ( match === null ) {
129
129
return undefined ;
@@ -159,7 +159,7 @@ export function parseVersionFromDirectoryName(
159
159
}
160
160
return {
161
161
major : Number ( match [ 1 ] ) ,
162
- minor : match [ 3 ] !== undefined ? Number ( match [ 3 ] ) : undefined // tslint:disable-line strict-type-predicates (false positive)
162
+ minor : match [ 3 ] !== undefined ? Number ( match [ 3 ] ) : undefined , // tslint:disable-line strict-type-predicates (false positive)
163
163
} ;
164
164
}
165
165
@@ -174,7 +174,7 @@ export function tryParsePackageVersion(versionString: string | undefined): Depen
174
174
}
175
175
return {
176
176
major : Number ( match [ 1 ] ) ,
177
- minor : match [ 3 ] !== undefined ? Number ( match [ 3 ] ) : undefined // tslint:disable-line strict-type-predicates (false positive)
177
+ minor : match [ 3 ] !== undefined ? Number ( match [ 3 ] ) : undefined , // tslint:disable-line strict-type-predicates (false positive)
178
178
} ;
179
179
}
180
180
@@ -204,7 +204,7 @@ async function combineDataForAllTypesVersions(
204
204
libraryMinorVersion,
205
205
typeScriptVersion : minTsVersion ,
206
206
libraryName,
207
- projects
207
+ projects,
208
208
} = parseHeaderOrFail ( readFileAndThrowOnBOM ( "index.d.ts" , fs ) ) ;
209
209
210
210
const dataForRoot = getTypingDataForSingleTypesVersion (
@@ -215,7 +215,7 @@ async function combineDataForAllTypesVersions(
215
215
fs ,
216
216
directoryVersion
217
217
) ;
218
- const dataForOtherTypesVersions = typesVersions . map ( tsVersion => {
218
+ const dataForOtherTypesVersions = typesVersions . map ( ( tsVersion ) => {
219
219
const subFs = fs . subDir ( `ts${ tsVersion } ` ) ;
220
220
return getTypingDataForSingleTypesVersion (
221
221
tsVersion ,
@@ -242,7 +242,7 @@ async function combineDataForAllTypesVersions(
242
242
243
243
const files = Array . from (
244
244
flatMap ( allTypesVersions , ( { typescriptVersion, declFiles } ) =>
245
- declFiles . map ( file => ( typescriptVersion === undefined ? file : `ts${ typescriptVersion } /${ file } ` ) )
245
+ declFiles . map ( ( file ) => ( typescriptVersion === undefined ? file : `ts${ typescriptVersion } /${ file } ` ) )
246
246
)
247
247
) ;
248
248
@@ -258,25 +258,25 @@ async function combineDataForAllTypesVersions(
258
258
typesVersions,
259
259
files,
260
260
license,
261
- dependencies : Object . assign ( { } , ...allTypesVersions . map ( v => v . dependencies ) ) ,
261
+ dependencies : Object . assign ( { } , ...allTypesVersions . map ( ( v ) => v . dependencies ) ) ,
262
262
testDependencies : getAllUniqueValues < "testDependencies" , string > ( allTypesVersions , "testDependencies" ) ,
263
- pathMappings : Object . assign ( { } , ...allTypesVersions . map ( v => v . pathMappings ) ) ,
263
+ pathMappings : Object . assign ( { } , ...allTypesVersions . map ( ( v ) => v . pathMappings ) ) ,
264
264
packageJsonDependencies,
265
265
contentHash : hash (
266
266
hasPackageJson ? [ ...files , packageJsonName ] : files ,
267
- mapDefined ( allTypesVersions , a => a . tsconfigPathsForHash ) ,
267
+ mapDefined ( allTypesVersions , ( a ) => a . tsconfigPathsForHash ) ,
268
268
fs
269
269
) ,
270
270
globals : getAllUniqueValues < "globals" , string > ( allTypesVersions , "globals" ) ,
271
271
declaredModules : getAllUniqueValues < "declaredModules" , string > ( allTypesVersions , "declaredModules" ) ,
272
272
imports : checkPackageJsonImports ( packageJson . imports , packageJsonName ) ,
273
273
exports : checkPackageJsonExportsAndAddPJsonEntry ( packageJson . exports , packageJsonName ) ,
274
- type : checkPackageJsonType ( packageJson . type , packageJsonName )
274
+ type : checkPackageJsonType ( packageJson . type , packageJsonName ) ,
275
275
} ;
276
276
}
277
277
278
278
function getAllUniqueValues < K extends string , T > ( records : readonly Record < K , readonly T [ ] > [ ] , key : K ) : readonly T [ ] {
279
- return unique ( flatMap ( records , x => x [ key ] ) ) ;
279
+ return unique ( flatMap ( records , ( x ) => x [ key ] ) ) ;
280
280
}
281
281
282
282
interface TypingDataFromIndividualTypeScriptVersion {
@@ -332,19 +332,22 @@ function getTypingDataForSingleTypesVersion(
332
332
checkAllFilesUsed ( ls , usedFiles , otherFiles , packageName , fs ) ;
333
333
for ( const untestedTypeFile of filter (
334
334
otherFiles ,
335
- name => name . endsWith ( ".d.ts" ) || name . endsWith ( ".d.mts" ) || name . endsWith ( ".d.cts" )
335
+ ( name ) => name . endsWith ( ".d.ts" ) || name . endsWith ( ".d.mts" ) || name . endsWith ( ".d.cts" )
336
336
) ) {
337
337
// add d.ts files from OTHER_FILES.txt in order get their dependencies
338
338
// tslint:disable-next-line:non-literal-fs-path -- Not a reference to the fs package
339
339
types . set ( untestedTypeFile , createSourceFile ( untestedTypeFile , fs . readFile ( untestedTypeFile ) ) ) ;
340
340
}
341
341
342
342
const { dependencies : dependenciesWithDeclaredModules , globals, declaredModules } = getModuleInfo ( packageName , types ) ;
343
- const declaredRootModules = new Set ( declaredModules . map ( m => rootName ( m , types , packageName ) ) ) ;
343
+ const declaredRootModules = new Set ( declaredModules . map ( ( m ) => rootName ( m , types , packageName ) ) ) ;
344
344
// Don't count an import of "x" as a dependency if we saw `declare module "x"` somewhere.
345
- const dependenciesSet = new Set ( filter ( dependenciesWithDeclaredModules , m => ! declaredRootModules . has ( m ) ) ) ;
345
+ const dependenciesSet = new Set ( filter ( dependenciesWithDeclaredModules , ( m ) => ! declaredRootModules . has ( m ) ) ) ;
346
346
const testDependencies = Array . from (
347
- filter ( getTestDependencies ( packageName , types , tests . keys ( ) , dependenciesSet , fs ) , m => ! declaredRootModules . has ( m ) )
347
+ filter (
348
+ getTestDependencies ( packageName , types , tests . keys ( ) , dependenciesSet , fs ) ,
349
+ ( m ) => ! declaredRootModules . has ( m )
350
+ )
348
351
) ;
349
352
350
353
const { paths } = tsconfig . compilerOptions ;
@@ -373,7 +376,7 @@ function getTypingDataForSingleTypesVersion(
373
376
globals,
374
377
declaredModules,
375
378
declFiles : sort ( types . keys ( ) ) ,
376
- tsconfigPathsForHash
379
+ tsconfigPathsForHash,
377
380
} ;
378
381
}
379
382
@@ -494,7 +497,7 @@ Other d.ts files must either be referenced through index.d.ts, tests, or added t
494
497
}
495
498
496
499
function isRelativePath ( path : string ) {
497
- return path . split ( / \/ / ) . every ( part => part . length > 0 && ! part . match ( / ^ \. + $ | [ \\ \n \r ] / ) ) ;
500
+ return path . split ( / \/ / ) . every ( ( part ) => part . length > 0 && ! part . match ( / ^ \. + $ | [ \\ \n \r ] / ) ) ;
498
501
}
499
502
500
503
interface TsConfig {
@@ -633,7 +636,7 @@ const nodeBuiltins: ReadonlySet<string> = new Set([
633
636
"util" ,
634
637
"v8" ,
635
638
"vm" ,
636
- "zlib"
639
+ "zlib" ,
637
640
] ) ;
638
641
639
642
function parseDependencyVersionFromPath (
@@ -657,7 +660,7 @@ function withoutEnd(s: string, end: string): string | undefined {
657
660
}
658
661
659
662
function hash ( files : readonly string [ ] , tsconfigPathsForHash : readonly string [ ] , fs : FS ) : string {
660
- const fileContents = files . map ( f => `${ f } **${ readFileAndThrowOnBOM ( f , fs ) } ` ) ;
663
+ const fileContents = files . map ( ( f ) => `${ f } **${ readFileAndThrowOnBOM ( f , fs ) } ` ) ;
661
664
let allContent = fileContents . join ( "||" ) ;
662
665
for ( const path of tsconfigPathsForHash ) {
663
666
allContent += path ;
0 commit comments