Skip to content

Commit 4280552

Browse files
Fix prettierignore
1 parent 4f590b2 commit 4280552

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is pre-built and need not be formatted
22
packages/auth
33
packages/firebase/firebase*
4-
packages/firestore/scripts
4+
packages/firestore/scripts/*.js
55
dist

packages/firestore/scripts/prune-dts.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ function main(inputLocation: string, outputLocation: string): void {
4141
const sourceFile = program.getSourceFile(inputLocation)!;
4242
const result: ts.TransformationResult<ts.SourceFile> = ts.transform<
4343
ts.SourceFile
44-
>(sourceFile, [
45-
dropPrivateApiTransformer.bind(null, program, host )
46-
]);
44+
>(sourceFile, [dropPrivateApiTransformer.bind(null, program, host)]);
4745
const transformedSourceFile: ts.SourceFile = result.transformed[0];
4846
const content = printer.printFile(transformedSourceFile);
4947
fs.writeFileSync(outputLocation, content);
@@ -103,13 +101,18 @@ function verifyMatchingTypeArguments(
103101
privateType: ts.NodeWithTypeArguments,
104102
publicSymbol: ts.Symbol
105103
): boolean {
106-
if (!ts.isClassDeclaration(publicSymbol.valueDeclaration) || !ts.isInterfaceDeclaration(publicSymbol.valueDeclaration)) {
104+
if (
105+
!ts.isClassDeclaration(publicSymbol.valueDeclaration) ||
106+
!ts.isInterfaceDeclaration(publicSymbol.valueDeclaration)
107+
) {
107108
return false;
108109
}
109-
110-
const privateTypeArguments = (privateType.typeArguments as ts.TypeReferenceNode[] | undefined) ?? [];
111-
const publicTypeArguments = publicSymbol.valueDeclaration.typeParameters ?? [];
112-
110+
111+
const privateTypeArguments =
112+
(privateType.typeArguments as ts.TypeReferenceNode[] | undefined) ?? [];
113+
const publicTypeArguments =
114+
publicSymbol.valueDeclaration.typeParameters ?? [];
115+
113116
if (privateTypeArguments.length !== publicTypeArguments.length) {
114117
return false;
115118
}
@@ -154,7 +157,7 @@ function prunePrivateImports<
154157
sourceFile: ts.SourceFile,
155158
node: T
156159
): T {
157-
const typeChecker = program.getTypeChecker();
160+
const typeChecker = program.getTypeChecker();
158161
const currentType = typeChecker.getTypeAtLocation(node);
159162
const currentName = currentType?.symbol?.name;
160163

@@ -196,9 +199,10 @@ function prunePrivateImports<
196199
additionalMembers.push(
197200
...convertPropertiesForEnclosingClass(
198201
program,
199-
host,sourceFile,
202+
host,
203+
sourceFile,
200204
privateType.getProperties(),
201-
node,
205+
node
202206
)
203207
);
204208
}
@@ -242,18 +246,18 @@ function prunePrivateImports<
242246
* symbols if they are missing from `currentClass`. This allows us to merge
243247
* class hierarchies for classes whose inherited types are not part of the
244248
* public API.
245-
*
249+
*
246250
* This method relies on a private API in TypeScript's `codefix` package.
247251
*/
248252
function convertPropertiesForEnclosingClass(
249253
program: ts.Program,
250-
host: ts.CompilerHost,
254+
host: ts.CompilerHost,
251255
sourceFile: ts.SourceFile,
252256
parentClassSymbols: ts.Symbol[],
253-
currentClass: ts.ClassDeclaration | ts.InterfaceDeclaration,
257+
currentClass: ts.ClassDeclaration | ts.InterfaceDeclaration
254258
): Array<ts.NamedDeclaration> {
255259
const newMembers: ts.NamedDeclaration[] = [];
256-
// The `codefix` package is not public but it does exactly what we want. We
260+
// The `codefix` package is not public but it does exactly what we want. We
257261
// can explore adding a slimmed down version of this package to our repository
258262
// if this dependency should ever break.
259263
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -361,12 +365,7 @@ const dropPrivateApiTransformer = (
361365
) {
362366
// Remove any imports that reference internal APIs, while retaining
363367
// their public members.
364-
return prunePrivateImports(
365-
program,
366-
host,
367-
sourceFile,
368-
node
369-
);
368+
return prunePrivateImports(program, host, sourceFile, node);
370369
} else if (
371370
ts.isPropertyDeclaration(node) ||
372371
ts.isMethodDeclaration(node) ||

0 commit comments

Comments
 (0)