Skip to content

Commit bd5ce34

Browse files
renovate-botFeiyang1
authored andcommitted
Update dependency eslint to v6 (#1965)
* Update dependency eslint to v6 * fix lint issues * [AUTOMATED]: Prettier Code Styling
1 parent fe530be commit bd5ce34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+156
-114
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"docgen:js": "node scripts/docgen/generate-docs.js --api js",
3535
"docgen:node": "node scripts/docgen/generate-docs.js --api node",
3636
"docgen": "yarn docgen:js; yarn docgen:node",
37-
"prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'"
37+
"prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'",
38+
"lint": "lerna run --scope @firebase/* --scope rxfire lint"
3839
},
3940
"repository": {
4041
"type": "git",

packages/analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",
3939
"chai": "4.2.0",
4040
"chai-as-promised": "7.1.1",
41-
"eslint": "5.16.0",
41+
"eslint": "6.5.1",
4242
"eslint-plugin-import": "2.18.2",
4343
"mocha": "6.2.1",
4444
"rollup-plugin-commonjs": "10.1.0",

packages/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"ts-node": "8.4.1",
6262
"typescript": "3.5.3",
6363
"webpack": "4.41.0",
64-
"eslint": "5.16.0",
64+
"eslint": "6.5.1",
6565
"@typescript-eslint/parser": "2.3.2",
6666
"@typescript-eslint/eslint-plugin": "2.3.2",
6767
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",

packages/app/src/firebaseApp.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ export class FirebaseAppImpl implements FirebaseApp {
4646
private isDeleted_ = false;
4747
private services_: ServicesCache = {};
4848
private automaticDataCollectionEnabled_: boolean;
49-
// An array to capture listeners before the true auth functions
50-
// exist
49+
// An array to capture listeners before the true auth functions exist
5150
private tokenListeners_: Array<(token: string | null) => void> = [];
52-
// An array to capture requests to send events before analytics component loads.
53-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, use any here to make using function.apply easier
51+
// An array to capture requests to send events before analytics component loads. Use type any to make using function.apply easier
52+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5453
private analyticsEventRequests_: any[] = [];
5554

5655
INTERNAL: FirebaseAppInternals;

packages/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"typescript": "3.5.3",
8282
"webpack": "4.41.0",
8383
"yargs": "14.0.0",
84-
"eslint": "5.16.0",
84+
"eslint": "6.5.1",
8585
"@typescript-eslint/parser": "2.3.2",
8686
"@typescript-eslint/eslint-plugin": "2.3.2",
8787
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",

packages/firestore/src/local/indexeddb_mutation_queue.ts

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

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

packages/firestore/src/local/persistence_promise.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ export class PersistencePromise<T> {
166166
}
167167

168168
static waitFor(
169-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Accept all Promise types in waitFor().
169+
// Accept all Promise types in waitFor().
170+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
170171
all: { forEach: (cb: (el: PersistencePromise<any>) => void) => void }
171172
): PersistencePromise<void> {
172173
return new PersistencePromise<void>((resolve, reject) => {

packages/firestore/src/local/simple_db.ts

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

packages/firestore/src/platform_browser/webchannel_connection.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export class WebChannelConnection implements Connection {
9898
const url = this.makeUrl(rpcName);
9999

100100
return new Promise((resolve: Resolver<Resp>, reject: Rejecter) => {
101-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, XhrIo doesn't have TS typings.
101+
// XhrIo doesn't have TS typings.
102+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
102103
const xhr: any = new XhrIo();
103104
xhr.listenOnce(EventType.COMPLETE, () => {
104105
try {
@@ -271,7 +272,8 @@ export class WebChannelConnection implements Connection {
271272

272273
const url = urlParts.join('');
273274
log.debug(LOG_TAG, 'Creating WebChannel: ' + url + ' ' + request);
274-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Because listen isn't defined on it.
275+
// Use any because listen isn't defined on it.
276+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
275277
const channel = webchannelTransport.createWebChannel(url, request) as any;
276278

277279
// WebChannel supports sending the first message with the handshake - saving
@@ -368,7 +370,8 @@ export class WebChannelConnection implements Connection {
368370
// (and only errors) to be wrapped in an extra array. To be forward
369371
// compatible with the bug we need to check either condition. The latter
370372
// can be removed once the fix has been rolled out.
371-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, msgData.error is not typed.
373+
// Use any because msgData.error is not typed.
374+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
372375
const msgDataAsAny: any = msgData;
373376
const error =
374377
msgDataAsAny.error || (msgDataAsAny[0] && msgDataAsAny[0].error);

packages/firestore/src/platform_node/load_protos.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
import * as protoLoader from '@grpc/proto-loader';
1919
import * as grpc from 'grpc';
2020
import * as path from 'path';
21-
// eslint-disable-next-line import/no-extraneous-dependencies, only used in tests
21+
// only used in tests
22+
// eslint-disable-next-line import/no-extraneous-dependencies
2223
import * as ProtobufJS from 'protobufjs';
2324

2425
/** Used by tests so we can match @grpc/proto-loader behavior. */

packages/firestore/src/remote/rpc_error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ export function isPermanentWriteError(code: Code): boolean {
110110
* there is no match.
111111
*/
112112
export function mapCodeFromRpcStatus(status: string): Code | undefined {
113-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, lookup by string
113+
// lookup by string
114+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
114115
const code: RpcCode = RpcCode[status as any] as any;
115116
if (code === undefined) {
116117
return undefined;

packages/firestore/src/remote/serializer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ export class JsonProtoSerializer {
172172
return val;
173173
} else {
174174
// ProtobufJS requires that we wrap Int32Values.
175-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We need to match generated Proto types.
175+
// Use any because we need to match generated Proto types.
176+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
176177
return { value: val } as any;
177178
}
178179
}
@@ -187,7 +188,8 @@ export class JsonProtoSerializer {
187188
private fromInt32Value(val: number | undefined): number | null {
188189
let result;
189190
if (typeof val === 'object') {
190-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We need to match generated Proto types.
191+
// Use any because we need to match generated Proto types.
192+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
191193
result = (val as any).value;
192194
} else {
193195
// We accept raw numbers (without the {value: ... } wrapper) for

packages/firestore/src/util/async_queue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import { Code, FirestoreError } from './error';
2020
import * as log from './log';
2121
import { CancelablePromise, Deferred } from './promise';
2222

23-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Accept any return type from setTimeout().
23+
// Accept any return type from setTimeout().
24+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2425
type TimerHandle = any;
2526

2627
/**

packages/firestore/src/util/sorted_map.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export class LLRBNode<K, V> {
273273
readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>;
274274
readonly size: number;
275275

276-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Empty node is shared between all LLRB trees.
276+
// Empty node is shared between all LLRB trees.
277+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
277278
static EMPTY: LLRBEmptyNode<any, any> = null as any;
278279

279280
static RED = true;

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ apiDescribe('Database batch writes', (persistence: boolean) => {
163163
.then(initialSnap => {
164164
expect(initialSnap.docs.length).to.equal(0);
165165

166-
// eslint-disable-next-line @typescript-eslint/no-floating-promises, Atomically write two documents.
166+
// Atomically write two documents.
167+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
167168
collection.firestore
168169
.batch()
169170
.set(docA, { a: 1 })
@@ -275,7 +276,8 @@ apiDescribe('Database batch writes', (persistence: boolean) => {
275276
.then(initialSnap => {
276277
expect(initialSnap.docs.length).to.equal(0);
277278

278-
// eslint-disable-next-line @typescript-eslint/no-floating-promises, Atomically write 2 documents with server timestamps.
279+
// Atomically write 2 documents with server timestamps.
280+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
279281
collection.firestore
280282
.batch()
281283
.set(docA, {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,11 @@ apiDescribe('Database', (persistence: boolean) => {
523523
for (const val of invalidDocValues) {
524524
it('set/update should reject: ' + val, () => {
525525
return withTestDoc(persistence, async doc => {
526-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally passing bad types.
526+
// Intentionally passing bad types.
527+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
527528
expect(() => doc.set(val as any)).to.throw();
528-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally passing bad types.
529+
// Intentionally passing bad types.
530+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
529531
expect(() => doc.update(val as any)).to.throw();
530532
});
531533
});

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const FieldPath = firebase.firestore!.FieldPath;
3131
const FieldValue = firebase.firestore!.FieldValue;
3232
const Timestamp = firebase.firestore!.Timestamp;
3333

34-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Allow custom types for testing.
34+
// Allow custom types for testing.
35+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3536
type AnyTestData = any;
3637

3738
apiDescribe('Nested Fields', (persistence: boolean) => {
@@ -346,7 +347,8 @@ apiDescribe('Fields with special characters', (persistence: boolean) => {
346347
});
347348

348349
apiDescribe('Timestamp Fields in snapshots', (persistence: boolean) => {
349-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Figure out how to pass in the Timestamp type
350+
// Figure out how to pass in the Timestamp type
351+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
350352
const testDataWithTimestamps = (ts: any): AnyTestData => {
351353
return { timestamp: ts, nested: { timestamp2: ts } };
352354
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,8 @@ apiDescribe('Queries', (persistence: boolean) => {
653653

654654
const expectedError =
655655
'QuerySnapshot.docChanges has been changed from a property into a method';
656-
657-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We are testing invalid API usage.
656+
// We are testing invalid API usage.
657+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
658658
const docChange = querySnap.docChanges as any;
659659
expect(() => docChange.length).to.throw(expectedError);
660660
expect(() => {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import { EventsAccumulator } from '../util/events_accumulator';
2222
import firebase from '../util/firebase_export';
2323
import { apiDescribe, withTestDoc } from '../util/helpers';
2424

25-
// tslint:disable:no-floating-promises
26-
27-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Allow custom types for testing.
25+
// Allow custom types for testing.
26+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2827
type AnyTestData = any;
2928

3029
const Timestamp = firebase.firestore!.Timestamp;
@@ -258,9 +257,11 @@ apiDescribe('Server Timestamps', (persistence: boolean) => {
258257
return writeInitialData()
259258
.then(() => docRef.firestore.disableNetwork())
260259
.then(() => {
261-
// eslint-disable-next-line @typescript-eslint/no-floating-promises, We set up two consecutive writes with server timestamps.
260+
// We set up two consecutive writes with server timestamps.
261+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
262262
docRef.update('a', FieldValue.serverTimestamp());
263-
// eslint-disable-next-line @typescript-eslint/no-floating-promises, include b=1 to ensure there's a change resulting in a new snapshot.
263+
// include b=1 to ensure there's a change resulting in a new snapshot.
264+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
264265
docRef.update('a', FieldValue.serverTimestamp(), 'b', 1);
265266
return accumulator.awaitLocalEvents(2);
266267
})

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,8 @@ apiDescribe('Database transactions', (persistence: boolean) => {
763763

764764
for (const badReturn of badReturns) {
765765
it(badReturn + ' is rejected', () => {
766-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally returning bad type.
766+
// Intentionally returning bad type.
767+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
767768
const fn = ((txn: firestore.Transaction) => badReturn) as any;
768769
return integrationHelpers.withTestDb(persistence, db => {
769770
return db

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import { User } from '../../../src/auth/user';
2828
* NOTE: These helpers are used by api/ tests and therefore may not have any
2929
* dependencies on src/ files.
3030
*/
31-
32-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, __karma__ is an untyped global
31+
// __karma__ is an untyped global
32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3333
declare const __karma__: any;
3434

3535
// eslint-disable-next-line @typescript-eslint/no-require-imports

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ describe('Blob', () => {
5858
});
5959

6060
it('Blob throws on using the public constructor', () => {
61-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, allow using constructor with any
61+
// allow using constructor with any
62+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6263
expect(() => new (PublicBlob as any)('')).to.throw(
6364
'This constructor is private. Use Blob.fromUint8Array() or ' +
6465
'Blob.fromBase64String() instead.'

packages/firestore/test/unit/core/event_manager.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ import {
3939
} from '../../util/helpers';
4040

4141
describe('EventManager', () => {
42-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock object.
42+
// mock object.
43+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4344
function fakeQueryListener(query: Query): any {
4445
return {
4546
query,
@@ -49,7 +50,8 @@ describe('EventManager', () => {
4950
};
5051
}
5152

52-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock object.
53+
// mock object.
54+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5355
function makeSyncEngineSpy(): any {
5456
const stub = {
5557
listen: sinon.stub().returns(Promise.resolve(0)),
@@ -115,9 +117,11 @@ describe('EventManager', () => {
115117
await eventManager.listen(fakeListener3);
116118
expect(syncEngineSpy.listen.callCount).to.equal(2);
117119

118-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock ViewSnapshot.
120+
// mock ViewSnapshot.
121+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
119122
const viewSnap1: any = { query: query1 };
120-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock ViewSnapshot.
123+
// mock ViewSnapshot.
124+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
121125
const viewSnap2: any = { query: query2 };
122126
eventManager.onWatchChange([viewSnap1, viewSnap2]);
123127

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ describe('SimpleDb', () => {
364364
});
365365
});
366366

367-
// eslint-disable-next-line no-restricted-properties, Note: This tests is failing under `IndexedDBShim`.
367+
// Note: This tests is failing under `IndexedDBShim`.
368+
// eslint-disable-next-line no-restricted-properties
368369
(isIndexedDbMock() ? it.skip : it)(
369370
'can iterate and skip keys in reverse',
370371
async () => {
@@ -499,7 +500,8 @@ describe('SimpleDb', () => {
499500
});
500501
});
501502

502-
// eslint-disable-next-line no-restricted-properties, A little perf test for convenient benchmarking
503+
// A little perf test for convenient benchmarking
504+
// eslint-disable-next-line no-restricted-properties
503505
it.skip('Perf', () => {
504506
return runTransaction(store => {
505507
const start = new Date().getTime();

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ describe('Serializer', () => {
500500
describe('toDocumentMask', () => {
501501
addEqualityMatcher();
502502

503-
// eslint-disable-next-line no-restricted-properties, TODO(b/34988481): Implement correct escaping
503+
//TODO(b/34988481): Implement correct escaping
504+
// eslint-disable-next-line no-restricted-properties
504505
it.skip('converts a weird path', () => {
505506
const expected: api.DocumentMask = { fieldPaths: ['foo.`bar.baz\\qux`'] };
506507
const mask = FieldMask.fromArray([
@@ -514,7 +515,8 @@ describe('Serializer', () => {
514515
describe('fromDocumentMask', () => {
515516
addEqualityMatcher();
516517

517-
// eslint-disable-next-line no-restricted-properties, TODO(b/34988481): Implement correct escaping
518+
// TODO(b/34988481): Implement correct escaping
519+
// eslint-disable-next-line no-restricted-properties
518520
it.skip('converts a weird path', () => {
519521
const expected = FieldMask.fromArray([
520522
FieldPath.fromServerFormat('foo.bar\\.baz\\\\qux')
@@ -1216,7 +1218,8 @@ describe('Serializer', () => {
12161218
addEqualityMatcher();
12171219

12181220
it('contains all Operators', () => {
1219-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, giant hack
1221+
// giant hack
1222+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12201223
obj.forEach(Operator as any, (name, op) => {
12211224
if (op instanceof Operator) {
12221225
expect(s.toOperatorName(op), 'for name').to.exist;
@@ -1230,7 +1233,8 @@ describe('Serializer', () => {
12301233
addEqualityMatcher();
12311234

12321235
it('contains all Directions', () => {
1233-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, giant hack
1236+
// giant hack
1237+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12341238
obj.forEach(Direction as any, (name, dir) => {
12351239
if (dir instanceof Direction) {
12361240
expect(s.toDirection(dir), 'for ' + name).to.exist;

0 commit comments

Comments
 (0)