Skip to content

Commit 453677f

Browse files
Adding no-unused-vars to TSLint (#493)
1 parent a1e346f commit 453677f

28 files changed

+43
-84
lines changed

packages/firestore/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"scripts": {
77
"dev": "gulp dev",
8-
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
8+
"lint": "tslint -p tsconfig.json -c tslint.json src/**/*.ts test/**/*.ts",
9+
"lint:fix": "tslint --fix -p tsconfig.json -c tslint.json src/**/*.ts test/**/*.ts",
910
"test": "run-s lint test:all",
1011
"test:all": "run-p test:browser test:node",
1112
"test:browser": "karma start --single-run",

packages/firestore/src/api/credentials.ts

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { User } from '../auth/user';
1818
import { assert, fail } from '../util/assert';
1919
import { Code, FirestoreError } from '../util/error';
20-
import { AnyJs } from '../util/misc';
2120
import { FirebaseApp } from '@firebase/app-types';
2221
import { _FirebaseApp } from '@firebase/app-types/private';
2322

packages/firestore/src/api/database.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ import {
3333
RelationOp
3434
} from '../core/query';
3535
import { Transaction as InternalTransaction } from '../core/transaction';
36-
import {
37-
ChangeType,
38-
DocumentViewChange,
39-
ViewSnapshot
40-
} from '../core/view_snapshot';
36+
import { ChangeType, ViewSnapshot } from '../core/view_snapshot';
4137
import { Document, MaybeDocument, NoDocument } from '../model/document';
4238
import { DocumentKey } from '../model/document_key';
4339
import {

packages/firestore/src/api/user_data_converter.ts

-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as firestore from '@firebase/firestore-types';
18-
1917
import { DatabaseId } from '../core/database_info';
2018
import { Timestamp } from '../core/timestamp';
2119
import { DocumentKey } from '../model/document_key';
@@ -248,13 +246,6 @@ class ParseContext {
248246
throw this.createError('Document fields cannot begin and end with __');
249247
}
250248
}
251-
252-
private isWrite(): boolean {
253-
return (
254-
this.dataSource === UserDataSource.Set ||
255-
this.dataSource === UserDataSource.Update
256-
);
257-
}
258249
}
259250
/**
260251
* An interface that allows arbitrary pre-converting of user data. This

packages/firestore/src/core/event_manager.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { ChangeType, ViewSnapshot } from './view_snapshot';
2222
import { DocumentSet } from '../model/document_set';
2323
import { assert } from '../util/assert';
2424
import { EventHandler } from '../util/misc';
25-
import * as obj from '../util/obj';
2625
import { ObjectMap } from '../util/obj_map';
2726

2827
/**

packages/firestore/src/core/firestore_client.ts

-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ export class FirestoreClient {
274274
this.databaseInfo.databaseId
275275
);
276276
const datastore = new Datastore(
277-
this.databaseInfo,
278277
this.asyncQueue,
279278
connection,
280279
this.credentials,

packages/firestore/src/local/indexeddb_mutation_queue.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
222222
.next(() => {
223223
const promises: Array<PersistencePromise<void>> = [];
224224
for (const mutation of mutations) {
225-
const encodedPath = EncodedResourcePath.encode(mutation.key.path);
226225
const indexKey = DbDocumentMutation.key(
227226
this.userId,
228227
mutation.key.path,
@@ -379,7 +378,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
379378
this.userId,
380379
queryPath
381380
);
382-
const encodedQueryPath = indexPrefix[1];
383381
const indexStart = IDBKeyRange.lowerBound(indexPrefix);
384382

385383
// Collect up unique batchIDs encountered during a scan of the index. Use a
@@ -516,8 +514,8 @@ export class IndexedDbMutationQueue implements MutationQueue {
516514
const startRange = IDBKeyRange.lowerBound(indexKey);
517515
let containsKey = false;
518516
return documentMutationsStore(txn)
519-
.iterate({ range: startRange, keysOnly: true }, (key, _, control) => {
520-
const [userID, keyPath, batchID] = key;
517+
.iterate({ range: startRange, keysOnly: true }, (key, value, control) => {
518+
const [userID, keyPath, /*batchID*/ _] = key;
521519
if (userID === this.userId && keyPath === encodedPath) {
522520
containsKey = true;
523521
}

packages/firestore/src/local/indexeddb_query_cache.ts

-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as api from '../protos/firestore_proto_api';
1817
import { Query } from '../core/query';
1918
import { SnapshotVersion } from '../core/snapshot_version';
2019
import { Timestamp } from '../core/timestamp';
@@ -27,7 +26,6 @@ import { immediateSuccessor } from '../util/misc';
2726
import * as EncodedResourcePath from './encoded_resource_path';
2827
import { GarbageCollector } from './garbage_collector';
2928
import {
30-
DbQuery,
3129
DbTarget,
3230
DbTargetDocument,
3331
DbTargetDocumentKey,
@@ -237,7 +235,6 @@ export class IndexedDbQueryCache implements QueryCache {
237235
txn: PersistenceTransaction,
238236
targetId: TargetId
239237
): PersistencePromise<DocumentKeySet> {
240-
const promises: Array<PersistencePromise<void>> = [];
241238
const range = IDBKeyRange.bound(
242239
[targetId],
243240
[targetId + 1],

packages/firestore/src/local/memory_query_cache.ts

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { TargetId } from '../core/types';
2020
import { DocumentKeySet } from '../model/collections';
2121
import { DocumentKey } from '../model/document_key';
2222
import { ObjectMap } from '../util/obj_map';
23-
import { SortedSet } from '../util/sorted_set';
2423

2524
import { GarbageCollector } from './garbage_collector';
2625
import { PersistenceTransaction } from './persistence';

packages/firestore/src/local/memory_remote_document_cache.ts

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
} from '../model/collections';
2323
import { Document, MaybeDocument } from '../model/document';
2424
import { DocumentKey } from '../model/document_key';
25-
import { DocumentSet } from '../model/document_set';
2625

2726
import { PersistenceTransaction } from './persistence';
2827
import { PersistencePromise } from './persistence_promise';

packages/firestore/src/local/reference_set.ts

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { BatchId, TargetId } from '../core/types';
1818
import { documentKeySet, DocumentKeySet } from '../model/collections';
1919
import { DocumentKey } from '../model/document_key';
20-
import { assert } from '../util/assert';
2120
import { primitiveComparator } from '../util/misc';
2221
import { SortedSet } from '../util/sorted_set';
2322

packages/firestore/src/model/document_set.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { assert } from '../util/assert';
1817
import { SortedMap } from '../util/sorted_map';
1918

2019
import { documentMap } from './collections';

packages/firestore/src/model/field_value.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import { SnapshotOptions } from '../api/database';
2020
import { DatabaseId } from '../core/database_info';
2121
import { Timestamp } from '../core/timestamp';
2222
import { assert, fail } from '../util/assert';
23-
import { AnyJs, primitiveComparator } from '../util/misc';
24-
import * as objUtils from '../util/obj';
23+
import { primitiveComparator } from '../util/misc';
2524
import { SortedMap } from '../util/sorted_map';
26-
import * as typeUtils from '../util/types';
2725

2826
import { DocumentKey } from './document_key';
2927
import { FieldPath } from './path';

packages/firestore/src/platform/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as firestore from '@firebase/firestore-types';
1817
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
1918
import { _FirebaseNamespace } from '@firebase/app-types/private';
2019
import { PublicBlob } from '../api/blob';

packages/firestore/src/platform_node/grpc_connection.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { mapCodeFromRpcCode } from '../remote/rpc_error';
2929
import { assert } from '../util/assert';
3030
import { FirestoreError } from '../util/error';
3131
import * as log from '../util/log';
32-
import { AnyJs } from '../util/misc';
3332
import { NodeCallback, nodePromise } from '../util/node_api';
3433
import { Deferred } from '../util/promise';
3534

@@ -45,7 +44,7 @@ const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${
4544
type DuplexRpc = () => grpc.ClientDuplexStream;
4645
type ReadableRpc<Req> = (req: Req) => grpc.ClientReadableStream;
4746
type UnaryRpc<Req, Resp> = (
48-
req,
47+
req: Req,
4948
callback: (err?: grpc.ServiceError, resp?: Resp) => void
5049
) => grpc.ClientUnaryCall;
5150

packages/firestore/src/remote/datastore.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import * as api from '../protos/firestore_proto_api';
1818
import { CredentialsProvider } from '../api/credentials';
19-
import { DatabaseInfo } from '../core/database_info';
2019
import { maybeDocumentMap } from '../model/collections';
2120
import { MaybeDocument } from '../model/document';
2221
import { DocumentKey } from '../model/document_key';
@@ -27,9 +26,7 @@ import { AsyncQueue } from '../util/async_queue';
2726
import { Connection } from './connection';
2827
import {
2928
PersistentListenStream,
30-
PersistentWriteStream,
31-
WatchStreamListener,
32-
WriteStreamListener
29+
PersistentWriteStream
3330
} from './persistent_stream';
3431
import { JsonProtoSerializer } from './serializer';
3532

@@ -50,7 +47,6 @@ interface CommitRequest extends api.CommitRequest {
5047
*/
5148
export class Datastore {
5249
constructor(
53-
private databaseInfo: DatabaseInfo,
5450
private queue: AsyncQueue,
5551
private connection: Connection,
5652
private credentials: CredentialsProvider,
@@ -60,7 +56,6 @@ export class Datastore {
6056

6157
newPersistentWriteStream(): PersistentWriteStream {
6258
return new PersistentWriteStream(
63-
this.databaseInfo,
6459
this.queue,
6560
this.connection,
6661
this.credentials,
@@ -71,7 +66,6 @@ export class Datastore {
7166

7267
newPersistentWatchStream(): PersistentListenStream {
7368
return new PersistentListenStream(
74-
this.databaseInfo,
7569
this.queue,
7670
this.connection,
7771
this.credentials,

packages/firestore/src/remote/persistent_stream.ts

-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import * as api from '../protos/firestore_proto_api';
1818
import { CredentialsProvider, Token } from '../api/credentials';
19-
import { DatabaseInfo } from '../core/database_info';
2019
import { SnapshotVersion } from '../core/snapshot_version';
2120
import { ProtoByteString, TargetId } from '../core/types';
2221
import { QueryData } from '../local/query_data';
@@ -534,7 +533,6 @@ export class PersistentListenStream extends PersistentStream<
534533
WatchStreamListener
535534
> {
536535
constructor(
537-
private databaseInfo: DatabaseInfo,
538536
queue: AsyncQueue,
539537
connection: Connection,
540538
credentials: CredentialsProvider,
@@ -638,7 +636,6 @@ export class PersistentWriteStream extends PersistentStream<
638636
private handshakeComplete_ = false;
639637

640638
constructor(
641-
private databaseInfo: DatabaseInfo,
642639
queue: AsyncQueue,
643640
connection: Connection,
644641
credentials: CredentialsProvider,

packages/firestore/src/remote/remote_store.ts

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
import { User } from '../auth/user';
18-
import { DatabaseInfo } from '../core/database_info';
1918
import { SnapshotVersion } from '../core/snapshot_version';
2019
import { Transaction } from '../core/transaction';
2120
import { BatchId, OnlineState, TargetId } from '../core/types';
@@ -31,7 +30,6 @@ import {
3130
} from '../model/mutation_batch';
3231
import { emptyByteString } from '../platform/platform';
3332
import { assert } from '../util/assert';
34-
import { AsyncQueue } from '../util/async_queue';
3533
import { Code, FirestoreError } from '../util/error';
3634
import * as log from '../util/log';
3735
import * as objUtils from '../util/obj';
@@ -291,7 +289,6 @@ export class RemoteStore {
291289
objUtils.contains(this.listenTargets, targetId),
292290
'unlisten called without assigned target ID!'
293291
);
294-
const queryData = this.listenTargets[targetId];
295292
delete this.listenTargets[targetId];
296293
if (this.isNetworkEnabled() && this.watchStream.isOpen()) {
297294
this.sendUnwatchRequest(targetId);

packages/firestore/src/remote/stream_bridge.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import { assert } from '../util/assert';
1818
import { FirestoreError } from '../util/error';
19-
import { AnyJs } from '../util/misc';
2019

2120
import { Stream } from './connection';
2221

packages/firestore/src/util/async_queue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { assert, fail } from './assert';
1818
import * as log from './log';
19-
import { AnyDuringMigration, AnyJs } from './misc';
19+
import { AnyJs } from './misc';
2020
import { Deferred, CancelablePromise } from './promise';
2121
import { Code, FirestoreError } from './error';
2222

packages/firestore/src/util/sorted_map.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ export class LLRBNode<K, V> {
485485

486486
// In a balanced RB tree, the black-depth (number of black nodes) from root to
487487
// leaves is equal on both sides. This function verifies that or asserts.
488-
private check(): number {
488+
protected check(): number {
489489
if (this.isRed() && this.left.isRed()) {
490490
throw fail('Red node has red child(' + this.key + ',' + this.value + ')');
491491
}
@@ -562,7 +562,7 @@ export class LLRBEmptyNode<K, V> {
562562
return true;
563563
}
564564

565-
private check() {
565+
protected check() {
566566
return 0;
567567
}
568568
} // end LLRBEmptyNode

packages/firestore/test/integration/api/type.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ import { expect } from 'chai';
1818
import * as firestore from '@firebase/firestore-types';
1919
import firebase from '../util/firebase_export';
2020
import { apiDescribe, withTestDb, withTestDoc } from '../util/helpers';
21+
import { addEqualityMatcher } from '../../util/equality_matcher';
2122

2223
apiDescribe('Firestore', persistence => {
24+
addEqualityMatcher();
25+
2326
function expectRoundtrip(
2427
db: firestore.FirebaseFirestore,
2528
data: {}

packages/firestore/test/integration/util/internal_helpers.ts

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export function withTestDatastore(
5353
databaseInfo.databaseId
5454
);
5555
const datastore = new Datastore(
56-
databaseInfo,
5756
queue || new AsyncQueue(),
5857
conn,
5958
new EmptyCredentialsProvider(),

packages/firestore/test/unit/model/mutation.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ import {
4040
version,
4141
wrapObject
4242
} from '../../util/helpers';
43+
import { addEqualityMatcher } from '../../util/equality_matcher';
4344

4445
describe('Mutation', () => {
46+
addEqualityMatcher();
47+
4548
const timestamp = Timestamp.now();
4649

4750
it('can apply sets to documents', () => {

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

-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ abstract class TestRunner {
376376
// Set backoff delay to 1ms so simulated disconnects don't delay the tests.
377377
const initialBackoffDelay = 1;
378378
this.datastore = new Datastore(
379-
this.databaseInfo,
380379
this.queue,
381380
this.connection,
382381
new EmptyCredentialsProvider(),

0 commit comments

Comments
 (0)