Skip to content

Commit 4eaf9be

Browse files
chore(dep)!: upgrade gts 2.0.0 (#194)
1 parent f6434ab commit 4eaf9be

14 files changed

+53
-49
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
**/node_modules
2-
src/**/doc/*
2+
**/.coverage
33
build/
44
docs/
55
protos/

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/gts"
3+
}

.eslintrc.yml

-15
This file was deleted.

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
node: [8, 10, 12, 13]
12+
node: [10, 12, 13]
1313
steps:
1414
- uses: actions/checkout@v1
1515
- uses: actions/setup-node@v1

.prettierignore

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
node_modules/*
2-
samples/node_modules/*
3-
src/**/doc/*
1+
**/node_modules
2+
**/.coverage
3+
build/
4+
docs/
5+
protos/

.prettierrc

-8
This file was deleted.

.prettierrc.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
module.exports = {
16+
...require('gts/.prettierrc.json')
17+
}

package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
"repository": "googleapis/nodejs-paginator",
88
"scripts": {
99
"test": "c8 mocha build/test",
10-
"lint": "gts check",
11-
"clean": "gts clean",
1210
"compile": "tsc -p .",
1311
"fix": "gts fix",
12+
"prelint": "cd samples; npm link ../; npm i",
13+
"lint": "gts check",
1414
"prepare": "npm run compile",
1515
"pretest": "npm run compile",
16-
"posttest": "npm run lint",
1716
"docs": "compodoc src/",
1817
"presystem-test": "npm run compile",
1918
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
@@ -36,11 +35,11 @@
3635
"@types/proxyquire": "^1.3.28",
3736
"@types/sinon": "^7.0.0",
3837
"@types/uuid": "^7.0.0",
38+
"c8": "^7.0.0",
3939
"codecov": "^3.0.4",
40-
"gts": "^1.0.0",
40+
"gts": "2.0.0-alpha.4",
4141
"linkinator": "^2.0.0",
42-
"mocha": "^7.0.0",
43-
"c8": "^7.0.0",
42+
"mocha": "^7.1.1",
4443
"proxyquire": "^2.0.1",
4544
"sinon": "^9.0.0",
4645
"typescript": "^3.8.3",

samples/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"license": "Apache-2.0",
44
"author": "Google LLC",
55
"engines": {
6-
"node": ">=8"
6+
"node": ">=10"
77
},
88
"repository": "googleapis/nodejs-paginator",
99
"private": true,

src/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class Paginator {
9191
Class.prototype[methodName + '_'] = originalMethod;
9292

9393
// overwrite the original to auto-paginate
94-
// tslint:disable-next-line:no-any
94+
/* eslint-disable @typescript-eslint/no-explicit-any */
9595
Class.prototype[methodName] = function(...args: any[]) {
9696
const parsedArguments = paginator.parseArguments_(args);
9797
return paginator.run_(parsedArguments, originalMethod.bind(this));
@@ -111,12 +111,12 @@ export class Paginator {
111111
* @param {string} methodName - Name of the method to streamify.
112112
* @return {function} - Wrapped function.
113113
*/
114-
// tslint:disable-next-line:no-any
114+
/* eslint-disable @typescript-eslint/no-explicit-any */
115115
streamify<T = any>(methodName: string) {
116116
return function(
117117
// tslint:disable-next-line:no-any
118118
this: {[index: string]: Function},
119-
// tslint:disable-next-line:no-any
119+
/* eslint-disable @typescript-eslint/no-explicit-any */
120120
...args: any[]
121121
): ResourceStream<T> {
122122
const parsedArguments = paginator.parseArguments_(args);
@@ -134,7 +134,7 @@ export class Paginator {
134134
* @param {array} args - The original `arguments` pseduo-array that the original
135135
* method received.
136136
*/
137-
// tslint:disable-next-line:no-any
137+
/* eslint-disable @typescript-eslint/no-explicit-any */
138138
parseArguments_(args: any[]) {
139139
let query: string | ParsedArguments | undefined;
140140
let autoPaginate = true;
@@ -255,7 +255,7 @@ export class Paginator {
255255
* and returns `nextQuery` to receive more results.
256256
* @return {stream} - Readable object stream.
257257
*/
258-
// tslint:disable-next-line:no-any
258+
/* eslint-disable @typescript-eslint/no-explicit-any */
259259
runAsStream_<T = any>(
260260
parsedArguments: ParsedArguments,
261261
originalMethod: Function

src/resource-stream.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ResourceStream<T> extends Transform implements ResourceEvents<T> {
4747
this._requestsMade = 0;
4848
this._resultsToSend = args.maxResults === -1 ? Infinity : args.maxResults!;
4949
}
50-
// tslint:disable-next-line:no-any
50+
/* eslint-disable @typescript-eslint/no-explicit-any */
5151
end(...args: any[]) {
5252
this._ended = true;
5353
return super.end(...args);

test/index.ts

+12-7
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 {describe, it, beforeEach, afterEach} from 'mocha';
1717
import * as proxyquire from 'proxyquire';
1818
import * as sinon from 'sinon';
1919
import {PassThrough, Transform} from 'stream';
@@ -22,13 +22,16 @@ import * as P from '../src';
2222
import {paginator, ParsedArguments} from '../src';
2323

2424
const util = {
25-
noop: () => {},
25+
noop: () => {
26+
// do nothing
27+
},
2628
};
2729

2830
class FakeResourceStream extends Transform {
2931
calledWith: IArguments;
3032
constructor() {
3133
super({objectMode: true});
34+
/* eslint-disable-next-line prefer-rest-params */
3235
this.calledWith = arguments;
3336
}
3437
}
@@ -39,18 +42,21 @@ const p = proxyquire('../src', {
3942

4043
const sandbox = sinon.createSandbox();
4144

45+
// eslint-disable-next-line no-undef
4246
afterEach(() => {
4347
sandbox.restore();
4448
});
4549

46-
// tslint:disable-next-line no-any
50+
/* eslint-disable @typescript-eslint/no-explicit-any */
4751
function createFakeStream<T = any>() {
4852
return new PassThrough({objectMode: true}) as P.ResourceStream<T>;
4953
}
5054

5155
describe('paginator', () => {
5256
const UUID = uuid.v1();
53-
function FakeClass() {}
57+
function FakeClass() {
58+
// do nothing
59+
}
5460

5561
beforeEach(() => {
5662
FakeClass.prototype.methodToExtend = () => {
@@ -75,7 +81,6 @@ describe('paginator', () => {
7581

7682
it('should accept an array or string method names', () => {
7783
const originalMethod = FakeClass.prototype.methodToExtend;
78-
FakeClass.prototype.anotherMethodToExtend = () => {};
7984
const anotherMethod = FakeClass.prototype.anotherMethodToExtend;
8085
const methodsToExtend = ['methodToExtend', 'anotherMethodToExtend'];
8186
paginator.extend(FakeClass, methodsToExtend);
@@ -117,7 +122,7 @@ describe('paginator', () => {
117122
return this.uuid;
118123
};
119124

120-
// tslint:disable-next-line:no-any
125+
/* eslint-disable @typescript-eslint/no-explicit-any */
121126
const cls = new (FakeClass as any)();
122127
cls.uuid = uuid.v1();
123128

@@ -159,7 +164,7 @@ describe('paginator', () => {
159164
return args as ParsedArguments;
160165
});
161166
sandbox.stub(paginator, 'runAsStream_').callsFake(createFakeStream);
162-
FakeClass.prototype.streamMethod.apply(FakeClass.prototype, fakeArgs);
167+
FakeClass.prototype.streamMethod(...fakeArgs);
163168
});
164169

165170
it('should run the method as a stream', done => {

test/resource-stream.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 {describe, it, beforeEach, afterEach} from 'mocha';
1717
import * as sinon from 'sinon';
1818
import {Transform} from 'stream';
1919

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "./node_modules/gts/tsconfig-google.json",
33
"compilerOptions": {
4+
"lib": ["es2018", "dom"],
45
"rootDir": ".",
56
"outDir": "build"
67
},

0 commit comments

Comments
 (0)