fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)

This commit is contained in:
Michael Kret
2023-02-28 05:39:43 +02:00
committed by GitHub
parent 3172ea376e
commit bb4db58819
560 changed files with 2227 additions and 1919 deletions

View File

@@ -8,7 +8,7 @@ import type {
IWebhookFunctions,
} from 'n8n-core';
import type { IDataObject } from 'n8n-workflow';
import type { IDataObject, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function stravaApiRequest(
@@ -20,12 +20,11 @@ export async function stravaApiRequest(
| IWebhookFunctions,
method: string,
resource: string,
body: any = {},
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
headers: IDataObject = {},
): Promise<any> {
) {
const options: OptionsWithUri = {
method,
form: body,
@@ -50,16 +49,15 @@ export async function stravaApiRequest(
body.client_id = credentials.clientId;
body.client_secret = credentials.clientSecret;
}
//@ts-ignore
return await this.helpers?.request(options);
} else {
//@ts-ignore
return await this.helpers.requestOAuth2.call(this, 'stravaOAuth2Api', options, {
includeCredentialsOnRefreshOnBody: true,
});
}
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -68,9 +66,9 @@ export async function stravaApiRequestAllItems(
method: string,
resource: string,
body: any = {},
body: IDataObject = {},
query: IDataObject = {},
): Promise<any> {
) {
const returnData: IDataObject[] = [];
let responseData;
@@ -82,7 +80,7 @@ export async function stravaApiRequestAllItems(
do {
responseData = await stravaApiRequest.call(this, method, resource, body, query);
query.page++;
returnData.push.apply(returnData, responseData);
returnData.push.apply(returnData, responseData as IDataObject[]);
} while (responseData.length !== 0);
return returnData;