Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit 470bc81

Browse files
style: remove eslint ignores (#1963)
* refactor: remove all eslint ignores * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent ed6296b commit 470bc81

16 files changed

Lines changed: 89 additions & 88 deletions

.github/scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"js-yaml": "^4.1.0"
1515
},
1616
"devDependencies": {
17-
"@octokit/rest": "^21.0.0",
17+
"@octokit/rest": "^19.0.0",
1818
"mocha": "^10.0.0",
1919
"sinon": "^18.0.0"
2020
}

.github/workflows/issues-no-repro.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
pull-requests: write
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@v4
14+
- uses: actions/setup-node@v3
1515
with:
1616
node-version: 18
1717
- run: npm install

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"test": "c8 mocha build/test",
7171
"clean": "gts clean",
7272
"prepare": "npm run compile",
73-
"lint": "gts check",
73+
"lint": "gts check --no-inline-config",
7474
"compile": "tsc -p .",
7575
"fix": "gts fix",
7676
"pretest": "npm run compile -- --sourceMap",

test/test.awsclient.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const ONE_HOUR_IN_SECS = 3600;
3636

3737
describe('AwsClient', () => {
3838
let clock: sinon.SinonFakeTimers;
39-
// eslint-disable-next-line @typescript-eslint/no-var-requires
4039
const awsSecurityCredentials = require('../../test/fixtures/aws-security-credentials-fake.json');
4140
const referenceDate = new Date('2020-08-11T06:55:22.345Z');
4241
const amzDate = '20200811T065522Z';
@@ -201,8 +200,7 @@ describe('AwsClient', () => {
201200
'No valid AWS "credential_source" provided',
202201
);
203202
const invalidCredentialSource = Object.assign({}, awsCredentialSource);
204-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
205-
delete (invalidCredentialSource as any)[required];
203+
delete (invalidCredentialSource as ReturnType<JSON['parse']>)[required];
206204
const invalidOptions = {
207205
type: 'external_account',
208206
audience,

test/test.awsrequestsigner.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ interface AwsRequestSignerTest {
3535
describe('AwsRequestSigner', () => {
3636
let clock: sinon.SinonFakeTimers;
3737
// Load AWS credentials from a sample security_credentials response.
38-
// eslint-disable-next-line @typescript-eslint/no-var-requires
3938
const awsSecurityCredentials = require('../../test/fixtures/aws-security-credentials-fake.json');
4039
const accessKeyId = awsSecurityCredentials.AccessKeyId;
4140
const secretAccessKey = awsSecurityCredentials.SecretAccessKey;

test/test.externalaccountauthorizeduserclient.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ describe('ExternalAccountAuthorizedUserClient', () => {
4949
interface NockMockRefreshResponse {
5050
statusCode: number;
5151
response: TokenRefreshResponse | OAuthErrorResponse;
52-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
53-
request: {[key: string]: any};
52+
request: ReturnType<JSON['parse']>;
5453
times?: number;
5554
}
5655

test/test.externalclient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ describe('ExternalAccountClient', () => {
229229

230230
it('should return null when given non-ExternalAccountClientOptions', () => {
231231
assert(
232-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
233-
ExternalAccountClient.fromJSON(serviceAccountKeys as any) === null,
232+
ExternalAccountClient.fromJSON(
233+
serviceAccountKeys as ReturnType<JSON['parse']>,
234+
) === null,
234235
);
235236
});
236237

@@ -246,8 +247,7 @@ describe('ExternalAccountClient', () => {
246247

247248
it('should throw when given invalid IdentityPoolClient', () => {
248249
const invalidOptions = Object.assign({}, fileSourcedOptions);
249-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
250-
(invalidOptions as any).credential_source = {};
250+
(invalidOptions as ReturnType<JSON['parse']>).credential_source = {};
251251

252252
assert.throws(() => {
253253
return ExternalAccountClient.fromJSON(invalidOptions);

test/test.googleauth.ts

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,10 @@ describe('googleauth', () => {
8484
STUB_PROJECT,
8585
].join('/');
8686

87-
// eslint-disable-next-line @typescript-eslint/no-var-requires
8887
const privateJSON = require('../../test/fixtures/private.json');
89-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9088
const private2JSON = require('../../test/fixtures/private2.json');
91-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9289
const refreshJSON = require('../../test/fixtures/refresh.json');
93-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9490
const externalAccountJSON = require('../../test/fixtures/external-account-cred.json');
95-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9691
const externalAccountAuthorizedUserJSON = require('../../test/fixtures/external-account-authorized-user-cred.json');
9792
const privateKey = fs.readFileSync('./test/fixtures/private.pem', 'utf-8');
9893
const wellKnownPathWindows = path.join(
@@ -268,8 +263,9 @@ describe('googleauth', () => {
268263
function mockGCE() {
269264
const scope1 = nockIsGCE();
270265
const auth = new GoogleAuth();
271-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
272-
sinon.stub(auth as any, 'getDefaultServiceProjectId').resolves();
266+
sinon
267+
.stub(auth as ReturnType<JSON['parse']>, 'getDefaultServiceProjectId')
268+
.resolves();
273269
const scope2 = nock(HOST_ADDRESS)
274270
.get(tokenPath)
275271
.reply(200, {access_token: 'abc123', expires_in: 10000}, HEADERS);
@@ -346,8 +342,7 @@ describe('googleauth', () => {
346342
const auth = new GoogleAuth();
347343
assert.throws(() => {
348344
// Test verifies invalid parameter tests, which requires cast to any.
349-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
350-
(auth as any).fromJSON(null);
345+
(auth as ReturnType<JSON['parse']>).fromJSON(null);
351346
});
352347
});
353348

@@ -508,8 +503,7 @@ describe('googleauth', () => {
508503

509504
it('fromStream should error on null stream', done => {
510505
// Test verifies invalid parameter tests, which requires cast to any.
511-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
512-
(auth as any).fromStream(null, (err: Error) => {
506+
(auth as ReturnType<JSON['parse']>).fromStream(null, (err: Error) => {
513507
assert.strictEqual(true, err instanceof Error);
514508
done();
515509
});
@@ -599,8 +593,9 @@ describe('googleauth', () => {
599593
it('getApplicationCredentialsFromFilePath should error on null file path', async () => {
600594
try {
601595
// Test verifies invalid parameter tests, which requires cast to any.
602-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
603-
await (auth as any)._getApplicationCredentialsFromFilePath(null);
596+
await (
597+
auth as ReturnType<JSON['parse']>
598+
)._getApplicationCredentialsFromFilePath(null);
604599
} catch (e) {
605600
return;
606601
}
@@ -619,8 +614,9 @@ describe('googleauth', () => {
619614
it('getApplicationCredentialsFromFilePath should error on non-string file path', async () => {
620615
try {
621616
// Test verifies invalid parameter tests, which requires cast to any.
622-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
623-
await auth._getApplicationCredentialsFromFilePath(2 as any);
617+
await auth._getApplicationCredentialsFromFilePath(
618+
2 as ReturnType<JSON['parse']>,
619+
);
624620
} catch (e) {
625621
return;
626622
}
@@ -842,8 +838,7 @@ describe('googleauth', () => {
842838
assert.strictEqual(projectId, STUB_PROJECT);
843839

844840
// Null out all the private functions that make this method work
845-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
846-
const anyd = auth as any;
841+
const anyd = auth as ReturnType<JSON['parse']>;
847842
anyd.getProductionProjectId = null;
848843
anyd.getFileProjectId = null;
849844
anyd.getDefaultServiceProjectId = null;
@@ -969,13 +964,14 @@ describe('googleauth', () => {
969964
// Make sure our special test bit is not set yet, indicating that
970965
// this is a new credentials instance.
971966
// Test verifies invalid parameter tests, which requires cast to any.
972-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
973-
assert.strictEqual(undefined, (cachedCredential as any).specialTestBit);
967+
assert.strictEqual(
968+
undefined,
969+
(cachedCredential as ReturnType<JSON['parse']>).specialTestBit,
970+
);
974971

975972
// Now set the special test bit.
976973
// Test verifies invalid parameter tests, which requires cast to any.
977-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
978-
(cachedCredential as any).specialTestBit = 'monkey';
974+
(cachedCredential as ReturnType<JSON['parse']>).specialTestBit = 'monkey';
979975

980976
// Ask for credentials again, from the same auth instance. We expect
981977
// a cached instance this time.
@@ -987,8 +983,10 @@ describe('googleauth', () => {
987983
// the object instance is the same.
988984
// Test verifies invalid parameter tests, which requires cast to
989985
// any.
990-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
991-
assert.strictEqual('monkey', (result2 as any).specialTestBit);
986+
assert.strictEqual(
987+
'monkey',
988+
(result2 as ReturnType<JSON['parse']>).specialTestBit,
989+
);
992990
assert.strictEqual(cachedCredential, result2);
993991

994992
// Now create a second GoogleAuth instance, and ask for
@@ -1000,8 +998,10 @@ describe('googleauth', () => {
1000998
// Make sure we get a new (non-cached) credential instance back.
1001999
// Test verifies invalid parameter tests, which requires cast to
10021000
// any.
1003-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1004-
assert.strictEqual(undefined, (result3 as any).specialTestBit);
1001+
assert.strictEqual(
1002+
undefined,
1003+
(result3 as ReturnType<JSON['parse']>).specialTestBit,
1004+
);
10051005
assert.notStrictEqual(cachedCredential, result3);
10061006
});
10071007

@@ -1467,8 +1467,9 @@ describe('googleauth', () => {
14671467
});
14681468

14691469
it('should throw if getProjectId cannot find a projectId', async () => {
1470-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1471-
sinon.stub(auth as any, 'getDefaultServiceProjectId').resolves();
1470+
sinon
1471+
.stub(auth as ReturnType<JSON['parse']>, 'getDefaultServiceProjectId')
1472+
.resolves();
14721473
await assert.rejects(
14731474
auth.getProjectId(),
14741475
/Unable to detect a Project Id in the current environment/,

test/test.identitypoolclient.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ describe('IdentityPoolClient', () => {
218218
};
219219

220220
assert.throws(() => {
221-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
222-
return new IdentityPoolClient(invalidOptions as any);
221+
return new IdentityPoolClient(
222+
invalidOptions as ReturnType<JSON['parse']>,
223+
);
223224
}, expectedError);
224225
});
225226

@@ -238,10 +239,11 @@ describe('IdentityPoolClient', () => {
238239
},
239240
};
240241

241-
assert.throws(() => {
242-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
243-
return new IdentityPoolClient(invalidOptions as any);
244-
}, expectedError);
242+
assert.throws(
243+
() =>
244+
new IdentityPoolClient(invalidOptions as ReturnType<JSON['parse']>),
245+
expectedError,
246+
);
245247
});
246248

247249
it('should throw on invalid credential_source.format.type', () => {
@@ -260,8 +262,9 @@ describe('IdentityPoolClient', () => {
260262
};
261263

262264
assert.throws(() => {
263-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
264-
return new IdentityPoolClient(invalidOptions as any);
265+
return new IdentityPoolClient(
266+
invalidOptions as ReturnType<JSON['parse']>,
267+
);
265268
}, expectedError);
266269
});
267270

@@ -315,8 +318,9 @@ describe('IdentityPoolClient', () => {
315318
};
316319

317320
assert.throws(() => {
318-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
319-
return new IdentityPoolClient(invalidOptions as any);
321+
return new IdentityPoolClient(
322+
invalidOptions as ReturnType<JSON['parse']>,
323+
);
320324
}, expectedError);
321325
});
322326

@@ -334,8 +338,9 @@ describe('IdentityPoolClient', () => {
334338
};
335339

336340
assert.throws(() => {
337-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
338-
return new IdentityPoolClient(invalidOptions as any);
341+
return new IdentityPoolClient(
342+
invalidOptions as ReturnType<JSON['parse']>,
343+
);
339344
}, expectedError);
340345
});
341346

test/test.index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import * as gal from '../src';
1717

1818
describe('index', () => {
1919
it('should publicly export GoogleAuth', () => {
20-
// eslint-disable-next-line @typescript-eslint/no-var-requires
2120
const cjs = require('../src/');
2221
assert.strictEqual(cjs.GoogleAuth, gal.GoogleAuth);
2322
});

0 commit comments

Comments
 (0)