Skip to content

Commit 9f0e538

Browse files
committed
[AUTOMATED]: Prettier Code Styling
1 parent abfe405 commit 9f0e538

32 files changed

+212
-86
lines changed

packages/firestore/src/api/database.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,6 @@ export class DocumentSnapshot implements firestore.DocumentSnapshot {
13871387

13881388
export class QueryDocumentSnapshot extends DocumentSnapshot
13891389
implements firestore.QueryDocumentSnapshot {
1390-
13911390
data(options?: SnapshotOptions): firestore.DocumentData {
13921391
const data = super.data(options);
13931392
assert(

packages/firestore/src/core/event_manager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export class EventManager implements SyncEngineListener {
7272

7373
listener.applyOnlineStateChange(this.onlineState);
7474

75-
if (queryInfo.viewSnap) {listener.onViewSnapshot(queryInfo.viewSnap);}
75+
if (queryInfo.viewSnap) {
76+
listener.onViewSnapshot(queryInfo.viewSnap);
77+
}
7678

7779
if (firstListen) {
7880
return this.syncEngine.listen(query).then(targetId => {

packages/firestore/src/core/firestore_client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,9 @@ export class FirestoreClient {
434434
onlineState,
435435
OnlineStateSource.RemoteStore
436436
);
437-
const sharedClientStateOnlineStateChangedHandler = (onlineState): void =>
437+
const sharedClientStateOnlineStateChangedHandler = (
438+
onlineState
439+
): void =>
438440
this.syncEngine.applyOnlineStateChange(
439441
onlineState,
440442
OnlineStateSource.SharedClientState

packages/firestore/src/core/query.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ export class Query {
310310
let comparedOnKeyField = false;
311311
for (const orderBy of this.orderBy) {
312312
const comp = orderBy.compare(d1, d2);
313-
if (comp !== 0) {return comp;}
313+
if (comp !== 0) {
314+
return comp;
315+
}
314316
comparedOnKeyField = comparedOnKeyField || orderBy.field.isKeyField();
315317
}
316318
// Assert that we actually compared by key

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,13 @@ export class SchemaConverter implements SimpleDbSchemaConverter {
270270
.store<DbDocumentMutationKey, DbDocumentMutation>(
271271
DbDocumentMutation.store
272272
)
273-
.iterate({ keysOnly: true }, ([_userID, encodedPath, _batchId], _) => {
274-
const path = decode(encodedPath);
275-
return addEntry(path.popLast());
276-
});
273+
.iterate(
274+
{ keysOnly: true },
275+
([_userID, encodedPath, _batchId], _) => {
276+
const path = decode(encodedPath);
277+
return addEntry(path.popLast());
278+
}
279+
);
277280
});
278281
}
279282
}

packages/firestore/src/local/local_store.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,9 @@ export class LocalStore {
458458
(targetId: TargetId, change: TargetChange) => {
459459
// Do not ref/unref unassigned targetIds - it may lead to leaks.
460460
let queryData = this.queryDataByTarget[targetId];
461-
if (!queryData) {return;}
461+
if (!queryData) {
462+
return;
463+
}
462464

463465
// When a global snapshot contains updates (either add or modify) we
464466
// can completely trust these updates as authoritative and blindly
@@ -616,10 +618,14 @@ export class LocalStore {
616618
change: TargetChange
617619
): boolean {
618620
// Avoid clearing any existing value
619-
if (newQueryData.resumeToken.length === 0) {return false;}
621+
if (newQueryData.resumeToken.length === 0) {
622+
return false;
623+
}
620624

621625
// Any resume token is interesting if there isn't one already.
622-
if (oldQueryData.resumeToken.length === 0) {return true;}
626+
if (oldQueryData.resumeToken.length === 0) {
627+
return true;
628+
}
623629

624630
// Don't allow resume token changes to be buffered indefinitely. This
625631
// allows us to be reasonably up-to-date after a crash and avoids needing
@@ -629,7 +635,9 @@ export class LocalStore {
629635
const timeDelta =
630636
newQueryData.snapshotVersion.toMicroseconds() -
631637
oldQueryData.snapshotVersion.toMicroseconds();
632-
if (timeDelta >= this.RESUME_TOKEN_MAX_AGE_MICROS) {return true;}
638+
if (timeDelta >= this.RESUME_TOKEN_MAX_AGE_MICROS) {
639+
return true;
640+
}
633641

634642
// Otherwise if the only thing that has changed about a target is its resume
635643
// token it's not worth persisting. Note that the RemoteStore keeps an

packages/firestore/src/local/memory_mutation_queue.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export class MemoryMutationQueue implements MutationQueue {
5858
private readonly referenceDelegate: ReferenceDelegate
5959
) {}
6060

61-
checkEmpty(_transaction: PersistenceTransaction): PersistencePromise<boolean> {
61+
checkEmpty(
62+
_transaction: PersistenceTransaction
63+
): PersistencePromise<boolean> {
6264
return PersistencePromise.resolve(this.mutationQueue.length === 0);
6365
}
6466

packages/firestore/src/local/persistence_promise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export class PersistencePromise<T> {
138138
return this.wrapUserFunction(() => nextFn(value));
139139
} else {
140140
// If there's no nextFn, then R must be the same as T
141-
return PersistencePromise.resolve<R>(value as unknown as R);
141+
return PersistencePromise.resolve<R>((value as unknown) as R);
142142
}
143143
}
144144

packages/firestore/src/model/document.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ export class NoDocument extends MaybeDocument {
162162
* document that was updated without a known base document).
163163
*/
164164
export class UnknownDocument extends MaybeDocument {
165-
166165
toString(): string {
167166
return `UnknownDocument(${this.key}, ${this.version})`;
168167
}

packages/firestore/src/model/document_set.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,21 @@ export class DocumentSet {
120120
}
121121

122122
isEqual(other: DocumentSet | null | undefined): boolean {
123-
if (!(other instanceof DocumentSet)) {return false;}
124-
if (this.size !== other.size) {return false;}
123+
if (!(other instanceof DocumentSet)) {
124+
return false;
125+
}
126+
if (this.size !== other.size) {
127+
return false;
128+
}
125129

126130
const thisIt = this.sortedSet.getIterator();
127131
const otherIt = other.sortedSet.getIterator();
128132
while (thisIt.hasNext()) {
129133
const thisDoc = thisIt.getNext().key;
130134
const otherDoc = otherIt.getNext().key;
131-
if (!thisDoc.isEqual(otherDoc)) {return false;}
135+
if (!thisDoc.isEqual(otherDoc)) {
136+
return false;
137+
}
132138
}
133139
return true;
134140
}

packages/firestore/src/model/field_value.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ function numericEquals(left: number, right: number): boolean {
257257
}
258258

259259
export class IntegerValue extends NumberValue {
260-
261260
isEqual(other: FieldValue): boolean {
262261
// NOTE: DoubleValue and IntegerValue instances may compareTo() the same,
263262
// but that doesn't make them equal via isEqual().
@@ -272,7 +271,6 @@ export class IntegerValue extends NumberValue {
272271
}
273272

274273
export class DoubleValue extends NumberValue {
275-
276274
static NAN = new DoubleValue(NaN);
277275
static POSITIVE_INFINITY = new DoubleValue(Infinity);
278276
static NEGATIVE_INFINITY = new DoubleValue(-Infinity);

packages/firestore/src/model/path.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,19 @@ abstract class Path {
180180
for (let i = 0; i < len; i++) {
181181
const left = p1.get(i);
182182
const right = p2.get(i);
183-
if (left < right) {return -1;}
184-
if (left > right) {return 1;}
183+
if (left < right) {
184+
return -1;
185+
}
186+
if (left > right) {
187+
return 1;
188+
}
189+
}
190+
if (p1.length < p2.length) {
191+
return -1;
192+
}
193+
if (p1.length > p2.length) {
194+
return 1;
185195
}
186-
if (p1.length < p2.length) {return -1;}
187-
if (p1.length > p2.length) {return 1;}
188196
return 0;
189197
}
190198
}

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ export class WebChannelConnection implements Connection {
332332
// WebChannel delivers message events as array. If batching is not enabled
333333
// (it's off by default) each message will be delivered alone, resulting in
334334
// a single element array.
335-
interface WebChannelResponse { data: Resp[] }
335+
interface WebChannelResponse {
336+
data: Resp[];
337+
}
336338

337339
unguardedEventListen<WebChannelResponse>(
338340
WebChannel.EventType.MESSAGE,

packages/firestore/src/remote/persistent_stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ export class PersistentWriteStream extends PersistentStream<
770770

771771
const request: WriteRequest = {
772772
// Protos are typed with string, but we support UInt8Array on Node
773-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
773+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
774774
streamToken: this.lastStreamToken as any,
775775
writes: mutations.map(mutation => this.serializer.toMutation(mutation))
776776
};

packages/firestore/src/remote/rpc_error.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,15 @@ export function mapCodeFromHttpStatus(status: number): Code {
287287
return Code.DEADLINE_EXCEEDED;
288288

289289
default:
290-
if (status >= 200 && status < 300) {return Code.OK;}
291-
if (status >= 400 && status < 500) {return Code.FAILED_PRECONDITION;}
292-
if (status >= 500 && status < 600) {return Code.INTERNAL;}
290+
if (status >= 200 && status < 300) {
291+
return Code.OK;
292+
}
293+
if (status >= 400 && status < 500) {
294+
return Code.FAILED_PRECONDITION;
295+
}
296+
if (status >= 500 && status < 600) {
297+
return Code.INTERNAL;
298+
}
293299
return Code.UNKNOWN;
294300
}
295301
}

packages/firestore/src/remote/serializer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,9 @@ export class JsonProtoSerializer {
11611161
}
11621162

11631163
private toFilter(filters: Filter[]): api.Filter | undefined {
1164-
if (filters.length === 0) {return;}
1164+
if (filters.length === 0) {
1165+
return;
1166+
}
11651167
const protos = filters.map(filter =>
11661168
filter instanceof RelationFilter
11671169
? this.toRelationFilter(filter)
@@ -1190,7 +1192,9 @@ export class JsonProtoSerializer {
11901192
}
11911193

11921194
private toOrder(orderBys: OrderBy[]): api.Order[] | undefined {
1193-
if (orderBys.length === 0) {return;}
1195+
if (orderBys.length === 0) {
1196+
return;
1197+
}
11941198
return orderBys.map(order => this.toPropertyOrder(order));
11951199
}
11961200

packages/firestore/src/util/api.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ import { Code, FirestoreError } from './error';
3131
* To also make all the static methods available, all properties of the
3232
* original constructor are copied to the new constructor.
3333
*/
34-
export function makeConstructorPrivate<T extends Function>(cls: T, optionalMessage?: string): T {
34+
export function makeConstructorPrivate<T extends Function>(
35+
cls: T,
36+
optionalMessage?: string
37+
): T {
3538
function PublicConstructor(): never {
3639
let error = 'This constructor is private.';
3740
if (optionalMessage) {

packages/firestore/src/util/array.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*/
2121
export function includes<T>(array: T[], value: T): boolean {
2222
for (let i = 0; i < array.length; i++) {
23-
if (array[i] === value) {return true;}
23+
if (array[i] === value) {
24+
return true;
25+
}
2426
}
2527
return false;
2628
}
@@ -30,7 +32,9 @@ export function includes<T>(array: T[], value: T): boolean {
3032
*/
3133
export function some<T>(array: T[], predicate: (t: T) => boolean): boolean {
3234
for (let i = 0; i < array.length; i++) {
33-
if (predicate(array[i])) {return true;}
35+
if (predicate(array[i])) {
36+
return true;
37+
}
3438
}
3539
return false;
3640
}

packages/firestore/src/util/misc.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ export class AutoId {
3535
}
3636

3737
export function primitiveComparator<T>(left: T, right: T): number {
38-
if (left < right) {return -1;}
39-
if (left > right) {return 1;}
38+
if (left < right) {
39+
return -1;
40+
}
41+
if (left > right) {
42+
return 1;
43+
}
4044
return 0;
4145
}
4246

packages/firestore/src/util/sorted_map.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ export class SortedMapIterator<K, V> {
197197
while (!node.isEmpty()) {
198198
cmp = startKey ? comparator(node.key, startKey) : 1;
199199
// flip the comparison if we're going in reverse
200-
if (isReverse) {cmp *= -1;}
200+
if (isReverse) {
201+
cmp *= -1;
202+
}
201203

202204
if (cmp < 0) {
203205
// This node is less than our start key. ignore it
@@ -255,7 +257,9 @@ export class SortedMapIterator<K, V> {
255257
}
256258

257259
peek(): Entry<K, V> | null {
258-
if (this.nodeStack.length === 0) {return null;}
260+
if (this.nodeStack.length === 0) {
261+
return null;
262+
}
259263

260264
const node = this.nodeStack[this.nodeStack.length - 1];
261265
return { key: node.key, value: node.value };
@@ -268,7 +272,7 @@ export class LLRBNode<K, V> {
268272
readonly left: LLRBNode<K, V> | LLRBEmptyNode<K, V>;
269273
readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>;
270274
readonly size: number;
271-
275+
272276
//Empty node is shared between all LLRB trees.
273277
// eslint-disable-next-line @typescript-eslint/no-explicit-any
274278
static EMPTY: LLRBEmptyNode<any, any> = null as any;
@@ -382,7 +386,9 @@ export class LLRBNode<K, V> {
382386
return LLRBNode.EMPTY;
383387
}
384388
let n: LLRBNode<K, V> = this;
385-
if (!n.left.isRed() && !n.left.left.isRed()) {n = n.moveRedLeft();}
389+
if (!n.left.isRed() && !n.left.left.isRed()) {
390+
n = n.moveRedLeft();
391+
}
386392
n = n.copy(null, null, null, (n.left as LLRBNode<K, V>).removeMin(), null);
387393
return n.fixUp();
388394
}
@@ -400,7 +406,9 @@ export class LLRBNode<K, V> {
400406
}
401407
n = n.copy(null, null, null, n.left.remove(key, comparator), null);
402408
} else {
403-
if (n.left.isRed()) {n = n.rotateRight();}
409+
if (n.left.isRed()) {
410+
n = n.rotateRight();
411+
}
404412
if (!n.right.isEmpty() && !n.right.isRed() && !n.right.left.isRed()) {
405413
n = n.moveRedRight();
406414
}
@@ -430,9 +438,15 @@ export class LLRBNode<K, V> {
430438
// Returns new tree after performing any needed rotations.
431439
private fixUp(): LLRBNode<K, V> {
432440
let n: LLRBNode<K, V> = this;
433-
if (n.right.isRed() && !n.left.isRed()) {n = n.rotateLeft();}
434-
if (n.left.isRed() && n.left.left.isRed()) {n = n.rotateRight();}
435-
if (n.left.isRed() && n.right.isRed()) {n = n.colorFlip();}
441+
if (n.right.isRed() && !n.left.isRed()) {
442+
n = n.rotateLeft();
443+
}
444+
if (n.left.isRed() && n.left.left.isRed()) {
445+
n = n.rotateRight();
446+
}
447+
if (n.left.isRed() && n.right.isRed()) {
448+
n = n.colorFlip();
449+
}
436450
return n;
437451
}
438452

0 commit comments

Comments
 (0)