Skip to content

Commit 8032d55

Browse files
schmidt-sebastianFeiyang1
authored andcommitted
Running prettier (#1993)
* Running prettier for Firestore * Fix everything
1 parent 5d676e1 commit 8032d55

File tree

22 files changed

+67
-128
lines changed

22 files changed

+67
-128
lines changed

packages/app/src/firebaseApp.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,10 @@ export class FirebaseAppImpl implements FirebaseApp {
119119
.map(service => service.INTERNAL!.delete())
120120
);
121121
})
122-
.then(
123-
(): void => {
124-
this.isDeleted_ = true;
125-
this.services_ = {};
126-
}
127-
);
122+
.then((): void => {
123+
this.isDeleted_ = true;
124+
this.services_ = {};
125+
});
128126
}
129127

130128
/**

packages/app/src/lite/firebaseAppLite.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ export class FirebaseAppLiteImpl implements FirebaseApp {
101101
.map(service => service.INTERNAL!.delete())
102102
);
103103
})
104-
.then(
105-
(): void => {
106-
this.isDeleted_ = true;
107-
this.services_ = {};
108-
}
109-
);
104+
.then((): void => {
105+
this.isDeleted_ = true;
106+
this.services_ = {};
107+
});
110108
}
111109

112110
/**

packages/database/src/core/SyncPoint.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ export class SyncPoint {
130130
}
131131
const viewCache = new ViewCache(
132132
new CacheNode(
133-
/** @type {!Node} */ (eventCache),
133+
/** @type {!Node} */ eventCache,
134134
eventCacheComplete,
135135
false
136136
),
137137
new CacheNode(
138-
/** @type {!Node} */ (serverCache),
138+
/** @type {!Node} */ serverCache,
139139
serverCacheComplete,
140140
false
141141
)

packages/database/src/core/view/EventRegistration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class ChildEventRegistration implements EventRegistration {
220220
*/
221221
createEvent(change: Change, query: Query): DataEvent {
222222
assert(change.childName != null, 'Child events should have a childName.');
223-
const ref = query.getRef().child(/** @type {!string} */ (change.childName));
223+
const ref = query.getRef().child(/** @type {!string} */ change.childName);
224224
const index = query.getQueryParams().getIndex();
225225
return new DataEvent(
226226
change.type as any,

packages/database/src/core/view/ViewProcessor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ export class ViewProcessor {
206206
accumulator.length > 0 ||
207207
!oldViewCache.getEventCache().isFullyInitialized() ||
208208
(isLeafOrEmpty &&
209-
!eventSnap
210-
.getNode()
211-
.equals(/** @type {!Node} */ (oldCompleteSnap))) ||
209+
!eventSnap.getNode().equals(/** @type {!Node} */ oldCompleteSnap)) ||
212210
!eventSnap
213211
.getNode()
214212
.getPriority()

packages/database/src/realtime/WebSocketConnection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ export class WebSocketConnection implements Transport {
149149
// UA Format: Firebase/<wire_protocol>/<sdk_version>/<platform>/<device>
150150
const options: { [k: string]: object } = {
151151
headers: {
152-
'User-Agent': `Firebase/${PROTOCOL_VERSION}/${SDK_VERSION}/${
153-
process.platform
154-
}/${device}`
152+
'User-Agent': `Firebase/${PROTOCOL_VERSION}/${SDK_VERSION}/${process.platform}/${device}`
155153
}
156154
};
157155

packages/firestore/src/api/database.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ class FirestoreSettings {
249249
) {
250250
throw new FirestoreError(
251251
Code.INVALID_ARGUMENT,
252-
`cacheSizeBytes must be at least ${
253-
LruParams.MINIMUM_CACHE_SIZE_BYTES
254-
}`
252+
`cacheSizeBytes must be at least ${LruParams.MINIMUM_CACHE_SIZE_BYTES}`
255253
);
256254
} else {
257255
this.cacheSizeBytes = settings.cacheSizeBytes;
@@ -686,9 +684,7 @@ export class Transaction implements firestore.Transaction {
686684
);
687685
} else {
688686
throw fail(
689-
`BatchGetDocumentsRequest returned unexpected document type: ${
690-
doc.constructor.name
691-
}`
687+
`BatchGetDocumentsRequest returned unexpected document type: ${doc.constructor.name}`
692688
);
693689
}
694690
});
@@ -1361,9 +1357,7 @@ export class DocumentSnapshot implements firestore.DocumentSnapshot {
13611357
log.error(
13621358
`Document ${this._key.path} contains a document ` +
13631359
`reference within a different database (` +
1364-
`${value.databaseId.projectId}/${
1365-
value.databaseId.database
1366-
}) which is not ` +
1360+
`${value.databaseId.projectId}/${value.databaseId.database}) which is not ` +
13671361
`supported. It will be treated as a reference in the current ` +
13681362
`database (${database.projectId}/${database.database}) ` +
13691363
`instead.`
@@ -1917,9 +1911,7 @@ export class Query implements firestore.Query {
19171911
Code.INVALID_ARGUMENT,
19181912
`Invalid query. When querying a collection group by ` +
19191913
`FieldPath.documentId(), the value provided must result in a valid document path, ` +
1920-
`but '${path}' is not because it has an odd number of segments (${
1921-
path.length
1922-
}).`
1914+
`but '${path}' is not because it has an odd number of segments (${path.length}).`
19231915
);
19241916
}
19251917
return new RefValue(this.firestore._databaseId, new DocumentKey(path));

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
322322
}
323323
assert(
324324
mutation.userId === this.userId,
325-
`Unexpected user '${
326-
mutation.userId
327-
}' for mutation batch ${batchId}`
325+
`Unexpected user '${mutation.userId}' for mutation batch ${batchId}`
328326
);
329327
results.push(this.serializer.fromDbMutationBatch(mutation!));
330328
});
@@ -455,9 +453,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
455453
}
456454
assert(
457455
mutation.userId === this.userId,
458-
`Unexpected user '${
459-
mutation.userId
460-
}' for mutation batch ${batchId}`
456+
`Unexpected user '${mutation.userId}' for mutation batch ${batchId}`
461457
);
462458
results.push(this.serializer.fromDbMutationBatch(mutation!));
463459
})

packages/firestore/src/local/lru_garbage_collector.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,7 @@ export class LruGarbageCollector {
351351
log.debug(
352352
'LruGarbageCollector',
353353
`Garbage collection skipped; Cache size ${cacheSize} ` +
354-
`is lower than threshold ${
355-
this.params.cacheSizeCollectionThreshold
356-
}`
354+
`is lower than threshold ${this.params.cacheSizeCollectionThreshold}`
357355
);
358356
return GC_DID_NOT_RUN;
359357
} else {
@@ -385,9 +383,7 @@ export class LruGarbageCollector {
385383
log.debug(
386384
'LruGarbageCollector',
387385
'Capping sequence numbers to collect down ' +
388-
`to the maximum of ${
389-
this.params.maximumSequenceNumbersToCollect
390-
} ` +
386+
`to the maximum of ${this.params.maximumSequenceNumbersToCollect} ` +
391387
`from ${sequenceNumbers}`
392388
);
393389
sequenceNumbersToCollect = this.params

packages/firestore/src/local/shared_client_state.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,7 @@ export class WebStorageSharedClientState implements SharedClientState {
936936

937937
/** Assembles the key for a mutation batch in WebStorage */
938938
private toWebStorageMutationBatchKey(batchId: BatchId): string {
939-
let mutationKey = `${MUTATION_BATCH_KEY_PREFIX}_${
940-
this.persistenceKey
941-
}_${batchId}`;
939+
let mutationKey = `${MUTATION_BATCH_KEY_PREFIX}_${this.persistenceKey}_${batchId}`;
942940

943941
if (this.currentUser.isAuthenticated()) {
944942
mutationKey += `_${this.currentUser.uid}`;

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ export class WebChannelConnection implements Connection {
206206
messageUrlParams: {
207207
// This param is used to improve routing and project isolation by the
208208
// backend and must be included in every request.
209-
database: `projects/${this.databaseId.projectId}/databases/${
210-
this.databaseId.database
211-
}`
209+
database: `projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`
212210
},
213211
sendRawJson: true,
214212
supportsCrossDomainXhr: true,

packages/firestore/src/platform_node/grpc_connection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ const LOG_TAG = 'Connection';
3939
// TODO(b/38203344): The SDK_VERSION is set independently from Firebase because
4040
// we are doing out-of-band releases. Once we release as part of Firebase, we
4141
// should use the Firebase version instead.
42-
const X_GOOG_API_CLIENT_VALUE = `gl-node/${
43-
process.versions.node
44-
} fire/${SDK_VERSION} grpc/${grpcVersion}`;
42+
const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${SDK_VERSION} grpc/${grpcVersion}`;
4543

4644
function createMetadata(
4745
databaseInfo: DatabaseInfo,

packages/firestore/test/unit/local/web_storage_shared_client_state.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ const TEST_ERROR = new FirestoreError('internal', 'Test Error');
5555

5656
function mutationKey(user: User, batchId: BatchId): string {
5757
if (user.isAuthenticated()) {
58-
return `firestore_mutations_${TEST_PERSISTENCE_PREFIX}_${batchId}_${
59-
user.uid
60-
}`;
58+
return `firestore_mutations_${TEST_PERSISTENCE_PREFIX}_${batchId}_${user.uid}`;
6159
} else {
6260
return `firestore_mutations_${TEST_PERSISTENCE_PREFIX}_${batchId}`;
6361
}

packages/firestore/test/unit/specs/limbo_spec.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,20 +439,21 @@ describeSpec('Limbo Documents:', [], () => {
439439
// This tests verifies that a document is consistent between views, even
440440
// if the document is only in Limbo in one of them.
441441
const originalQuery = Query.atPath(path('collection'));
442-
const filteredQuery = Query.atPath(path('collection'))
443-
.addFilter(filter('matches', '==', true));
442+
const filteredQuery = Query.atPath(path('collection')).addFilter(
443+
filter('matches', '==', true)
444+
);
444445

445446
const docA = doc('collection/a', 1000, { matches: true });
446447
const docADirty = doc(
447448
'collection/a',
448449
1000,
449-
{ matches: true },
450+
{ matches: true },
450451
{ hasCommittedMutations: true }
451452
);
452453
const docBDirty = doc(
453454
'collection/b',
454455
1001,
455-
{ matches: true },
456+
{ matches: true },
456457
{ hasCommittedMutations: true }
457458
);
458459

packages/firestore/test/unit/specs/limit_spec.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ describeSpec('Limits:', [], () => {
165165
const limitQuery = Query.atPath(path('collection'))
166166
.addFilter(filter('matches', '==', true))
167167
.withLimit(2);
168-
const doc1 = doc('collection/a', 1001, { matches: true });
169-
const doc2 = doc('collection/b', 1002, { matches: true });
170-
const doc3 = doc('collection/c', 1000, { matches: true });
168+
const doc1 = doc('collection/a', 1001, { matches: true });
169+
const doc2 = doc('collection/b', 1002, { matches: true });
170+
const doc3 = doc('collection/c', 1000, { matches: true });
171171
return spec()
172172
.withGCEnabled(false)
173173
.userListens(fullQuery)
@@ -176,7 +176,7 @@ describeSpec('Limits:', [], () => {
176176
.userUnlistens(fullQuery)
177177
.userListens(limitQuery)
178178
.expectEvents(limitQuery, { added: [doc1, doc2], fromCache: true })
179-
.userSets('collection/a', { matches: false })
179+
.userSets('collection/a', { matches: false })
180180
.expectEvents(limitQuery, {
181181
added: [doc3],
182182
removed: [doc1],

packages/installations/src/functions/delete-installation.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,16 @@ import { ERROR_FACTORY, ErrorCode } from '../util/errors';
3030
export async function deleteInstallation(app: FirebaseApp): Promise<void> {
3131
const appConfig = extractAppConfig(app);
3232

33-
const entry = await update(
34-
appConfig,
35-
(
36-
oldEntry?: InstallationEntry
37-
):
38-
| InProgressInstallationEntry
39-
| RegisteredInstallationEntry
40-
| undefined => {
41-
if (
42-
oldEntry &&
43-
oldEntry.registrationStatus === RequestStatus.NOT_STARTED
44-
) {
45-
// Delete the unregistered entry without sending a deleteInstallation request.
46-
return undefined;
47-
}
48-
return oldEntry;
33+
const entry = await update(appConfig, (oldEntry?: InstallationEntry):
34+
| InProgressInstallationEntry
35+
| RegisteredInstallationEntry
36+
| undefined => {
37+
if (oldEntry && oldEntry.registrationStatus === RequestStatus.NOT_STARTED) {
38+
// Delete the unregistered entry without sending a deleteInstallation request.
39+
return undefined;
4940
}
50-
);
41+
return oldEntry;
42+
});
5143

5244
if (entry) {
5345
if (entry.registrationStatus === RequestStatus.IN_PROGRESS) {

packages/messaging/test/controller-get-token.test.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
190190

191191
servicesToTest.forEach(serviceClass => {
192192
vapidSetupToTest.forEach(vapidSetup => {
193-
it(`should get saved token in ${
194-
serviceClass.name
195-
} for ${vapidSetup} VAPID setup`, async () => {
193+
it(`should get saved token in ${serviceClass.name} for ${vapidSetup} VAPID setup`, async () => {
196194
const regPromise = generateFakeReg();
197195
const subscription = makeFakeSubscription();
198196
mockGetReg(regPromise);
@@ -226,9 +224,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
226224
});
227225
});
228226

229-
it(`should get saved token with custom VAPID in ${
230-
serviceClass.name
231-
}`, async () => {
227+
it(`should get saved token with custom VAPID in ${serviceClass.name}`, async () => {
232228
const registration = generateFakeReg();
233229
const subscription = makeFakeSubscription();
234230
mockGetReg(Promise.resolve(registration));
@@ -296,9 +292,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
296292

297293
servicesToTest.forEach(serviceClass => {
298294
vapidSetupToTest.forEach(vapidSetup => {
299-
it(`should get a new token in ${
300-
serviceClass.name
301-
} for ${vapidSetup} VAPID setup`, async () => {
295+
it(`should get a new token in ${serviceClass.name} for ${vapidSetup} VAPID setup`, async () => {
302296
const regPromise = generateFakeReg();
303297
const subscription = makeFakeSubscription();
304298
mockGetReg(regPromise);
@@ -372,9 +366,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
372366
assert.equal(tokenModelArgs[0].fcmPushSet, TOKEN_DETAILS.pushSet);
373367
});
374368

375-
it(`should get a new token in ${
376-
serviceClass.name
377-
} if PushSubscription details have changed`, async () => {
369+
it(`should get a new token in ${serviceClass.name} if PushSubscription details have changed`, async () => {
378370
// Stubs
379371
const deleteTokenStub = sandbox.stub(
380372
TokenDetailsModel.prototype,
@@ -452,9 +444,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
452444
});
453445

454446
servicesToTest.forEach(serviceClass => {
455-
it(`should get new token if VAPID details are updated in ${
456-
serviceClass.name
457-
}`, async () => {
447+
it(`should get new token if VAPID details are updated in ${serviceClass.name}`, async () => {
458448
const regPromise = generateFakeReg();
459449
const subscription = makeFakeSubscription();
460450
mockGetReg(regPromise);
@@ -535,9 +525,7 @@ describe('Firebase Messaging > *Controller.getToken()', () => {
535525
});
536526

537527
servicesToTest.forEach(serviceClass => {
538-
it(`should handle update token errors in ${
539-
serviceClass.name
540-
}`, async () => {
528+
it(`should handle update token errors in ${serviceClass.name}`, async () => {
541529
const regPromise = generateFakeReg();
542530
const subscription = makeFakeSubscription();
543531
mockGetReg(regPromise);

packages/performance/src/resources/trace.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@ export class Trace implements PerformanceTrace {
6060
traceMeasureName?: string
6161
) {
6262
if (!this.isAuto) {
63-
this.traceStartMark = `${TRACE_START_MARK_PREFIX}-${this.randomId}-${
64-
this.name
65-
}`;
66-
this.traceStopMark = `${TRACE_STOP_MARK_PREFIX}-${this.randomId}-${
67-
this.name
68-
}`;
63+
this.traceStartMark = `${TRACE_START_MARK_PREFIX}-${this.randomId}-${this.name}`;
64+
this.traceStopMark = `${TRACE_STOP_MARK_PREFIX}-${this.randomId}-${this.name}`;
6965
this.traceMeasure =
7066
traceMeasureName ||
7167
`${TRACE_MEASURE_PREFIX}-${this.randomId}-${this.name}`;

packages/storage/src/implementation/blob.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ export class FbsBlob {
112112
}
113113
);
114114
let finalLength = 0;
115-
uint8Arrays.forEach(
116-
(array: Uint8Array): void => {
117-
finalLength += array.byteLength;
118-
}
119-
);
115+
uint8Arrays.forEach((array: Uint8Array): void => {
116+
finalLength += array.byteLength;
117+
});
120118
const merged = new Uint8Array(finalLength);
121119
let index = 0;
122120
uint8Arrays.forEach((array: Uint8Array) => {

0 commit comments

Comments
 (0)