refactor(core): fix for no-uncaught-json-parse warnings

This commit is contained in:
Michael Kret
2022-10-21 21:52:43 +03:00
committed by GitHub
parent ca9eca9ae9
commit 1d57b10942
36 changed files with 150 additions and 93 deletions

View File

@@ -4,6 +4,7 @@ import {
INodeExecutionData,
INodeType,
INodeTypeDescription,
jsonParse,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
@@ -171,7 +172,7 @@ export class Discord implements INodeType {
if (options.allowed_mentions) {
//@ts-expect-error
body.allowed_mentions = JSON.parse(options.allowed_mentions);
body.allowed_mentions = jsonParse(options.allowed_mentions);
}
if (options.avatarUrl) {
@@ -188,12 +189,12 @@ export class Discord implements INodeType {
if (options.payloadJson) {
//@ts-expect-error
body.payload_json = JSON.parse(options.payloadJson);
body.payload_json = jsonParse(options.payloadJson);
}
if (options.attachments) {
//@ts-expect-error
body.attachments = JSON.parse(options.attachments as DiscordAttachment[]);
body.attachments = jsonParse(options.attachments as DiscordAttachment[]);
}
//* Not used props, delete them from the payload as Discord won't need them :^
@@ -270,7 +271,7 @@ export class Discord implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({success: true}),
this.helpers.returnJsonArray({ success: true }),
{ itemData: { item: i } },
);
returnData.push(...executionData);