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 } from 'n8n-workflow';
import type { IDataObject, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function microsoftApiRequest(
@@ -33,13 +33,13 @@ export async function microsoftApiRequest(
if (Object.keys(qs).length === 0) {
delete options.qs;
}
if (Object.keys(body).length === 0) {
if (Object.keys(body as IDataObject).length === 0) {
delete options.body;
}
//@ts-ignore
return await this.helpers.requestOAuth2.call(this, 'microsoftOneDriveOAuth2Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -64,7 +64,7 @@ export async function microsoftApiRequestAllItems(
if (uri?.includes('$top')) {
delete query.$top;
}
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData['@odata.nextLink'] !== undefined);
return returnData;
@@ -88,7 +88,7 @@ export async function microsoftApiRequestAllItemsSkip(
do {
responseData = await microsoftApiRequest.call(this, method, endpoint, body, query);
query.$skip += query.$top;
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData.value.length !== 0);
return returnData;

View File

@@ -6,6 +6,7 @@ import type {
INodeExecutionData,
INodeType,
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@@ -109,7 +110,7 @@ export class MicrosoftOneDrive implements INodeType {
const fileName = responseData.name;
if (responseData.file === undefined) {
throw new NodeApiError(this.getNode(), responseData, {
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'The ID you provided does not belong to a file.',
});
}
@@ -148,11 +149,11 @@ export class MicrosoftOneDrive implements INodeType {
items[i] = newItem;
const data = Buffer.from(responseData.body);
const data = Buffer.from(responseData.body as Buffer);
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
data as unknown as Buffer,
fileName,
fileName as string,
mimeType,
);
}
@@ -234,7 +235,7 @@ export class MicrosoftOneDrive implements INodeType {
{},
);
responseData = JSON.parse(responseData);
responseData = JSON.parse(responseData as string);
} else {
const body = this.getNodeParameter('fileContent', i) as string;
if (fileName === '') {
@@ -356,7 +357,7 @@ export class MicrosoftOneDrive implements INodeType {
throw error;
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);