Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
chore: update linter and packages (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Apr 14, 2020
1 parent d1062cf commit 955c0b5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 36 deletions.
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
],
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"lint": "gts check && eslint '**/*.js'",
"lint": "gts check",
"test": "c8 mocha build/test",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"presystem-test": "npm run compile",
"system-test": "mocha build/system-test --timeout 600000",
"clean": "gts clean",
"compile": "tsc -p .",
"fix": "eslint --fix '**/*.js' && gts fix",
"fix": "gts fix",
"prepare": "npm run compile",
"pretest": "npm run compile",
"docs-test": "linkinator docs",
Expand All @@ -60,19 +60,13 @@
"@types/tmp": "0.1.0",
"@types/uuid": "^7.0.2",
"c8": "^7.0.0",
"chai": "^4.2.0",
"codecov": "^3.0.2",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"gts": "^2.0.0-alpha.9",
"gts": "^2.0.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^2.0.0",
"mocha": "^7.1.1",
"prettier": "^1.13.5",
"proxyquire": "^2.0.1",
"tmp": "^0.1.0",
"typescript": "^3.8.3",
Expand Down
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Google Inc.",
"repository": "googleapis/nodejs-dns",
"engines": {
"node": ">=8"
"node": ">=10"
},
"files": [
"*.js",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class DNS extends Service {
callback!(err, null, null, resp);
return;
}
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const zones = arrify(resp.managedZones).map((zone: any) => {
const zoneInstance = this.zone(zone.name);
zoneInstance.metadata = zone;
Expand Down
4 changes: 2 additions & 2 deletions src/zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class Zone extends ZoneServiceObject {
config: CreateZoneRequest,
callback?: CreateZoneCallback
): void | Promise<CreateZoneResponse> {
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const args = [config, callback!] as any;
ServiceObject.prototype.create.apply(this, args);
}
Expand Down Expand Up @@ -1088,7 +1088,7 @@ class Zone extends ZoneServiceObject {
const recordsToCreate: Record[] = [];
recordTypes.forEach(recordType => {
const recordTypeSet = arrify(parsedZonefile[recordType]);
// tslint:disable-next-line no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
recordTypeSet.forEach((record: any) => {
record.ttl = record.ttl || defaultTTL;
recordsToCreate.push(
Expand Down
5 changes: 2 additions & 3 deletions system-test/dns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('dns', () => {
});

// deal with eventual consistency of ZONE.create():
it('should return 0 or more zones', async function() {
it('should return 0 or more zones', async function () {
this.retries(3);
await delayMs(1000);
const zones = await dns.getZones();
Expand Down Expand Up @@ -285,8 +285,7 @@ describe('dns', () => {
const onRecordsReceived = (
err?: Error | null,
records?: Record[] | null,
nextQuery?: {} | null,
apiResponse?: Metadata
nextQuery?: {} | null
) => {
if (nextQuery) {
ZONE.getRecords(nextQuery, onRecordsReceived);
Expand Down
5 changes: 3 additions & 2 deletions test/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as proxyquire from 'proxyquire';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {Change} from '../src/change';

let promisified = false;
Expand All @@ -43,9 +44,9 @@ class FakeServiceObject extends ServiceObject {
}

describe('Change', () => {
// tslint:disable-next-line:variable-name no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let Change: any;
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let change: any;

const ZONE = {
Expand Down
4 changes: 2 additions & 2 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ class FakeZone {
}

describe('DNS', () => {
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let DNS: any;
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let dns: any;

const PROJECT_ID = 'project-id';
Expand Down
5 changes: 3 additions & 2 deletions test/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as assert from 'assert';
import {describe, it, before, beforeEach} from 'mocha';
import * as proxyquire from 'proxyquire';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {Record} from '../src';

let promisified = false;
Expand All @@ -31,9 +32,9 @@ const fakePromisify = Object.assign({}, promisify, {
});

describe('Record', () => {
// tslint:disable-next-line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let Record: any;
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let record: any;

const ZONE = {
Expand Down
28 changes: 14 additions & 14 deletions test/zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {CoreOptions, OptionsWithUri, Response} from 'request';
import * as uuid from 'uuid';

import {Change, CreateChangeRequest} from '../src/change';
import {Record, RecordObject} from '../src/record';
import {Record, RecordObject, RecordMetadata} from '../src/record';

let promisified = false;
const fakePromisify = Object.assign({}, promisify, {
Expand Down Expand Up @@ -57,27 +57,27 @@ const fakeFs = {
};

class FakeChange {
calledWith_: any[];
constructor(...args: any[]) {
calledWith_: Array<{}>;
constructor(...args: Array<{}>) {
this.calledWith_ = args;
}
}

class FakeRecord {
calledWith_: any[];
constructor(...args: any[]) {
calledWith_: Array<{}>;
constructor(...args: Array<{}>) {
this.calledWith_ = args;
}
static fromZoneRecord_(...args: any[]) {
static fromZoneRecord_(...args: Array<{}>) {
const record = new FakeRecord();
record.calledWith_ = args;
return record;
}
}

class FakeServiceObject extends ServiceObject {
calledWith_: any[];
constructor(config: ServiceObjectConfig, ...args: any[]) {
calledWith_: Array<{}>;
constructor(config: ServiceObjectConfig, ...args: Array<{}>) {
super(config);
this.calledWith_ = args;
}
Expand All @@ -102,9 +102,9 @@ const fakePaginator = {
};

describe('Zone', () => {
// tslint:disable-next-line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let Zone: any;
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let zone: any;

const DNS = {
Expand Down Expand Up @@ -358,7 +358,7 @@ describe('Zone', () => {
});

it('should try to delete again after emptying', done => {
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(FakeServiceObject.prototype as any).delete = () => {
done();
};
Expand Down Expand Up @@ -881,7 +881,7 @@ describe('Zone', () => {

describe('success', () => {
const recordType = 'ns';
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let parsedZonefile: any = {};

beforeEach(() => {
Expand Down Expand Up @@ -926,9 +926,9 @@ describe('Zone', () => {
parsedZonefile.mx = {ttl: '180'};
zone.addRecords = (recordsToCreate: FakeRecord[]) => {
const record1 = recordsToCreate[0].calledWith_[2];
assert.strictEqual(record1.ttl, defaultTTL);
assert.strictEqual((record1 as RecordMetadata).ttl, defaultTTL);
const record2 = recordsToCreate[1].calledWith_[2];
assert.strictEqual(record2.ttl, '180');
assert.strictEqual((record2 as RecordMetadata).ttl, '180');
done();
};
zone.import(path, done);
Expand Down

0 comments on commit 955c0b5

Please sign in to comment.