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

@@ -10,6 +10,7 @@ import type {
IDataObject,
INodeExecutionData,
IPollFunctions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@@ -161,7 +162,7 @@ export async function googleApiRequest(
resource.charAt(0).toUpperCase() + resource.slice(1)
} IDs should look something like this: 182b676d244938bd`,
};
throw new NodeApiError(this.getNode(), error, errorOptions);
throw new NodeApiError(this.getNode(), error as JsonObject, errorOptions);
}
}
@@ -174,7 +175,7 @@ export async function googleApiRequest(
message: `${resource.charAt(0).toUpperCase() + resource.slice(1)} not found`,
description: '',
};
throw new NodeApiError(this.getNode(), error, errorOptions);
throw new NodeApiError(this.getNode(), error as JsonObject, errorOptions);
}
if (error.httpCode === '409') {
@@ -184,7 +185,7 @@ export async function googleApiRequest(
message: 'Label name exists already',
description: '',
};
throw new NodeApiError(this.getNode(), error, errorOptions);
throw new NodeApiError(this.getNode(), error as JsonObject, errorOptions);
}
}
@@ -193,7 +194,7 @@ export async function googleApiRequest(
message: error?.body?.error_description || 'Authorization error',
description: (error as Error).message,
};
throw new NodeApiError(this.getNode(), error, errorOptions);
throw new NodeApiError(this.getNode(), error as JsonObject, errorOptions);
}
if (
@@ -204,10 +205,10 @@ export async function googleApiRequest(
message: error.description,
description: '',
};
throw new NodeApiError(this.getNode(), error, errorOptions);
throw new NodeApiError(this.getNode(), error as JsonObject, errorOptions);
}
throw new NodeApiError(this.getNode(), error, {
throw new NodeApiError(this.getNode(), error as JsonObject, {
message: error.message,
description: error.description,
});
@@ -220,7 +221,7 @@ export async function parseRawEmail(
messageData: any,
dataPropertyNameDownload: string,
): Promise<INodeExecutionData> {
const messageEncoded = Buffer.from(messageData.raw, 'base64').toString('utf8');
const messageEncoded = Buffer.from(messageData.raw as string, 'base64').toString('utf8');
const responseData = await simpleParser(messageEncoded);
const headers: IDataObject = {};
@@ -333,9 +334,9 @@ export async function googleApiRequestAllItems(
query.maxResults = 100;
do {
responseData = await googleApiRequest.call(this, method, endpoint, body, query);
responseData = await googleApiRequest.call(this, method, endpoint, body as IDataObject, query);
query.pageToken = responseData.nextPageToken;
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData.nextPageToken !== undefined && responseData.nextPageToken !== '');
return returnData;
@@ -621,7 +622,7 @@ export async function replayToEmail(
options.replyToSenderOnly === undefined ? false : (options.replyToSenderOnly as boolean);
const prepareEmailString = (email: string) => {
if (email.includes(emailAddress)) return;
if (email.includes(emailAddress as string)) return;
if (email.includes('<') && email.includes('>')) {
to += `${email}, `;
} else {