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

@@ -2,7 +2,7 @@ import type { OptionsWithUri } from 'request';
import type { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
import type { IDataObject, INodePropertyOptions } from 'n8n-workflow';
import type { IDataObject, INodePropertyOptions, JsonObject } from 'n8n-workflow';
import { LoggerProxy as Logger, NodeApiError } from 'n8n-workflow';
import moment from 'moment-timezone';
@@ -29,11 +29,10 @@ function getOptions(
json: true,
};
if (!Object.keys(options.body).length) {
if (!Object.keys(options.body as IDataObject).length) {
delete options.body;
}
//@ts-ignore
return options;
}
@@ -130,11 +129,11 @@ export async function salesforceApiRequest(
`Authentication for "Salesforce" node is using "OAuth2". Invoking URI ${options.uri}`,
);
Object.assign(options, option);
//@ts-ignore
return await this.helpers.requestOAuth2.call(this, credentialsType, options);
}
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -155,7 +154,7 @@ export async function salesforceApiRequestAllItems(
do {
responseData = await salesforceApiRequest.call(this, method, endpoint, body, query, uri);
uri = `${endpoint}/${responseData.nextRecordsUrl?.split('/')?.pop()}`;
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData.nextRecordsUrl !== undefined && responseData.nextRecordsUrl !== null);
return returnData;
@@ -178,7 +177,7 @@ export function sortOptions(options: INodePropertyOptions[]): void {
}
export function getValue(value: any) {
if (moment(value).isValid()) {
if (moment(value as string).isValid()) {
return value;
} else if (typeof value === 'string') {
return `'${value}'`;