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

@@ -1,7 +1,6 @@
import { IExecuteFunctions } from 'n8n-core';
import {
IBinaryData,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
@@ -139,23 +138,23 @@ export class CiscoWebex implements INodeType {
const markdown = this.getNodeParameter('additionalFields.markdown', i, '') as boolean;
const body = {} as IDataObject;
if (destination === 'room') {
body['roomId'] = this.getNodeParameter('roomId', i);
body.roomId = this.getNodeParameter('roomId', i);
}
if (destination === 'person') {
const specifyPersonBy = this.getNodeParameter('specifyPersonBy', 0) as string;
if (specifyPersonBy === 'id') {
body['toPersonId'] = this.getNodeParameter('toPersonId', i);
body.toPersonId = this.getNodeParameter('toPersonId', i);
} else {
body['toPersonEmail'] = this.getNodeParameter('toPersonEmail', i);
body.toPersonEmail = this.getNodeParameter('toPersonEmail', i);
}
}
if (markdown) {
body['markdown'] = markdown;
body.markdown = markdown;
}
body['text'] = this.getNodeParameter('text', i);
body.text = this.getNodeParameter('text', i);
body.attachments = getAttachemnts(
this.getNodeParameter(
@@ -177,7 +176,7 @@ export class CiscoWebex implements INodeType {
const binaryPropertyName = file.binaryPropertyName as string;
const binaryData = items[i].binary![binaryPropertyName] as IBinaryData;
const binaryData = items[i].binary![binaryPropertyName];
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(
i,
binaryPropertyName,
@@ -260,7 +259,7 @@ export class CiscoWebex implements INodeType {
Object.assign(qs, filters);
}
if (returnAll === true) {
if (returnAll) {
responseData = await webexApiRequestAllItems.call(
this,
'items',
@@ -295,10 +294,10 @@ export class CiscoWebex implements INodeType {
roomId: responseData.roomId,
} as IDataObject;
if (markdown === true) {
body['markdown'] = this.getNodeParameter('markdownText', i);
if (markdown) {
body.markdown = this.getNodeParameter('markdownText', i);
} else {
body['text'] = this.getNodeParameter('text', i);
body.text = this.getNodeParameter('text', i);
}
responseData = await webexApiRequest.call(this, 'PUT', endpoint, body);
@@ -329,7 +328,7 @@ export class CiscoWebex implements INodeType {
};
if (body.requireRegistrationInfo) {
body['registration'] = (body.requireRegistrationInfo as string[]).reduce(
body.registration = (body.requireRegistrationInfo as string[]).reduce(
(obj, value) => Object.assign(obj, { [`${value}`]: true }),
{},
);
@@ -337,7 +336,7 @@ export class CiscoWebex implements INodeType {
}
if (invitees) {
body['invitees'] = invitees;
body.invitees = invitees;
delete body.inviteesUi;
}
@@ -419,7 +418,7 @@ export class CiscoWebex implements INodeType {
.format();
}
if (returnAll === true) {
if (returnAll) {
responseData = await webexApiRequestAllItems.call(
this,
'items',
@@ -459,7 +458,7 @@ export class CiscoWebex implements INodeType {
};
if (body.requireRegistrationInfo) {
body['registration'] = (body.requireRegistrationInfo as string[]).reduce(
body.registration = (body.requireRegistrationInfo as string[]).reduce(
(obj, value) => Object.assign(obj, { [`${value}`]: true }),
{},
);
@@ -467,7 +466,7 @@ export class CiscoWebex implements INodeType {
}
if (invitees.length) {
body['invitees'] = invitees;
body.invitees = invitees;
}
if (body.start) {

View File

@@ -534,13 +534,13 @@ export class CiscoWebexTrigger implements INodeType {
};
if (filters.ownedBy) {
body['ownedBy'] = filters.ownedBy as string;
body.ownedBy = filters.ownedBy as string;
}
body['secret'] = secret;
body.secret = secret;
if (filter.length) {
body['filter'] = filter.join('&');
body.filter = filter.join('&');
}
const responseData = await webexApiRequest.call(this, 'POST', endpoint, body);

View File

@@ -42,7 +42,7 @@ export async function webexApiRequest(
delete options.qs;
}
//@ts-ignore
return await this.helpers.requestOAuth2.call(this, 'ciscoWebexOAuth2Api', options, {
return this.helpers.requestOAuth2.call(this, 'ciscoWebexOAuth2Api', options, {
tokenType: 'Bearer',
});
} catch (error) {
@@ -71,13 +71,10 @@ export async function webexApiRequestAllItems(
...options,
});
if (responseData.headers.link) {
uri = responseData.headers['link'].split(';')[0].replace('<', '').replace('>', '');
uri = responseData.headers.link.split(';')[0].replace('<', '').replace('>', '');
}
returnData.push.apply(returnData, responseData.body[propertyName]);
} while (
responseData.headers['link'] !== undefined &&
responseData.headers['link'].includes('rel="next"')
);
} while (responseData.headers.link?.includes('rel="next"'));
return returnData;
}