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

@@ -1,6 +1,6 @@
import type { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
import type { IDataObject, IHookFunctions } from 'n8n-workflow';
import type { IDataObject, IHookFunctions, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function kitemakerRequest(
@@ -24,7 +24,7 @@ export async function kitemakerRequest(
const responseData = await this.helpers.request.call(this, options);
if (responseData.errors) {
throw new NodeApiError(this.getNode(), responseData);
throw new NodeApiError(this.getNode(), responseData as JsonObject);
}
return responseData;
@@ -56,7 +56,7 @@ export async function kitemakerRequestAllItems(
do {
responseData = await kitemakerRequest.call(this, body);
body.variables.cursor = responseData.data[group].cursor;
returnData.push(...responseData.data[group][items]);
returnData.push(...(responseData.data[group][items] as IDataObject[]));
if (!returnAll && returnData.length > limit) {
return returnData.slice(0, limit);
@@ -66,8 +66,9 @@ export async function kitemakerRequestAllItems(
return returnData;
}
export type LoadOptions = { name?: string; username?: string; title?: string; id: string };
export function createLoadOptions(
resources: Array<{ name?: string; username?: string; title?: string; id: string }>,
resources: LoadOptions[],
): Array<{ name: string; value: string }> {
return resources.map((option) => {
if (option.username) return { name: option.username, value: option.id };