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

@@ -26,7 +26,7 @@ export async function zendeskApiRequest(
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
) {
const authenticationMethod = this.getNodeParameter('authentication', 0);
let credentials;
@@ -49,7 +49,7 @@ export async function zendeskApiRequest(
};
options = Object.assign({}, options, option);
if (Object.keys(options.body).length === 0) {
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
@@ -80,7 +80,7 @@ export async function zendeskApiRequestAllItems(
do {
responseData = await zendeskApiRequest.call(this, method, resource, body, query, uri);
uri = responseData.next_page;
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
if (query.limit && query.limit <= returnData.length) {
return returnData;
}

View File

@@ -7,6 +7,7 @@ import type {
INodePropertyOptions,
INodeType,
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@@ -141,7 +142,7 @@ export class Zendesk implements INodeType {
'/ticket_fields',
);
for (const field of fields) {
if (customFields.includes(field.type)) {
if (customFields.includes(field.type as string)) {
const fieldName = field.title;
const fieldId = field.id;
returnData.push({
@@ -477,7 +478,7 @@ export class Zendesk implements INodeType {
);
responseData = responseData.ticket;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
}
@@ -787,7 +788,7 @@ export class Zendesk implements INodeType {
}
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);

View File

@@ -165,7 +165,7 @@ export class ZendeskTrigger implements INodeType {
'/ticket_fields',
);
for (const field of fields) {
if (customFields.includes(field.type) && field.removable && field.active) {
if (customFields.includes(field.type as string) && field.removable && field.active) {
const fieldName = field.title;
const fieldId = field.id;
returnData.push({
@@ -218,7 +218,6 @@ export class ZendeskTrigger implements INodeType {
},
};
// @ts-ignore
webhookMethods = {
default: {
async checkExists(this: IHookFunctions): Promise<boolean> {
@@ -316,7 +315,6 @@ export class ZendeskTrigger implements INodeType {
if (options.fields) {
for (const field of options.fields as string[]) {
// @ts-ignore
message[field] = `{{${field}}}`;
}
} else {
@@ -400,8 +398,10 @@ export class ZendeskTrigger implements INodeType {
.webhook as IDataObject;
}
// @ts-ignore
bodyTrigger.trigger.actions[0].value = [target.id, JSON.stringify(message)];
((bodyTrigger.trigger as IDataObject).actions as IDataObject[])[0].value = [
target.id,
JSON.stringify(message),
];
const { trigger } = await zendeskApiRequest.call(this, 'POST', '/triggers', bodyTrigger);
webhookData.webhookId = trigger.id;
@@ -427,7 +427,7 @@ export class ZendeskTrigger implements INodeType {
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const req = this.getRequestObject();
return {
workflowData: [this.helpers.returnJsonArray(req.body)],
workflowData: [this.helpers.returnJsonArray(req.body as IDataObject)],
};
}
}