Skip to content

Commit c595fe1

Browse files
Addressing lint errors after master merge
1 parent 682c7fc commit c595fe1

18 files changed

+39
-35
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
const FieldPath = firebase.firestore.FieldPath;
2929
const Timestamp = firebase.firestore.Timestamp;
3030

31-
// tslint:disable-next-line:no-any Allow custom type for testing.
31+
// tslint:disable-next-line:no-any Allow custom types for testing.
3232
type AnyTestData = any;
3333

3434
apiDescribe('Nested Fields', persistence => {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import firebase from '../util/firebase_export';
2121
import { apiDescribe, withTestDoc } from '../util/helpers';
2222
import { EventsAccumulator } from '../util/events_accumulator';
2323

24+
// tslint:disable-next-line:no-any Allow custom types for testing.
25+
type AnyTestData = any;
26+
2427
const Timestamp = firebase.firestore.Timestamp;
2528

2629
apiDescribe('Server Timestamps', persistence => {
@@ -49,7 +52,7 @@ apiDescribe('Server Timestamps', persistence => {
4952
let listenerRegistration: () => void;
5053

5154
// Returns the expected data, with an arbitrary timestamp substituted in.
52-
function expectedDataWithTimestamp(timestamp: object | null) {
55+
function expectedDataWithTimestamp(timestamp: object | null) : AnyTestData {
5356
return { a: 42, when: timestamp, deep: { when: timestamp } };
5457
}
5558

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ const validationIt: ValidationIt = Object.assign(
7070
persistence: boolean,
7171
message: string,
7272
_: (db: firestore.FirebaseFirestore) => void | Promise<any>
73-
) {
73+
) : void {
7474
// tslint:disable-next-line:ban
7575
it.skip(message, () => {});
7676
},
7777
only(
7878
persistence: boolean,
7979
message: string,
8080
testFunction: (db: firestore.FirebaseFirestore) => void | Promise<any>
81-
) {
81+
) : void {
8282
// tslint:disable-next-line:ban
8383
it.only(message, () => {
8484
return withTestDb(persistence, async db => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class EventsAccumulator<T> {
6161
});
6262
}
6363

64-
private checkFulfilled() {
64+
private checkFulfilled() : void {
6565
if (this.deferred !== null && this.events.length >= this.waitingFor) {
6666
const events = this.events.splice(0, this.waitingFor);
6767
this.deferred.resolve(events);

packages/firestore/test/unit/api/document_change.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('DocumentChange:', () => {
3939
query: Query,
4040
initialDocs: Document[],
4141
updates: Array<Document | DocumentKey>
42-
) {
42+
) : void {
4343
const view = new View(query, documentKeySet());
4444
const initialSnapshot = applyDocChanges(view, ...initialDocs).snapshot!;
4545
const updatedSnapshot = applyDocChanges(view, ...updates).snapshot;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ function runTransaction<T>(
197197
store: SimpleDbStore<string, boolean>,
198198
transaction: SimpleDbTransaction
199199
) => PersistencePromise<T>
200-
) {
201-
return db.runTransaction('readwrite', ['test'], txn => {
200+
) : Promise<T> {
201+
return db.runTransaction<T>('readwrite', ['test'], txn => {
202202
return fn(txn.store<string, boolean>('test'), txn);
203203
});
204204
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ describe('LocalStore w/ IndexedDB Persistence', () => {
270270
genericLocalStoreTests(persistenceHelpers.testIndexedDbPersistence);
271271
});
272272

273-
function genericLocalStoreTests(getPersistence: () => Promise<Persistence>) {
273+
function genericLocalStoreTests(getPersistence: () => Promise<Persistence>) : void {
274274
let persistence: Persistence;
275275
let localStore: LocalStore;
276276

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('IndexedDbMutationQueue', () => {
120120
* Defines the set of tests to run against both mutation queue
121121
* implementations.
122122
*/
123-
function genericMutationQueueTests() {
123+
function genericMutationQueueTests() : void {
124124
addEqualityMatcher();
125125

126126
beforeEach(() => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('IndexedDbQueryCache', () => {
7070
/**
7171
* Defines the set of tests to run against both query cache implementations.
7272
*/
73-
function genericQueryCacheTests() {
73+
function genericQueryCacheTests() : void {
7474
addEqualityMatcher();
7575

7676
const QUERY_ROOMS = Query.atPath(path('rooms'));
@@ -81,7 +81,7 @@ function genericQueryCacheTests() {
8181
* Creates a new QueryData object from the the given parameters, synthesizing
8282
* a resume token from the snapshot version.
8383
*/
84-
function testQueryData(query: Query, targetId: TargetId, version?: number) {
84+
function testQueryData(query: Query, targetId: TargetId, version?: number) : QueryData {
8585
if (version === undefined) {
8686
version = 0;
8787
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('IndexedDbRemoteDocumentCache', () => {
6060
* Defines the set of tests to run against both remote document cache
6161
* implementations.
6262
*/
63-
function genericRemoteDocumentCacheTests() {
63+
function genericRemoteDocumentCacheTests() : void {
6464
// Helpers for use throughout tests.
6565
const DOC_PATH = 'a/b';
6666
const LONG_DOC_PATH = 'a/b/c/d/e/f';

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ describe('SimpleDb', () => {
5555
let db: SimpleDb;
5656

5757
// helper to reduce test boilerplate.
58-
function runTransaction<T>(
58+
function runTransaction<T> (
5959
fn: (
6060
store: SimpleDbStore<number, User>,
6161
transaction: SimpleDbTransaction
6262
) => PersistencePromise<T>
63-
) {
64-
return db.runTransaction('readwrite', ['users'], txn => {
63+
) : Promise<T> {
64+
return db.runTransaction<T>('readwrite', ['users'], txn => {
6565
return fn(txn.store<number, User>('users'), txn);
6666
});
6767
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class TestQueryCache {
119119
});
120120
}
121121

122-
setLastRemoteSnapshotVersion(version: SnapshotVersion) {
122+
setLastRemoteSnapshotVersion(version: SnapshotVersion) : Promise<void> {
123123
return this.persistence.runTransaction(
124124
'setLastRemoteSnapshotVersion',
125125
txn => this.cache.setLastRemoteSnapshotVersion(txn, version)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ describe('Mutation', () => {
260260
base: MaybeDocument | null,
261261
mutationResult: MutationResult,
262262
expected: MaybeDocument | null
263-
) {
263+
) : void {
264264
const actual = mutation.applyToRemoteDocument(base, mutationResult);
265265
expect(actual).to.deep.equal(expected);
266266
}

packages/firestore/test/unit/remote/node/serializer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ describe('Serializer', () => {
638638
describe('toMutation / fromMutation', () => {
639639
addEqualityMatcher();
640640

641-
function verifyMutation(mutation: Mutation, proto: AnyJs) {
641+
function verifyMutation(mutation: Mutation, proto: AnyJs) : void {
642642
const serialized = s.toMutation(mutation);
643643
expect(serialized).to.deep.equal(proto);
644644
expect(s.fromMutation(serialized)).to.deep.equal(mutation);

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let writeJSONFile: ((json: string) => void) | null = null;
6565
* If you call this function before your describeSpec, then the spec test will
6666
* be written using the given function instead of running as a normal test.
6767
*/
68-
export function setSpecJSONHandler(writer: (json: string) => void) {
68+
export function setSpecJSONHandler(writer: (json: string) => void) : void {
6969
writeJSONFile = writer;
7070
}
7171

@@ -82,7 +82,7 @@ export function specTest(
8282
name: string,
8383
tags: string[],
8484
builder: () => SpecBuilder
85-
) {
85+
) :void {
8686
// Union in the tags for the describeSpec().
8787
tags = tags.concat(describeTags);
8888
for (const tag of tags) {
@@ -146,18 +146,19 @@ export function describeSpec(
146146
name: string,
147147
tags: string[],
148148
builder: () => void
149-
) {
149+
) : void {
150150
describeTags = tags;
151151
describeName = name;
152152

153153
if (!writeJSONFile) {
154-
return describe(name, () => {
154+
describe(name, () => {
155155
addEqualityMatcher();
156156
return builder();
157157
});
158+
} else {
159+
specsInThisTest = {};
160+
builder();
161+
const output = JSON.stringify(specsInThisTest, null, 2);
162+
writeJSONFile(output);
158163
}
159-
specsInThisTest = {};
160-
builder();
161-
const output = JSON.stringify(specsInThisTest, null, 2);
162-
writeJSONFile(output);
163164
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export class SpecBuilder {
194194
return this;
195195
}
196196

197-
runTimer(timerId: TimerId) {
197+
runTimer(timerId: TimerId) : SpecBuilder {
198198
this.nextStep();
199199
this.currentStep = { runTimer: timerId };
200200
return this;
@@ -660,6 +660,6 @@ export class SpecBuilder {
660660
}
661661
}
662662

663-
export function spec() {
663+
export function spec() : SpecBuilder {
664664
return new SpecBuilder();
665665
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,18 @@ class MockConnection implements Connection {
167167
this.resetAndCloseWriteStream(err);
168168
}
169169

170-
private resetAndCloseWriteStream(err?: FirestoreError) {
170+
private resetAndCloseWriteStream(err?: FirestoreError) : void {
171171
this.writeSendBarriers = [];
172172
this.earlyWrites = [];
173173
this.writeStream!.callOnClose(err);
174174
this.writeStream = null;
175175
}
176176

177-
failWatchStream(err?: FirestoreError) {
177+
failWatchStream(err?: FirestoreError) : void {
178178
this.resetAndCloseWatchStream(err);
179179
}
180180

181-
private resetAndCloseWatchStream(err?: FirestoreError) {
181+
private resetAndCloseWatchStream(err?: FirestoreError) : void{
182182
this.activeTargets = {};
183183
this.watchOpen = new Deferred<void>();
184184
this.watchStream!.callOnClose(err);
@@ -860,7 +860,7 @@ abstract class TestRunner {
860860
this.validateActiveTargets();
861861
}
862862

863-
private validateLimboDocs() {
863+
private validateLimboDocs() : void {
864864
let actualLimboDocs = this.syncEngine.currentLimboDocs();
865865
// Validate that each limbo doc has an expected active target
866866
actualLimboDocs.forEach((key, targetId) => {
@@ -883,7 +883,7 @@ abstract class TestRunner {
883883
);
884884
}
885885

886-
private validateActiveTargets() {
886+
private validateActiveTargets() : void {
887887
const actualTargets = obj.shallowCopy(this.connection.activeTargets);
888888
obj.forEachNumber(this.expectedActiveTargets, (targetId, expected) => {
889889
expect(obj.contains(actualTargets, targetId)).to.equal(

packages/firestore/test/unit/util/sorted_map.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { primitiveComparator } from '../../../src/util/misc';
1919
import * as obj from '../../../src/util/obj';
2020
import { LLRBNode, SortedMap } from '../../../src/util/sorted_map';
2121

22-
function shuffle(arr: number[]) {
22+
function shuffle(arr: number[]) : void {
2323
for (let i = arr.length - 1; i > 0; i--) {
2424
// Choose a random array index in [0, i] (inclusive with i).
2525
const j = Math.floor(Math.random() * (i + 1));

0 commit comments

Comments
 (0)