Skip to content

Commit a44260f

Browse files
committed
replace tslint suppresion with eslint ones
1 parent 9f0e538 commit a44260f

23 files changed

+131
-39
lines changed

packages/firestore/.eslintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,21 @@
22
"extends": "../../config/.eslintrc.json",
33
"parserOptions": {
44
"project": "tsconfig.json"
5+
},
6+
"plugins": [
7+
"import"
8+
],
9+
"rules": {
10+
"no-console":[ "error", { "allow": ["warn", "error"] }],
11+
"import/no-default-export": "error"
12+
},
13+
"overrides": {
14+
"files": [
15+
"*test.ts",
16+
"**/test/**/*.ts"
17+
],
18+
"rules": {
19+
"no-console": "off"
20+
}
521
}
622
}

packages/firestore/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"build": "rollup -c",
88
"build:console": "node tools/console.build.js",
99
"dev": "rollup -c -w",
10-
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
11-
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
10+
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
11+
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
1212
"prettier": "prettier --write 'src/**/*.js' 'test/**/*.js' 'src/**/*.ts' 'test/**/*.ts'",
1313
"test": "run-s lint test:all",
1414
"test:all": "run-p test:browser test:node",
@@ -80,7 +80,8 @@
8080
"eslint": "5.16.0",
8181
"@typescript-eslint/parser": "1.9.0",
8282
"@typescript-eslint/eslint-plugin": "1.9.0",
83-
"@typescript-eslint/eslint-plugin-tslint": "1.9.0"
83+
"@typescript-eslint/eslint-plugin-tslint": "1.9.0",
84+
"eslint-plugin-import": "2.17.3"
8485
},
8586
"repository": {
8687
"directory": "packages/firestore",
@@ -97,4 +98,4 @@
9798
],
9899
"reportDir": "./coverage/node"
99100
}
100-
}
101+
}

packages/firestore/src/api/blob.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export class Blob {
136136
// instanceof checks.
137137
// For our internal TypeScript code PublicBlob doesn't exist as a type, and so
138138
// we need to use Blob as type and export it too.
139-
// tslint:disable-next-line:variable-name We're treating this as a class name.
140139
export const PublicBlob = makeConstructorPrivate(
141140
Blob,
142141
'Use Blob.fromUint8Array() or Blob.fromBase64String() instead.'

packages/firestore/src/api/database.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ import {
106106
// The objects that are a part of this API are exposed to third-parties as
107107
// compiled javascript so we want to flag our private members with a leading
108108
// underscore to discourage their use.
109-
// tslint:disable:strip-private-property-underscore
110109

111110
// settings() defaults:
112111
const DEFAULT_HOST = 'firestore.googleapis.com';
@@ -2353,7 +2352,6 @@ function resultChangeType(type: ChangeType): firestore.DocumentChangeType {
23532352

23542353
// We're treating the variables as class names, so disable checking for lower
23552354
// case variable names.
2356-
// tslint:disable:variable-name
23572355
export const PublicFirestore = makeConstructorPrivate(
23582356
Firestore,
23592357
'Use firebase.firestore() instead.'
@@ -2380,4 +2378,3 @@ export const PublicCollectionReference = makeConstructorPrivate(
23802378
CollectionReference,
23812379
'Use firebase.firestore().collection() instead.'
23822380
);
2383-
// tslint:enable:variable-name

packages/firestore/src/api/field_path.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
// The objects that are a part of this API are exposed to third-parties as
2929
// compiled javascript so we want to flag our private members with a leading
3030
// underscore to discourage their use.
31-
// tslint:disable:strip-private-property-underscore
3231

3332
/**
3433
* A FieldPath refers to a field in a document. The path may consist of a single

packages/firestore/src/api/field_value.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ 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-
// tslint:disable-next-line:class-as-namespace We use this as a base class.
32+
// We use this as a base class.
3333
export abstract class FieldValueImpl implements firestore.FieldValue {
3434
protected constructor(readonly _methodName: string) {}
3535

@@ -109,7 +109,6 @@ export class NumericIncrementFieldValueImpl extends FieldValueImpl {
109109
// PublicFieldValue can be used interchangeably in instanceof checks.
110110
// For our internal TypeScript code PublicFieldValue doesn't exist as a type,
111111
// and so we need to use FieldValueImpl as type and export it too.
112-
// tslint:disable-next-line:variable-name We treat this as a class name.
113112
export const PublicFieldValue = makeConstructorPrivate(
114113
FieldValueImpl,
115114
'Use FieldValue.<field>() instead.'

packages/firestore/src/core/firestore_client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ export class FirestoreClient {
252252
if (!this.canFallback(error)) {
253253
throw error;
254254
}
255-
256255
console.warn(
257256
'Error enabling offline persistence. Falling back to' +
258257
' persistence disabled: ' +

packages/firestore/src/core/sync_engine.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
248248
.then(remoteKeys => {
249249
const view = new View(query, remoteKeys);
250250
const viewDocChanges = view.computeDocChanges(docs);
251-
// tslint:disable-next-line:max-line-length Prettier formats this exceed 100 characters.
251+
// Prettier formats this exceed 100 characters.
252252
const synthesizedTargetChange = TargetChange.createSynthesizedTargetChangeForCurrentChange(
253253
queryData.targetId,
254254
current && this.onlineState !== OnlineState.Offline
@@ -975,7 +975,6 @@ export class SyncEngine implements RemoteSyncer, SharedClientStateSyncer {
975975
return this.localStore.getNewDocumentChanges().then(
976976
async changes => {
977977
// tslint and prettier disagree about their preferred line length.
978-
// tslint:disable-next-line:max-line-length
979978
const synthesizedRemoteEvent = RemoteEvent.createSynthesizedRemoteEventForCurrentChange(
980979
targetId,
981980
state === 'current'

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ export class DbTargetDocument {
784784
) {
785785
assert(
786786
(targetId === 0) === (sequenceNumber !== undefined),
787-
// tslint:disable-next-line:max-line-length
788787
'A target-document row must either have targetId == 0 and a defined sequence number, or a non-zero targetId and no sequence number'
789788
);
790789
}

packages/firestore/src/util/api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
// We are doing some heavy reflective stuff, lots of any casting necessary
19-
/* tslint:disable:no-any */
20-
2118
import { Code, FirestoreError } from './error';
2219

2320
/**

packages/firestore/src/util/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ 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-
// tslint:disable-next-line:variable-name Intended to look like a TS 2.4 enum
27+
// Intended to look like a TS 2.4 enum
2828
export const Code = {
2929
// Causes are copied from:
3030
// https://github.com/grpc/grpc/blob/bceec94ea4fc5f0085d81235d8e1c06798dc341a/include/grpc%2B%2B/impl/codegen/status_code_enum.h

packages/firestore/src/util/log.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
/* tslint:disable:no-console */
19-
2018
import { Logger, LogLevel as FirebaseLogLevel } from '@firebase/logger';
2119
import { SDK_VERSION } from '../core/version';
2220
import { PlatformSupport } from '../platform/platform';

packages/firestore/src/util/misc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { assert } from './assert';
1919

2020
export type EventHandler<E> = (value: E) => void;
2121

22-
// tslint:disable-next-line:class-as-namespace
2322
export class AutoId {
2423
static newId(): string {
2524
// Alphanumeric characters

packages/firestore/test/integration/bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import '../../index';
2525
*/
2626

2727
// 'context()' definition requires additional dependency on webpack-env package.
28-
// tslint:disable-next-line:no-any
2928
const testsContext = (require as any).context('.', true, /.test$/);
3029
const browserTests = testsContext
3130
.keys()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222

2323
import firebase from '@firebase/app';
2424

25-
// tslint:disable-next-line:no-default-export
25+
// eslint-disable-next-line import/no-default-export
2626
export default firebase;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import firebase from './firebase_export';
2424
* dependencies on src/ files.
2525
*/
2626

27-
// tslint:disable-next-line:no-any __karma__ is an untyped global
27+
// __karma__ is an untyped global
2828
declare const __karma__: any;
2929

3030
// eslint-disable-next-line @typescript-eslint/no-require-imports
@@ -46,7 +46,6 @@ const PROD_FIRESTORE_SETTING = {
4646

4747
export const DEFAULT_SETTINGS = getDefaultSettings();
4848

49-
// tslint:disable-next-line:no-console
5049
console.log(`Default Settings: ${JSON.stringify(DEFAULT_SETTINGS)}`);
5150

5251
function getDefaultSettings(): firestore.Settings {

packages/firestore/test/unit/bootstrap.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import '../../src/platform_browser/browser_init';
2525
*/
2626

2727
// 'context()' definition requires additional dependency on webpack-env package.
28-
// tslint:disable-next-line:no-any
2928
const testsContext = (require as any).context('.', true, /.test$/);
3029
const browserTests = testsContext
3130
.keys()

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export function specTest(
176176
await spec.runAsTest(fullName, usePersistence);
177177
const end = Date.now();
178178
if (tags.indexOf(BENCHMARK_TAG) >= 0) {
179-
// tslint:disable-next-line:no-console
180179
console.log(`Runtime: ${end - start} ms.`);
181180
}
182181
});

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class MockConnection implements Connection {
258258
}
259259
});
260260
this.writeStream = writeStream;
261-
// tslint:disable-next-line:no-any Replace 'any' with conditional types.
261+
// Replace 'any' with conditional types.
262262
return writeStream as any;
263263
} else {
264264
assert(rpcName === 'Listen', 'Unexpected rpc name: ' + rpcName);
@@ -292,7 +292,7 @@ class MockConnection implements Connection {
292292
}
293293
});
294294
this.watchStream = watchStream;
295-
// tslint:disable-next-line:no-any Replace 'any' with conditional types.
295+
// Replace 'any' with conditional types.
296296
return this.watchStream as any;
297297
}
298298
}
@@ -1240,7 +1240,6 @@ export async function runSpec(
12401240
config: SpecConfig,
12411241
steps: SpecStep[]
12421242
): Promise<void> {
1243-
// tslint:disable-next-line:no-console
12441243
console.log('Running spec: ' + name);
12451244

12461245
const sharedMockStorage = new SharedFakeWebStorage();

packages/firestore/test/util/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ export class DocComparator {
549549
/**
550550
* Two helper functions to simplify testing isEqual() method.
551551
*/
552-
// tslint:disable-next-line:no-any so we can dynamically call .isEqual().
552+
// use any type so we can dynamically call .isEqual().
553553
export function expectEqual(left: any, right: any, message?: string): void {
554554
message = message || '';
555555
if (typeof left.isEqual !== 'function') {
@@ -566,7 +566,7 @@ export function expectEqual(left: any, right: any, message?: string): void {
566566
expect(right.isEqual(left)).to.equal(true, message);
567567
}
568568

569-
// tslint:disable-next-line:no-any so we can dynamically call .isEqual().
569+
// use any so we can dynamically call .isEqual().
570570
export function expectNotEqual(left: any, right: any, message?: string): void {
571571
expect(left.isEqual(right)).to.equal(false, message || '');
572572
expect(right.isEqual(left)).to.equal(false, message || '');

packages/firestore/test/util/node_persistence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { FakeWindow, SharedFakeWebStorage } from './test_platform';
2929
// To use this code to run persistence-based tests in Node, include this module
3030
// and set the environment variable `USE_MOCK_PERSISTENCE` to `YES`.
3131

32-
const globalAny = global as any; // tslint:disable-line:no-any
32+
const globalAny = global as any;
3333

3434
const dbDir = fs.mkdtempSync(os.tmpdir() + '/firestore_tests');
3535

packages/firestore/test/util/test_platform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class SharedFakeWebStorage {
199199
oldValue,
200200
newValue,
201201
storageArea: client.storageArea
202-
} as any); // tslint:disable-line:no-any Not mocking entire Event type.
202+
} as any); // Not mocking entire Event type.
203203
});
204204
}
205205
}
@@ -220,12 +220,12 @@ export class TestPlatform implements Platform {
220220
}
221221

222222
get document(): Document | null {
223-
// tslint:disable-next-line:no-any FakeWindow doesn't support full Document interface.
223+
// FakeWindow doesn't support full Document interface.
224224
return this.mockDocument as any;
225225
}
226226

227227
get window(): Window | null {
228-
// tslint:disable-next-line:no-any FakeWindow doesn't support full Window interface.
228+
// FakeWindow doesn't support full Window interface.
229229
return this.mockWindow as any;
230230
}
231231

0 commit comments

Comments
 (0)