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';
import moment from 'moment-timezone';
@@ -30,7 +30,7 @@ export async function googleApiRequest(
json: true,
};
try {
if (Object.keys(body).length === 0) {
if (Object.keys(body as IDataObject).length === 0) {
delete options.body;
}
@@ -41,7 +41,7 @@ export async function googleApiRequest(
options,
);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -63,7 +63,7 @@ export async function googleApiRequestAllItems(
do {
responseData = await googleApiRequest.call(this, method, endpoint, body, query, uri);
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;
@@ -97,7 +97,7 @@ export function jsonToDocument(value: string | number | IDataObject | IDataObjec
const obj = {};
for (const o of Object.keys(value)) {
//@ts-ignore
obj[o] = jsonToDocument(value[o]);
obj[o] = jsonToDocument(value[o] as IDataObject);
}
return { mapValue: { fields: obj } };
}
@@ -136,7 +136,7 @@ export function documentToJson(fields: IDataObject): IDataObject {
return value as IDataObject;
} else if ('mapValue' === key) {
//@ts-ignore
return documentToJson(value!.fields || {});
return documentToJson((value!.fields as IDataObject) || {});
} else if ('arrayValue' === key) {
// @ts-ignore
const list = value.values as IDataObject[];