refactor(core): Remove linting exceptions in nodes-base (#4794)

*  enabled array-type

*  await-thenable on

*  ban-types on

*  default-param-last on

*  dot-notation on

*  member-delimiter-style on

*  no-duplicate-imports on

*  no-empty-interface on

*  no-floating-promises on

*  no-for-in-array on

*  no-invalid-void-type on

*  no-loop-func on

*  no-shadow on

*  ban-ts-comment re enabled

*  @typescript-eslint/lines-between-class-members on

* address my own comment

* @typescript-eslint/return-await on

* @typescript-eslint/promise-function-async on

* @typescript-eslint/no-unnecessary-boolean-literal-compare on

* @typescript-eslint/no-unnecessary-type-assertion on

* prefer-const on

* @typescript-eslint/prefer-optional-chain on

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Michael Kret
2022-12-02 22:54:28 +02:00
committed by GitHub
parent 8101c05d6f
commit 61e26804ba
796 changed files with 3735 additions and 2847 deletions

View File

@@ -163,7 +163,7 @@ export class SendGrid implements INodeType {
body,
qs,
);
if (returnAll === false) {
if (!returnAll) {
const limit = this.getNodeParameter('limit', i);
responseData = responseData.splice(0, limit);
}
@@ -271,9 +271,9 @@ export class SendGrid implements INodeType {
Object.assign(contact, { state_province_region: stateProvinceRegion });
}
if (additionalFields.alternateEmails) {
const alternateEmails = (
(additionalFields.alternateEmails as string).split(',') as string[]
).filter((email) => !!email);
const alternateEmails = (additionalFields.alternateEmails as string)
.split(',')
.filter((mail) => !!mail);
if (alternateEmails.length !== 0) {
Object.assign(contact, { alternate_emails: alternateEmails });
}
@@ -317,7 +317,7 @@ export class SendGrid implements INodeType {
for (let i = 0; i < length; i++) {
try {
const deleteAll = this.getNodeParameter('deleteAll', i) as boolean;
if (deleteAll === true) {
if (deleteAll) {
qs.delete_all_contacts = 'true';
}
qs.ids = (this.getNodeParameter('ids', i) as string).replace(/\s/g, '');
@@ -361,7 +361,7 @@ export class SendGrid implements INodeType {
{},
qs,
);
if (returnAll === false) {
if (!returnAll) {
const limit = this.getNodeParameter('limit', i);
responseData = responseData.splice(0, limit);
}
@@ -514,7 +514,7 @@ export class SendGrid implements INodeType {
const toEmail = this.getNodeParameter('toEmail', i) as string;
const parsedToEmail = toEmail.includes(',')
? toEmail.split(',').map((i) => ({ email: i.trim() }))
? toEmail.split(',').map((entry) => ({ email: entry.trim() }))
: [{ email: toEmail.trim() }];
const {
@@ -612,25 +612,29 @@ export class SendGrid implements INodeType {
}
if (bccEmail) {
body.personalizations[0].bcc = bccEmail.split(',').map((i) => ({ email: i.trim() }));
body.personalizations[0].bcc = bccEmail
.split(',')
.map((entry) => ({ email: entry.trim() }));
}
if (ccEmail) {
body.personalizations[0].cc = ccEmail.split(',').map((i) => ({ email: i.trim() }));
body.personalizations[0].cc = ccEmail
.split(',')
.map((entry) => ({ email: entry.trim() }));
}
if (headers?.details.length) {
const parsedHeaders: { [key: string]: string } = {};
headers.details.forEach((obj) => (parsedHeaders[obj['key']] = obj['value']));
headers.details.forEach((obj) => (parsedHeaders[obj.key] = obj.value));
body.headers = parsedHeaders;
}
if (categories) {
body.categories = categories.split(',') as string[];
body.categories = categories.split(',');
}
if (ipPoolName) {
body.ip_pool_name = ipPoolName as string;
body.ip_pool_name = ipPoolName;
}
if (sendAt) {
@@ -642,7 +646,7 @@ export class SendGrid implements INodeType {
});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ messageId: data!.headers['x-message-id'] }),
this.helpers.returnJsonArray({ messageId: data.headers['x-message-id'] }),
{ itemData: { item: i } },
);
returnData.push(...executionData);