Skip to content

Commit fd76e63

Browse files
style: remove eslint ignores (#698)
* refactor: remove all eslint ignores * fix: gts command * šŸ¦‰ 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 9fd189f commit fd76e63

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

ā€Žcore/packages/gaxios/package.jsonā€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
"scripts": {
23-
"lint": "gts check",
23+
"lint": "gts check --no-inline-config",
2424
"test": "c8 mocha build/esm/test",
2525
"presystem-test": "npm run compile",
2626
"system-test": "mocha build/esm/system-test --timeout 80000",

ā€Žcore/packages/gaxios/src/common.tsā€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export interface AIPErrorInterface {
5656
*/
5757
export const GAXIOS_ERROR_SYMBOL = Symbol.for(`${pkg.name}-gaxios-error`);
5858

59-
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
60-
export class GaxiosError<T = any> extends Error {
59+
export class GaxiosError<T = ReturnType<JSON['parse']>> extends Error {
6160
/**
6261
* An error code.
6362
* Can be a system error code, DOMException error name, or any error's 'code' property where it is a `string`.

ā€Žcore/packages/gaxios/src/gaxios.tsā€Ž

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ export class Gaxios implements FetchCompliance {
135135
* Perform an HTTP request with the given options.
136136
* @param opts Set of HTTP options that will be used for this HTTP request.
137137
*/
138-
async request<T = any>(opts: GaxiosOptions = {}): GaxiosPromise<T> {
138+
async request<T = ReturnType<JSON['parse']>>(
139+
opts: GaxiosOptions = {},
140+
): GaxiosPromise<T> {
139141
let prepared = await this.#prepareRequest(opts);
140142
prepared = await this.#applyRequestInterceptors(prepared);
141143
return this.#applyResponseInterceptors(this._request(prepared));
@@ -177,7 +179,7 @@ export class Gaxios implements FetchCompliance {
177179
* Internal, retryable version of the `request` method.
178180
* @param opts Set of HTTP options that will be used for this HTTP request.
179181
*/
180-
protected async _request<T = any>(
182+
protected async _request<T = ReturnType<JSON['parse']>>(
181183
opts: GaxiosOptionsPrepared,
182184
): GaxiosPromise<T> {
183185
try {
@@ -252,7 +254,7 @@ export class Gaxios implements FetchCompliance {
252254
private async getResponseData(
253255
opts: GaxiosOptionsPrepared,
254256
res: Response,
255-
): Promise<any> {
257+
): Promise<ReturnType<JSON['parse']>> {
256258
if (
257259
opts.maxContentLength &&
258260
res.headers.has('content-length') &&
@@ -572,11 +574,11 @@ export class Gaxios implements FetchCompliance {
572574
/**
573575
* Attempts to parse a response by looking at the Content-Type header.
574576
* @param {Response} response the HTTP response.
575-
* @returns {Promise<any>} a promise that resolves to the response data.
577+
* @returns a promise that resolves to the response data.
576578
*/
577579
private async getResponseDataFromContentType(
578580
response: Response,
579-
): Promise<any> {
581+
): Promise<ReturnType<JSON['parse']>> {
580582
let contentType = response.headers.get('Content-Type');
581583
if (contentType === null) {
582584
// Maintain existing functionality by calling text()

ā€Žcore/packages/gaxios/test/test.getch.tsā€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,8 +1237,7 @@ describe('šŸ‚ defaults & instances', () => {
12371237
getAgentCache() {
12381238
return this.agentCache;
12391239
}
1240-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1241-
protected async _request<T = any>(
1240+
protected async _request<T = ReturnType<JSON['parse']>>(
12421241
opts: GaxiosOptionsPrepared,
12431242
): GaxiosPromise<T> {
12441243
assert(opts.agent);

ā€Žcore/packages/gaxios/test/test.retry.tsā€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ describe('šŸ›ø retry & exponential backoff', () => {
104104
try {
105105
await req;
106106
throw Error('unreachable');
107-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
108-
} catch (err: any) {
107+
} catch (err) {
108+
assert(err instanceof GaxiosError);
109109
assert(err.config);
110-
assert.strictEqual(err.config.retryConfig.currentRetryAttempt, 0);
110+
assert.strictEqual(err.config.retryConfig?.currentRetryAttempt, 0);
111111
}
112112
});
113113

0 commit comments

Comments
Ā (0)
⚔