88 PackageJsonDependency ,
99 TypingsDataRaw ,
1010 TypingsVersionsRaw ,
11- DirectoryParsedTypingVersion
11+ DirectoryParsedTypingVersion ,
1212} from "../packages" ;
1313import { getAllowedPackageJsonDependencies } from "./settings" ;
1414import {
@@ -26,7 +26,7 @@ import {
2626 unmangleScopedPackage ,
2727 removeVersionFromPackageName ,
2828 hasVersionNumberInMapping ,
29- mangleScopedPackage
29+ mangleScopedPackage ,
3030} from "@definitelytyped/utils" ;
3131import { TypeScriptVersion } from "@definitelytyped/typescript-versions" ;
3232
@@ -58,7 +58,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
5858 }
5959 const [ rootDirectoryLs , olderVersionDirectories ] = split < string , OlderVersionDir > (
6060 fs . readdir ( ) ,
61- fileOrDirectoryName => {
61+ ( fileOrDirectoryName ) => {
6262 const version = parseVersionFromDirectoryName ( fileOrDirectoryName ) ;
6363 return version === undefined ? undefined : { directoryName : fileOrDirectoryName , version } ;
6464 }
@@ -68,7 +68,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
6868
6969 const latestData : TypingsDataRaw = {
7070 libraryVersionDirectoryName : undefined ,
71- ...( await combineDataForAllTypesVersions ( packageName , rootDirectoryLs , fs , undefined ) )
71+ ...( await combineDataForAllTypesVersions ( packageName , rootDirectoryLs , fs , undefined ) ) ,
7272 } ;
7373
7474 const older = await Promise . all (
@@ -87,7 +87,7 @@ export async function getTypingInfo(packageName: string, fs: FS): Promise<Typing
8787 const ls = fs . readdir ( directoryName ) ;
8888 const data : TypingsDataRaw = {
8989 libraryVersionDirectoryName : formatTypingVersion ( directoryVersion ) ,
90- ...( await combineDataForAllTypesVersions ( packageName , ls , fs . subDir ( directoryName ) , directoryVersion ) )
90+ ...( await combineDataForAllTypesVersions ( packageName , ls , fs . subDir ( directoryName ) , directoryVersion ) ) ,
9191 } ;
9292
9393 if ( ! matchesVersion ( data , directoryVersion , considerLibraryMinorVersion ) ) {
@@ -122,8 +122,8 @@ interface LsMinusTypesVersionsAndPackageJson {
122122 readonly hasPackageJson : boolean ;
123123}
124124function 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 ) => {
127127 const match = / ^ t s ( \d + \. \d + ) $ / . exec ( fileOrDirectoryName ) ;
128128 if ( match === null ) {
129129 return undefined ;
@@ -159,7 +159,7 @@ export function parseVersionFromDirectoryName(
159159 }
160160 return {
161161 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)
163163 } ;
164164}
165165
@@ -174,7 +174,7 @@ export function tryParsePackageVersion(versionString: string | undefined): Depen
174174 }
175175 return {
176176 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)
178178 } ;
179179}
180180
@@ -204,7 +204,7 @@ async function combineDataForAllTypesVersions(
204204 libraryMinorVersion,
205205 typeScriptVersion : minTsVersion ,
206206 libraryName,
207- projects
207+ projects,
208208 } = parseHeaderOrFail ( readFileAndThrowOnBOM ( "index.d.ts" , fs ) ) ;
209209
210210 const dataForRoot = getTypingDataForSingleTypesVersion (
@@ -215,7 +215,7 @@ async function combineDataForAllTypesVersions(
215215 fs ,
216216 directoryVersion
217217 ) ;
218- const dataForOtherTypesVersions = typesVersions . map ( tsVersion => {
218+ const dataForOtherTypesVersions = typesVersions . map ( ( tsVersion ) => {
219219 const subFs = fs . subDir ( `ts${ tsVersion } ` ) ;
220220 return getTypingDataForSingleTypesVersion (
221221 tsVersion ,
@@ -242,7 +242,7 @@ async function combineDataForAllTypesVersions(
242242
243243 const files = Array . from (
244244 flatMap ( allTypesVersions , ( { typescriptVersion, declFiles } ) =>
245- declFiles . map ( file => ( typescriptVersion === undefined ? file : `ts${ typescriptVersion } /${ file } ` ) )
245+ declFiles . map ( ( file ) => ( typescriptVersion === undefined ? file : `ts${ typescriptVersion } /${ file } ` ) )
246246 )
247247 ) ;
248248
@@ -258,25 +258,25 @@ async function combineDataForAllTypesVersions(
258258 typesVersions,
259259 files,
260260 license,
261- dependencies : Object . assign ( { } , ...allTypesVersions . map ( v => v . dependencies ) ) ,
261+ dependencies : Object . assign ( { } , ...allTypesVersions . map ( ( v ) => v . dependencies ) ) ,
262262 testDependencies : getAllUniqueValues < "testDependencies" , string > ( allTypesVersions , "testDependencies" ) ,
263- pathMappings : Object . assign ( { } , ...allTypesVersions . map ( v => v . pathMappings ) ) ,
263+ pathMappings : Object . assign ( { } , ...allTypesVersions . map ( ( v ) => v . pathMappings ) ) ,
264264 packageJsonDependencies,
265265 contentHash : hash (
266266 hasPackageJson ? [ ...files , packageJsonName ] : files ,
267- mapDefined ( allTypesVersions , a => a . tsconfigPathsForHash ) ,
267+ mapDefined ( allTypesVersions , ( a ) => a . tsconfigPathsForHash ) ,
268268 fs
269269 ) ,
270270 globals : getAllUniqueValues < "globals" , string > ( allTypesVersions , "globals" ) ,
271271 declaredModules : getAllUniqueValues < "declaredModules" , string > ( allTypesVersions , "declaredModules" ) ,
272272 imports : checkPackageJsonImports ( packageJson . imports , packageJsonName ) ,
273273 exports : checkPackageJsonExportsAndAddPJsonEntry ( packageJson . exports , packageJsonName ) ,
274- type : checkPackageJsonType ( packageJson . type , packageJsonName )
274+ type : checkPackageJsonType ( packageJson . type , packageJsonName ) ,
275275 } ;
276276}
277277
278278function 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 ] ) ) ;
280280}
281281
282282interface TypingDataFromIndividualTypeScriptVersion {
@@ -332,19 +332,22 @@ function getTypingDataForSingleTypesVersion(
332332 checkAllFilesUsed ( ls , usedFiles , otherFiles , packageName , fs ) ;
333333 for ( const untestedTypeFile of filter (
334334 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" )
336336 ) ) {
337337 // add d.ts files from OTHER_FILES.txt in order get their dependencies
338338 // tslint:disable-next-line:non-literal-fs-path -- Not a reference to the fs package
339339 types . set ( untestedTypeFile , createSourceFile ( untestedTypeFile , fs . readFile ( untestedTypeFile ) ) ) ;
340340 }
341341
342342 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 ) ) ) ;
344344 // 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 ) ) ) ;
346346 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+ )
348351 ) ;
349352
350353 const { paths } = tsconfig . compilerOptions ;
@@ -373,7 +376,7 @@ function getTypingDataForSingleTypesVersion(
373376 globals,
374377 declaredModules,
375378 declFiles : sort ( types . keys ( ) ) ,
376- tsconfigPathsForHash
379+ tsconfigPathsForHash,
377380 } ;
378381}
379382
@@ -494,7 +497,7 @@ Other d.ts files must either be referenced through index.d.ts, tests, or added t
494497}
495498
496499function 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 ] / ) ) ;
498501}
499502
500503interface TsConfig {
@@ -633,7 +636,7 @@ const nodeBuiltins: ReadonlySet<string> = new Set([
633636 "util" ,
634637 "v8" ,
635638 "vm" ,
636- "zlib"
639+ "zlib" ,
637640] ) ;
638641
639642function parseDependencyVersionFromPath (
@@ -657,7 +660,7 @@ function withoutEnd(s: string, end: string): string | undefined {
657660}
658661
659662function 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 ) } ` ) ;
661664 let allContent = fileContents . join ( "||" ) ;
662665 for ( const path of tsconfigPathsForHash ) {
663666 allContent += path ;
0 commit comments