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

@@ -8,6 +8,7 @@ import type {
INodePropertyOptions,
INodeType,
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@@ -1691,7 +1692,9 @@ export class Asana implements INodeType {
const responseData = await asanaApiRequest.call(this, 'GET', endpoint, {});
if (responseData.data === undefined) {
throw new NodeApiError(this.getNode(), responseData, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}
const returnData: INodePropertyOptions[] = [];
@@ -1730,7 +1733,9 @@ export class Asana implements INodeType {
const responseData = await asanaApiRequest.call(this, 'GET', endpoint, {});
if (responseData.data === undefined) {
throw new NodeApiError(this.getNode(), responseData, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}
const returnData: INodePropertyOptions[] = [];
@@ -1818,7 +1823,7 @@ export class Asana implements INodeType {
try {
taskData = await asanaApiRequest.call(this, 'GET', `/tasks/${taskId}`, {});
} catch (error) {
throw new NodeApiError(this.getNode(), error, {
throw new NodeApiError(this.getNode(), error as JsonObject, {
message: `Could not find task with id "${taskId}" so tags could not be loaded.`,
});
}
@@ -1827,7 +1832,9 @@ export class Asana implements INodeType {
const responseData = await asanaApiRequest.call(this, 'GET', endpoint, {}, { workspace });
if (responseData.data === undefined) {
throw new NodeApiError(this.getNode(), responseData, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}
const returnData: INodePropertyOptions[] = [];
@@ -1863,7 +1870,9 @@ export class Asana implements INodeType {
const responseData = await asanaApiRequest.call(this, 'GET', endpoint, {});
if (responseData.data === undefined) {
throw new NodeApiError(this.getNode(), responseData, { message: 'No data got returned' });
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
message: 'No data got returned',
});
}
const returnData: INodePropertyOptions[] = [];
@@ -2400,9 +2409,12 @@ export class Asana implements INodeType {
}
returnData.push(
...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), {
itemData: { item: i },
}),
...this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject[]),
{
itemData: { item: i },
},
),
);
} catch (error) {
if (this.continueOnFail()) {

View File

@@ -240,7 +240,7 @@ export class AsanaTrigger implements INodeType {
// }
return {
workflowData: [this.helpers.returnJsonArray(req.body.events)],
workflowData: [this.helpers.returnJsonArray(req.body.events as IDataObject[])],
};
}
}

View File

@@ -51,9 +51,16 @@ export async function asanaApiRequestAllItems(
query.limit = 100;
do {
responseData = await asanaApiRequest.call(this, method, endpoint, body, query, uri);
responseData = await asanaApiRequest.call(
this,
method,
endpoint,
body as IDataObject,
query,
uri,
);
uri = get(responseData, 'next_page.uri');
returnData.push.apply(returnData, responseData.data);
returnData.push.apply(returnData, responseData.data as IDataObject[]);
} while (responseData.next_page !== null);
return returnData;