Skip to content

Commit cf9f539

Browse files
committedApr 2, 2020
fix: lint
1 parent e8f2b3b commit cf9f539

14 files changed

+60
-44
lines changed
 

‎src/filter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import arrify = require('arrify');
1616
import * as escapeStringRegexp from 'escape-string-regexp';
1717
import * as is from 'is';
18+
// eslint-disable-next-line @typescript-eslint/no-var-requires
1819
const isUtf8 = require('is-utf8');
1920
import {Mutation} from './mutation';
2021

‎src/row.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414

1515
import {promisifyAll} from '@google-cloud/promisify';
1616
import arrify = require('arrify');
17+
// eslint-disable-next-line @typescript-eslint/no-var-requires
1718
const dotProp = require('dot-prop');
1819
import {Filter, RawFilter} from './filter';
19-
import {
20-
Mutation,
21-
ConvertFromBytesUserOptions,
22-
Bytes,
23-
IMutation,
24-
} from './mutation';
20+
import {Mutation, ConvertFromBytesUserOptions, Bytes} from './mutation';
2521
import {Bigtable} from '.';
2622
import {
2723
Table,

‎src/table.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import arrify = require('arrify');
1818
import {ServiceError} from '@grpc/grpc-js';
1919
import {decorateStatus} from './decorateStatus';
2020

21+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2122
const concat = require('concat-stream');
2223
import * as is from 'is';
24+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2325
const pumpify = require('pumpify');
2426
import * as through from 'through2';
2527

‎system-test/bigtable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as assert from 'assert';
16-
import {describe, it, before, after} from 'mocha';
16+
import {beforeEach, afterEach, describe, it, before, after} from 'mocha';
1717
import Q from 'p-queue';
1818
import * as uuid from 'uuid';
1919

@@ -934,7 +934,7 @@ describe('Bigtable', () => {
934934
rows.forEach(row => {
935935
const follows = row.data.follows;
936936
Object.keys(follows).forEach(column => {
937-
// tslint:disable-next-line no-any
937+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
938938
follows[column].forEach((cell: any) => {
939939
assert.deepStrictEqual(cell.labels, [filter.label]);
940940
});

‎system-test/read-rows-acceptance-tests.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ const protosJson = path.resolve(__dirname, '../protos/protos.json');
3131
const root = ProtoBuf.Root.fromJSON(
3232
JSON.parse(fs.readFileSync(protosJson).toString())
3333
);
34-
// tslint:disable-next-line variable-name
3534
const ReadRowsResponse = root.lookupType('google.bigtable.v2.ReadRowsResponse');
36-
// tslint:disable-next-line variable-name
3735
const CellChunk = root.lookupType(
3836
'google.bigtable.v2.ReadRowsResponse.CellChunk'
3937
);
4038
describe('Read Row Acceptance tests', () => {
4139
testcases.forEach(test => {
4240
it(test.name, done => {
4341
const table = new Table({id: 'xyz'} as Instance, 'my-table');
44-
// tslint:disable-next-line no-any
42+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4543
const results: any[] = [];
4644
const rawResults = test.results || [];
4745
const errorCount = rawResults.filter(result => result.error).length;
@@ -70,7 +68,7 @@ describe('Read Row Acceptance tests', () => {
7068
});
7169

7270
table.bigtable = {} as Bigtable;
73-
// tslint:disable-next-line no-any
71+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7472
(table.bigtable.request as any) = () => {
7573
const stream = new PassThrough({
7674
objectMode: true,
@@ -84,7 +82,7 @@ describe('Read Row Acceptance tests', () => {
8482
const cellChunk = CellChunk.decode(
8583
Buffer.from(chunk as string, 'base64')
8684
); //.decode64(chunk);
87-
// tslint:disable-next-line no-any
85+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8886
let readRowsResponse: any = {chunks: [cellChunk]};
8987
readRowsResponse = ReadRowsResponse.create(readRowsResponse);
9088
readRowsResponse = ReadRowsResponse.toObject(readRowsResponse, {
@@ -107,9 +105,9 @@ describe('Read Row Acceptance tests', () => {
107105
return row;
108106
});
109107

110-
// tslint:disable-next-line no-any
108+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
111109
const errors: any[] = [];
112-
// tslint:disable-next-line no-any
110+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
113111
const rows: any[] = [];
114112

115113
table

‎system-test/read-rows.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import {EventEmitter} from 'events';
2727
import {Test} from './testTypes';
2828
import {ServiceError} from '@grpc/grpc-js';
2929

30-
// tslint:disable-next-line no-any
30+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3131
function dispatch(emitter: EventEmitter, response: any) {
32-
// tslint:disable-next-line no-any
32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3333
const emits: any[] = [{name: 'request'}];
3434
if (response.row_keys) {
3535
emits.push.apply(emits, [
@@ -41,7 +41,7 @@ function dispatch(emitter: EventEmitter, response: any) {
4141
]);
4242
}
4343
if (response.end_with_error) {
44-
// tslint:disable-next-line no-any
44+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4545
const error: any = new Error();
4646
error.code = response.end_with_error;
4747
emits.push({name: 'error', arg: error});
@@ -76,7 +76,7 @@ function rowResponse(rowKey: {}) {
7676

7777
describe('Bigtable/Table', () => {
7878
const bigtable = new Bigtable();
79-
// tslint:disable-next-line no-any
79+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8080
(bigtable as any).grpcCredentials = grpc.credentials.createInsecure();
8181

8282
const INSTANCE = bigtable.instance('instance');
@@ -114,7 +114,7 @@ describe('Bigtable/Table', () => {
114114
const requestOptions = {} as google.bigtable.v2.IRowSet;
115115
if (reqOpts.rows && reqOpts.rows.rowRanges) {
116116
requestOptions.rowRanges = reqOpts.rows.rowRanges.map(
117-
// tslint:disable-next-line no-any
117+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
118118
(range: any) => {
119119
const convertedRowRange = {} as {[index: string]: string};
120120
Object.keys(range).forEach(
@@ -125,19 +125,19 @@ describe('Bigtable/Table', () => {
125125
);
126126
}
127127
if (reqOpts.rows && reqOpts.rows.rowKeys) {
128-
// tslint:disable-next-line no-any
128+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
129129
requestOptions.rowKeys = reqOpts.rows.rowKeys.map((rowKeys: any) =>
130130
rowKeys.asciiSlice()
131131
);
132132
}
133133
if (reqOpts.rowsLimit) {
134-
// tslint:disable-next-line no-any
134+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
135135
(requestOptions as any).rowsLimit = reqOpts.rowsLimit;
136136
}
137137
requestedOptions.push(requestOptions);
138138
rowKeysRead.push([]);
139139
const requestStream = through.obj();
140-
/* tslint:disable-next-line */
140+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
141141
(requestStream as any).abort = () => {};
142142
dispatch(requestStream, responses!.shift());
143143
return requestStream;

‎test/app-profile.ts

+24-5
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import {describe, it, before, beforeEach} from 'mocha';
1818
import * as proxyquire from 'proxyquire';
1919
import {CallOptions} from 'google-gax';
2020

21-
/* tslint:disable:no-any */
22-
2321
let promisified = false;
2422
const fakePromisify = Object.assign({}, promisify, {
2523
promisifyAll(klass: Function) {
@@ -39,12 +37,17 @@ describe('Bigtable/AppProfile', () => {
3937
};
4038

4139
const APP_PROFILE_NAME = `${INSTANCE.name}/appProfiles/${APP_PROFILE_ID}`;
40+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4241
let AppProfile: any;
42+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4343
let appProfile: any;
4444

4545
class FakeCluster {
46+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4647
instance: any;
48+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4749
id: any;
50+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4851
constructor(instance: any, id: any) {
4952
this.instance = instance;
5053
this.id = id;
@@ -97,7 +100,7 @@ describe('Bigtable/AppProfile', () => {
97100
it('should throw if cluster id in wrong format', () => {
98101
const id = `appProfiles/${APP_PROFILE_ID}`;
99102
assert.throws(() => {
100-
const a = new AppProfile(INSTANCE, id);
103+
new AppProfile(INSTANCE, id);
101104
}, Error);
102105
});
103106
});
@@ -159,8 +162,11 @@ describe('Bigtable/AppProfile', () => {
159162
const options = {};
160163

161164
appProfile.instance.createAppProfile = (
165+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
162166
id: any,
167+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
163168
options_: any,
169+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
164170
callback: any
165171
) => {
166172
assert.strictEqual(id, appProfile.id);
@@ -173,8 +179,11 @@ describe('Bigtable/AppProfile', () => {
173179

174180
it('should not require options', done => {
175181
appProfile.instance.createAppProfile = (
182+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
176183
id: any,
184+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
177185
options: any,
186+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
178187
callback: any
179188
) => {
180189
assert.deepStrictEqual(options, {});
@@ -187,6 +196,7 @@ describe('Bigtable/AppProfile', () => {
187196

188197
describe('delete', () => {
189198
it('should make the correct request', done => {
199+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
190200
appProfile.bigtable.request = (config: any, callback: any) => {
191201
assert.strictEqual(config.client, 'BigtableInstanceAdminClient');
192202
assert.strictEqual(config.method, 'deleteAppProfile');
@@ -204,6 +214,7 @@ describe('Bigtable/AppProfile', () => {
204214
it('should accept gaxOptions', done => {
205215
const gaxOptions = {};
206216

217+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
207218
appProfile.bigtable.request = (config: any) => {
208219
assert.strictEqual(config.gaxOpts, gaxOptions);
209220
done();
@@ -213,6 +224,7 @@ describe('Bigtable/AppProfile', () => {
213224
});
214225

215226
it('should accept ignoreWarnings', done => {
227+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
216228
appProfile.bigtable.request = (config: any) => {
217229
assert.strictEqual(config.reqOpts.ignoreWarnings, true);
218230
done();
@@ -354,6 +366,7 @@ describe('Bigtable/AppProfile', () => {
354366

355367
describe('getMetadata', () => {
356368
it('should make correct request', done => {
369+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
357370
appProfile.bigtable.request = (config: any) => {
358371
assert.strictEqual(config.client, 'BigtableInstanceAdminClient');
359372
assert.strictEqual(config.method, 'getAppProfile');
@@ -373,6 +386,7 @@ describe('Bigtable/AppProfile', () => {
373386
it('should accept gaxOptions', done => {
374387
const gaxOptions = {};
375388

389+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
376390
appProfile.bigtable.request = (config: any) => {
377391
assert.strictEqual(config.gaxOpts, gaxOptions);
378392
done();
@@ -398,7 +412,7 @@ describe('Bigtable/AppProfile', () => {
398412
const args = [{}, {}, {}];
399413

400414
appProfile.bigtable.request = (config: {}, callback: Function) => {
401-
callback.apply(null, args);
415+
callback(...args);
402416
};
403417

404418
appProfile.getMetadata((...argies: Array<{}>) => {
@@ -410,6 +424,7 @@ describe('Bigtable/AppProfile', () => {
410424

411425
describe('setMetadata', () => {
412426
it('should provide the proper request options', done => {
427+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
413428
appProfile.bigtable.request = (config: any, callback: Function) => {
414429
assert.strictEqual(config.client, 'BigtableInstanceAdminClient');
415430
assert.strictEqual(config.method, 'updateAppProfile');
@@ -423,6 +438,7 @@ describe('Bigtable/AppProfile', () => {
423438
it('should respect the description option', done => {
424439
const options = {description: 'my-description'};
425440

441+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
426442
appProfile.bigtable.request = (config: any) => {
427443
assert(
428444
config.reqOpts.updateMask.paths.indexOf('description') !== -1,
@@ -441,6 +457,7 @@ describe('Bigtable/AppProfile', () => {
441457
it('should respect the ignoreWarnings option', done => {
442458
const options = {ignoreWarnings: true};
443459

460+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
444461
appProfile.bigtable.request = (config: any) => {
445462
assert.strictEqual(config.reqOpts.ignoreWarnings, true);
446463
done();
@@ -456,6 +473,7 @@ describe('Bigtable/AppProfile', () => {
456473
it("has an 'any' value", done => {
457474
const options = {routing: 'any'};
458475

476+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
459477
appProfile.bigtable.request = (config: any) => {
460478
assert(
461479
config.reqOpts.updateMask.paths.indexOf(
@@ -476,6 +494,7 @@ describe('Bigtable/AppProfile', () => {
476494
it('has a cluster value', done => {
477495
const options = {routing: cluster};
478496

497+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
479498
appProfile.bigtable.request = (config: any) => {
480499
assert(
481500
config.reqOpts.updateMask.paths.indexOf(
@@ -497,7 +516,7 @@ describe('Bigtable/AppProfile', () => {
497516
it('should execute callback with all arguments', done => {
498517
const args = [{}, {}, {}];
499518
appProfile.bigtable.request = (config: {}, callback: Function) => {
500-
callback.apply(null, args);
519+
callback(...args);
501520
};
502521
appProfile.setMetadata({}, (...argies: Array<{}>) => {
503522
assert.deepStrictEqual([].slice.call(argies), args);

‎test/chunktransformer.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ const FakeMutation = {
4040
};
4141

4242
describe('Bigtable/ChunkTransformer', () => {
43+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4344
let ChunkTransformer: any;
44-
// tslint:disable:no-any
45+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4546
let chunkTransformer: any;
4647
let rows: Row[];
4748
before(() => {

‎test/cluster.ts

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import {before, beforeEach, describe, it} from 'mocha';
1818
import * as proxyquire from 'proxyquire';
1919
import {CallOptions} from 'google-gax';
2020

21-
// tslint:disable no-any
22-
2321
let promisified = false;
2422
const fakePromisify = Object.assign({}, promisify, {
2523
promisifyAll(klass: Function) {

‎test/family.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import * as promisify from '@google-cloud/promisify';
1616
import * as assert from 'assert';
17-
import {describe, it} from 'mocha';
17+
import {before, beforeEach, afterEach, describe, it} from 'mocha';
1818
import * as proxyquire from 'proxyquire';
1919
import * as sinon from 'sinon';
2020
import {google} from '../protos/protos';
@@ -94,7 +94,7 @@ describe('Bigtable/Family', () => {
9494
it('should throw if family id in wrong format', () => {
9595
const id = `/project/bad-project/instances/bad-instance/columnFamiles/${FAMILY_ID}`;
9696
assert.throws(() => {
97-
const f = new Family(TABLE, id);
97+
new Family(TABLE, id);
9898
}, Error);
9999
});
100100
});

‎test/filter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as assert from 'assert';
16-
import {describe, it} from 'mocha';
16+
import {afterEach, before, beforeEach, describe, it} from 'mocha';
1717
import * as proxyquire from 'proxyquire';
1818
import * as sinon from 'sinon';
1919
import * as fr from '../src/filter';

0 commit comments

Comments
 (0)