Skip to content

Update dependency eslint to v6 #1965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"docgen:js": "node scripts/docgen/generate-docs.js --api js",
"docgen:node": "node scripts/docgen/generate-docs.js --api node",
"docgen": "yarn docgen:js; yarn docgen:node",
"prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'"
"prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'",
"lint": "lerna run --scope @firebase/* --scope rxfire lint"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"eslint": "5.16.0",
"eslint": "6.5.1",
"eslint-plugin-import": "2.18.2",
"mocha": "6.2.1",
"rollup-plugin-commonjs": "10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ts-node": "8.4.1",
"typescript": "3.5.3",
"webpack": "4.41.0",
"eslint": "5.16.0",
"eslint": "6.5.1",
"@typescript-eslint/parser": "2.3.2",
"@typescript-eslint/eslint-plugin": "2.3.2",
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",
Expand Down
7 changes: 3 additions & 4 deletions packages/app/src/firebaseApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ export class FirebaseAppImpl implements FirebaseApp {
private isDeleted_ = false;
private services_: ServicesCache = {};
private automaticDataCollectionEnabled_: boolean;
// An array to capture listeners before the true auth functions
// exist
// An array to capture listeners before the true auth functions exist
private tokenListeners_: Array<(token: string | null) => void> = [];
// An array to capture requests to send events before analytics component loads.
// eslint-disable-next-line @typescript-eslint/no-explicit-any, use any here to make using function.apply easier
// An array to capture requests to send events before analytics component loads. Use type any to make using function.apply easier
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private analyticsEventRequests_: any[] = [];

INTERNAL: FirebaseAppInternals;
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"typescript": "3.5.3",
"webpack": "4.41.0",
"yargs": "14.0.0",
"eslint": "5.16.0",
"eslint": "6.5.1",
"@typescript-eslint/parser": "2.3.2",
"@typescript-eslint/eslint-plugin": "2.3.2",
"@typescript-eslint/eslint-plugin-tslint": "2.3.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/local/indexeddb_mutation_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ export class IndexedDbMutationQueue implements MutationQueue {
// mutation batch.
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=701972

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

Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/local/persistence_promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ export class PersistencePromise<T> {
}

static waitFor(
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Accept all Promise types in waitFor().
// Accept all Promise types in waitFor().
// eslint-disable-next-line @typescript-eslint/no-explicit-any
all: { forEach: (cb: (el: PersistencePromise<any>) => void) => void }
): PersistencePromise<void> {
return new PersistencePromise<void>((resolve, reject) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/local/simple_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ export class SimpleDbStore<
*/
get(key: KeyType): PersistencePromise<ValueType | null> {
const request = this.store.get(key);
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We're doing an unsafe cast to ValueType.
// We're doing an unsafe cast to ValueType.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return wrapRequest<any>(request).next(result => {
// Normalize nonexistence to null.
if (result === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export class WebChannelConnection implements Connection {
const url = this.makeUrl(rpcName);

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

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

// WebChannel supports sending the first message with the handshake - saving
Expand Down Expand Up @@ -368,7 +370,8 @@ export class WebChannelConnection implements Connection {
// (and only errors) to be wrapped in an extra array. To be forward
// compatible with the bug we need to check either condition. The latter
// can be removed once the fix has been rolled out.
// eslint-disable-next-line @typescript-eslint/no-explicit-any, msgData.error is not typed.
// Use any because msgData.error is not typed.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const msgDataAsAny: any = msgData;
const error =
msgDataAsAny.error || (msgDataAsAny[0] && msgDataAsAny[0].error);
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/platform_node/load_protos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import * as protoLoader from '@grpc/proto-loader';
import * as grpc from 'grpc';
import * as path from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies, only used in tests
// only used in tests
// eslint-disable-next-line import/no-extraneous-dependencies
import * as ProtobufJS from 'protobufjs';

/** Used by tests so we can match @grpc/proto-loader behavior. */
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/remote/rpc_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export function isPermanentWriteError(code: Code): boolean {
* there is no match.
*/
export function mapCodeFromRpcStatus(status: string): Code | undefined {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, lookup by string
// lookup by string
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const code: RpcCode = RpcCode[status as any] as any;
if (code === undefined) {
return undefined;
Expand Down
6 changes: 4 additions & 2 deletions packages/firestore/src/remote/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ export class JsonProtoSerializer {
return val;
} else {
// ProtobufJS requires that we wrap Int32Values.
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We need to match generated Proto types.
// Use any because we need to match generated Proto types.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return { value: val } as any;
}
}
Expand All @@ -187,7 +188,8 @@ export class JsonProtoSerializer {
private fromInt32Value(val: number | undefined): number | null {
let result;
if (typeof val === 'object') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, We need to match generated Proto types.
// Use any because we need to match generated Proto types.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
result = (val as any).value;
} else {
// We accept raw numbers (without the {value: ... } wrapper) for
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/util/async_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { Code, FirestoreError } from './error';
import * as log from './log';
import { CancelablePromise, Deferred } from './promise';

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

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/src/util/sorted_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ export class LLRBNode<K, V> {
readonly right: LLRBNode<K, V> | LLRBEmptyNode<K, V>;
readonly size: number;

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

static RED = true;
Expand Down
6 changes: 4 additions & 2 deletions packages/firestore/test/integration/api/batch_writes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ apiDescribe('Database batch writes', (persistence: boolean) => {
.then(initialSnap => {
expect(initialSnap.docs.length).to.equal(0);

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

// eslint-disable-next-line @typescript-eslint/no-floating-promises, Atomically write 2 documents with server timestamps.
// Atomically write 2 documents with server timestamps.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
collection.firestore
.batch()
.set(docA, {
Expand Down
6 changes: 4 additions & 2 deletions packages/firestore/test/integration/api/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,11 @@ apiDescribe('Database', (persistence: boolean) => {
for (const val of invalidDocValues) {
it('set/update should reject: ' + val, () => {
return withTestDoc(persistence, async doc => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally passing bad types.
// Intentionally passing bad types.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(() => doc.set(val as any)).to.throw();
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally passing bad types.
// Intentionally passing bad types.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(() => doc.update(val as any)).to.throw();
});
});
Expand Down
6 changes: 4 additions & 2 deletions packages/firestore/test/integration/api/fields.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const FieldPath = firebase.firestore!.FieldPath;
const FieldValue = firebase.firestore!.FieldValue;
const Timestamp = firebase.firestore!.Timestamp;

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

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

apiDescribe('Timestamp Fields in snapshots', (persistence: boolean) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Figure out how to pass in the Timestamp type
// Figure out how to pass in the Timestamp type
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const testDataWithTimestamps = (ts: any): AnyTestData => {
return { timestamp: ts, nested: { timestamp2: ts } };
};
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/test/integration/api/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ apiDescribe('Queries', (persistence: boolean) => {

const expectedError =
'QuerySnapshot.docChanges has been changed from a property into a method';

// eslint-disable-next-line @typescript-eslint/no-explicit-any, We are testing invalid API usage.
// We are testing invalid API usage.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const docChange = querySnap.docChanges as any;
expect(() => docChange.length).to.throw(expectedError);
expect(() => {
Expand Down
11 changes: 6 additions & 5 deletions packages/firestore/test/integration/api/server_timestamp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import { EventsAccumulator } from '../util/events_accumulator';
import firebase from '../util/firebase_export';
import { apiDescribe, withTestDoc } from '../util/helpers';

// tslint:disable:no-floating-promises

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

const Timestamp = firebase.firestore!.Timestamp;
Expand Down Expand Up @@ -258,9 +257,11 @@ apiDescribe('Server Timestamps', (persistence: boolean) => {
return writeInitialData()
.then(() => docRef.firestore.disableNetwork())
.then(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises, We set up two consecutive writes with server timestamps.
// We set up two consecutive writes with server timestamps.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
docRef.update('a', FieldValue.serverTimestamp());
// eslint-disable-next-line @typescript-eslint/no-floating-promises, include b=1 to ensure there's a change resulting in a new snapshot.
// include b=1 to ensure there's a change resulting in a new snapshot.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
docRef.update('a', FieldValue.serverTimestamp(), 'b', 1);
return accumulator.awaitLocalEvents(2);
})
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/test/integration/api/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ apiDescribe('Database transactions', (persistence: boolean) => {

for (const badReturn of badReturns) {
it(badReturn + ' is rejected', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, Intentionally returning bad type.
// Intentionally returning bad type.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const fn = ((txn: firestore.Transaction) => badReturn) as any;
return integrationHelpers.withTestDb(persistence, db => {
return db
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/test/integration/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { User } from '../../../src/auth/user';
* NOTE: These helpers are used by api/ tests and therefore may not have any
* dependencies on src/ files.
*/

// eslint-disable-next-line @typescript-eslint/no-explicit-any, __karma__ is an untyped global
// __karma__ is an untyped global
// eslint-disable-next-line @typescript-eslint/no-explicit-any
declare const __karma__: any;

// eslint-disable-next-line @typescript-eslint/no-require-imports
Expand Down
3 changes: 2 additions & 1 deletion packages/firestore/test/unit/api/blob.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe('Blob', () => {
});

it('Blob throws on using the public constructor', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, allow using constructor with any
// allow using constructor with any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(() => new (PublicBlob as any)('')).to.throw(
'This constructor is private. Use Blob.fromUint8Array() or ' +
'Blob.fromBase64String() instead.'
Expand Down
12 changes: 8 additions & 4 deletions packages/firestore/test/unit/core/event_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
} from '../../util/helpers';

describe('EventManager', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock object.
// mock object.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function fakeQueryListener(query: Query): any {
return {
query,
Expand All @@ -49,7 +50,8 @@ describe('EventManager', () => {
};
}

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

// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock ViewSnapshot.
// mock ViewSnapshot.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const viewSnap1: any = { query: query1 };
// eslint-disable-next-line @typescript-eslint/no-explicit-any, mock ViewSnapshot.
// mock ViewSnapshot.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const viewSnap2: any = { query: query2 };
eventManager.onWatchChange([viewSnap1, viewSnap2]);

Expand Down
6 changes: 4 additions & 2 deletions packages/firestore/test/unit/local/simple_db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ describe('SimpleDb', () => {
});
});

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

// eslint-disable-next-line no-restricted-properties, A little perf test for convenient benchmarking
// A little perf test for convenient benchmarking
// eslint-disable-next-line no-restricted-properties
it.skip('Perf', () => {
return runTransaction(store => {
const start = new Date().getTime();
Expand Down
12 changes: 8 additions & 4 deletions packages/firestore/test/unit/remote/node/serializer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ describe('Serializer', () => {
describe('toDocumentMask', () => {
addEqualityMatcher();

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

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

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

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