Skip to content

Commit fa69278

Browse files
committed
address mike's comments
1 parent 77ef770 commit fa69278

File tree

11 files changed

+22
-34
lines changed

11 files changed

+22
-34
lines changed

packages/firestore/src/api/database.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ import {
105105
UserDataConverter
106106
} from './user_data_converter';
107107

108-
// The objects that are a part of this API are exposed to third-parties as
109-
// compiled javascript so we want to flag our private members with a leading
110-
// underscore to discourage their use.
111-
112108
// settings() defaults:
113109
const DEFAULT_HOST = 'firestore.googleapis.com';
114110
const DEFAULT_SSL = true;
@@ -299,6 +295,9 @@ class FirestoreConfig {
299295
* The root reference to the database.
300296
*/
301297
export class Firestore implements firestore.FirebaseFirestore, FirebaseService {
298+
// The objects that are a part of this API are exposed to third-parties as
299+
// compiled javascript so we want to flag our private members with a leading
300+
// underscore to discourage their use.
302301
private readonly _config: FirestoreConfig;
303302
readonly _databaseId: DatabaseId;
304303

packages/firestore/src/api/field_value.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
* An opaque base class for FieldValue sentinel objects in our public API,
3030
* with public static methods for creating said sentinel objects.
3131
*/
32-
// We use this as a base class.
3332
export abstract class FieldValueImpl implements firestore.FieldValue {
3433
protected constructor(readonly _methodName: string) {}
3534

packages/firestore/src/core/sync_engine.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
248248
.then(remoteKeys => {
249249
const view = new View(query, remoteKeys);
250250
const viewDocChanges = view.computeDocChanges(docs);
251-
// Prettier formats this exceed 100 characters.
252251
const synthesizedTargetChange = TargetChange.createSynthesizedTargetChangeForCurrentChange(
253252
queryData.targetId,
254253
current && this.onlineState !== OnlineState.Offline
@@ -976,7 +975,6 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
976975
case 'not-current': {
977976
return this.localStore.getNewDocumentChanges().then(
978977
async changes => {
979-
// tslint and prettier disagree about their preferred line length.
980978
const synthesizedRemoteEvent = RemoteEvent.createSynthesizedRemoteEventForCurrentChange(
981979
targetId,
982980
state === 'current'

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
165165
// mutation batch.
166166
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972
167167

168-
// We write an empty object to obtain key
169-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
168+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We write an empty object to obtain key
170169
return mutationStore.add({} as any).next(batchId => {
171170
assert(typeof batchId === 'number', 'Auto-generated key is not a number');
172171

packages/firestore/src/local/persistence_promise.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ export type Rejector = (error: Error) => void;
4242
export class PersistencePromise<T> {
4343
// NOTE: next/catchCallback will always point to our own wrapper functions,
4444
// not the user's raw next() or catch() callbacks.
45-
// Accept any result type for the next call in the Promise chain.
4645
private nextCallback: FulfilledHandler<T, unknown> = null;
47-
// Accept any result type for the error handler.
4846
private catchCallback: RejectedHandler<unknown> = null;
4947

5048
// When the operation resolves, we'll set result or error and mark isDone.
@@ -168,8 +166,7 @@ export class PersistencePromise<T> {
168166
}
169167

170168
static waitFor(
171-
// Accept all Promise types in waitFor().
172-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
169+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Accept all Promise types in waitFor().
173170
all: { forEach: (cb: (el: PersistencePromise<any>) => void) => void }
174171
): PersistencePromise<void> {
175172
return new PersistencePromise<void>((resolve, reject) => {

packages/firestore/src/local/simple_db.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,7 @@ export class SimpleDbStore<
485485
*/
486486
get(key: KeyType): PersistencePromise<ValueType | null> {
487487
const request = this.store.get(key);
488-
// We're doing an unsafe cast to ValueType.
489-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
488+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We're doing an unsafe cast to ValueType.
490489
return wrapRequest<any>(request).next(result => {
491490
// Normalize nonexistence to null.
492491
if (result === undefined) {

packages/firestore/src/platform/config/goog_module_config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import { configureForStandalone } from '../config';
1919

20-
/* eslint-disable camelcase */
2120

2221
/**
2322
* Magic variable that is used to export the Firestore namespace.
@@ -30,8 +29,9 @@ import { configureForStandalone } from '../config';
3029
* Note that name was chosen arbitrarily but was intended to not conflict with
3130
* any other variable in scope.
3231
*/
32+
// eslint-disable-next-line camelcase
3333
declare let __firestore_exports__: { [key: string]: {} };
34-
34+
// eslint-disable-next-line camelcase
3535
if (typeof __firestore_exports__ !== 'undefined') {
3636
configureForStandalone(__firestore_exports__);
3737
} else {

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ export class WebChannelConnection implements Connection {
9797
const url = this.makeUrl(rpcName);
9898

9999
return new Promise((resolve: Resolver<Resp>, reject: Rejecter) => {
100-
// XhrIo doesn't have TS typings.
101-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
100+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, XhrIo doesn't have TS typings.
102101
const xhr: any = new XhrIo();
103102
xhr.listenOnce(EventType.COMPLETE, () => {
104103
try {

packages/firestore/src/util/error.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import * as firestore from '@firebase/firestore-types';
2424
export type Code = firestore.FirestoreErrorCode;
2525

2626
// TODO(mcg): Change to a string enum once we've upgraded to typescript 2.4.
27-
// Intended to look like a TS 2.4 enum
2827
export const Code = {
2928
// Causes are copied from:
3029
// https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,19 +1126,18 @@ function genericLocalStoreTests(
11261126
);
11271127
});
11281128

1129-
/* eslint-disable camelcase */
11301129
it('holds back only non-idempotent transforms', () => {
11311130
const query = Query.atPath(path('foo'));
11321131
return (
11331132
expectLocalStore()
11341133
.afterAllocatingQuery(query)
11351134
.toReturnTargetId(2)
1136-
.after(setMutation('foo/bar', { sum: 0, array_union: [] }))
1135+
.after(setMutation('foo/bar', { sum: 0, arrayUnion: [] }))
11371136
.toReturnChanged(
11381137
doc(
11391138
'foo/bar',
11401139
0,
1141-
{ sum: 0, array_union: [] },
1140+
{ sum: 0, arrayUnion: [] },
11421141
{ hasLocalMutations: true }
11431142
)
11441143
)
@@ -1147,27 +1146,27 @@ function genericLocalStoreTests(
11471146
doc(
11481147
'foo/bar',
11491148
1,
1150-
{ sum: 0, array_union: [] },
1149+
{ sum: 0, arrayUnion: [] },
11511150
{ hasCommittedMutations: true }
11521151
)
11531152
)
11541153
.afterRemoteEvent(
1155-
docAddedRemoteEvent(doc('foo/bar', 1, { sum: 0, array_union: [] }), [
1154+
docAddedRemoteEvent(doc('foo/bar', 1, { sum: 0, arrayUnion: [] }), [
11561155
2
11571156
])
11581157
)
1159-
.toReturnChanged(doc('foo/bar', 1, { sum: 0, array_union: [] }))
1158+
.toReturnChanged(doc('foo/bar', 1, { sum: 0, arrayUnion: [] }))
11601159
.afterMutations([
11611160
transformMutation('foo/bar', { sum: PublicFieldValue.increment(1) }),
11621161
transformMutation('foo/bar', {
1163-
array_union: PublicFieldValue.arrayUnion('foo')
1162+
arrayUnion: PublicFieldValue.arrayUnion('foo')
11641163
})
11651164
])
11661165
.toReturnChanged(
11671166
doc(
11681167
'foo/bar',
11691168
1,
1170-
{ sum: 1, array_union: ['foo'] },
1169+
{ sum: 1, arrayUnion: ['foo'] },
11711170
{ hasLocalMutations: true }
11721171
)
11731172
)
@@ -1176,22 +1175,21 @@ function genericLocalStoreTests(
11761175
// backend value.
11771176
.afterRemoteEvent(
11781177
docUpdateRemoteEvent(
1179-
doc('foo/bar', 2, { sum: 1337, array_union: ['bar'] }),
1178+
doc('foo/bar', 2, { sum: 1337, arrayUnion: ['bar'] }),
11801179
[2]
11811180
)
11821181
)
11831182
.toReturnChanged(
11841183
doc(
11851184
'foo/bar',
11861185
2,
1187-
{ sum: 1, array_union: ['bar', 'foo'] },
1186+
{ sum: 1, arrayUnion: ['bar', 'foo'] },
11881187
{ hasLocalMutations: true }
11891188
)
11901189
)
11911190
.finish()
11921191
);
11931192
});
1194-
/* eslint-enable camelcase */
11951193

11961194
it('handles MergeMutation with Transform -> RemoteEvent', () => {
11971195
const query = Query.atPath(path('foo'));

packages/firestore/test/unit/remote/remote_event.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ import {
4545
} from '../../util/helpers';
4646

4747
/* eslint-disable @typescript-eslint/prefer-interface */
48-
type TargetMap = {
48+
interface TargetMap {
4949
[targetId: number]: QueryData;
5050
};
51-
type PendingTargetResponses = {
52-
[targetId: number]: number;
51+
interface PendingTargetResponses {
52+
[targetId: string]: number;
5353
};
5454
/* eslint-enable @typescript-eslint/prefer-interface */
5555

@@ -58,6 +58,7 @@ function listens(...targetIds: TargetId[]): TargetMap {
5858
for (const target of targetIds) {
5959
targets[target] = queryData(target, QueryPurpose.Listen, 'coll');
6060
}
61+
6162
return targets;
6263
}
6364

0 commit comments

Comments
 (0)