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

@@ -371,7 +371,7 @@ export class Slack implements INodeType {
if (filters.excludeArchived) {
qs.exclude_archived = filters.excludeArchived as boolean;
}
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'channels',
@@ -401,7 +401,7 @@ export class Slack implements INodeType {
if (filters.oldest) {
qs.oldest = new Date(filters.oldest as string).getTime() / 1000;
}
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'messages',
@@ -551,7 +551,7 @@ export class Slack implements INodeType {
if (filters.oldest) {
qs.oldest = new Date(filters.oldest as string).getTime() / 1000;
}
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'messages',
@@ -669,7 +669,7 @@ export class Slack implements INodeType {
}
}
}
body['attachments'] = attachments;
body.attachments = attachments;
if (blocksUi) {
const blocks: Block[] = [];
@@ -750,7 +750,7 @@ export class Slack implements INodeType {
};
}
if (style !== 'default') {
confirm.style = style as string;
confirm.style = style;
}
element.confirm = confirm;
}
@@ -761,16 +761,16 @@ export class Slack implements INodeType {
} else if (block.type === 'section') {
const textUi = (blockUi.textUi as IDataObject).textValue as IDataObject;
if (textUi) {
const text: Text = {};
const textData: Text = {};
if (textUi.type === 'plainText') {
text.type = 'plain_text';
text.emoji = textUi.emoji as boolean;
textData.type = 'plain_text';
textData.emoji = textUi.emoji as boolean;
} else {
text.type = 'mrkdwn';
text.verbatim = textUi.verbatim as boolean;
textData.type = 'mrkdwn';
textData.verbatim = textUi.verbatim as boolean;
}
text.text = textUi.text as string;
block.text = text;
textData.text = textUi.text as string;
block.text = textData;
} else {
throw new NodeOperationError(
this.getNode(),
@@ -825,7 +825,8 @@ export class Slack implements INodeType {
const confirm: Confirm = {};
const titleUi = (confirmUi.titleUi as IDataObject)
.titleValue as IDataObject;
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
const textUiFromConfirm = (confirmUi.textUi as IDataObject)
.textValue as IDataObject;
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject)
.confirmValue as IDataObject;
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
@@ -837,11 +838,11 @@ export class Slack implements INodeType {
emoji: titleUi.emoji as boolean,
};
}
if (textUi) {
if (textUiFromConfirm) {
confirm.text = {
type: 'plain_text',
text: textUi.text as string,
emoji: textUi.emoji as boolean,
text: textUiFromConfirm.text as string,
emoji: textUiFromConfirm.emoji as boolean,
};
}
if (confirmTextUi) {
@@ -859,7 +860,7 @@ export class Slack implements INodeType {
};
}
if (style !== 'default') {
confirm.style = style as string;
confirm.style = style;
}
accessory.confirm = confirm;
}
@@ -928,9 +929,9 @@ export class Slack implements INodeType {
}
}
}
body['attachments'] = attachments;
body.attachments = attachments;
const jsonParameters = this.getNodeParameter('jsonParameters', i, false) as boolean;
const jsonParameters = this.getNodeParameter('jsonParameters', i, false);
if (jsonParameters) {
const blocksJson = this.getNodeParameter('blocksJson', i, []) as string;
@@ -976,11 +977,11 @@ export class Slack implements INodeType {
if (operation === 'getPermalink') {
const channel = this.getNodeParameter('channelId', i) as string;
const timestamp = this.getNodeParameter('timestamp', i) as string;
const qs = {
const query = {
channel,
message_ts: timestamp,
};
responseData = await slackApiRequest.call(this, 'GET', '/chat.getPermalink', {}, qs);
responseData = await slackApiRequest.call(this, 'GET', '/chat.getPermalink', {}, query);
}
}
if (resource === 'reaction') {
@@ -1053,7 +1054,7 @@ export class Slack implements INodeType {
//https://api.slack.com/methods/stars.list
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'items',
@@ -1159,12 +1160,12 @@ export class Slack implements INodeType {
qs.ts_to = filters.tsTo as string;
}
if (filters.types) {
qs.types = (filters.types as string[]).join(',') as string;
qs.types = (filters.types as string[]).join(',');
}
if (filters.userId) {
qs.user = filters.userId as string;
}
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'files',
@@ -1197,7 +1198,7 @@ export class Slack implements INodeType {
//https://api.slack.com/methods/users.list
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i);
if (returnAll === true) {
if (returnAll) {
responseData = await slackApiRequestAllItems.call(
this,
'members',
@@ -1280,15 +1281,17 @@ export class Slack implements INodeType {
const additionalFields = this.getNodeParameter('additionalFields', i);
const qs: IDataObject = {};
Object.assign(qs, additionalFields);
responseData = await slackApiRequest.call(this, 'GET', '/usergroups.list', {}, qs);
responseData = await slackApiRequest.call(
this,
'GET',
'/usergroups.list',
{},
additionalFields,
);
responseData = responseData.usergroups;
if (returnAll === false) {
if (!returnAll) {
const limit = this.getNodeParameter('limit', i);
responseData = responseData.slice(0, limit);
@@ -1358,16 +1361,12 @@ export class Slack implements INodeType {
if (operation === 'get') {
const additionalFields = this.getNodeParameter('additionalFields', i);
const qs: IDataObject = {};
Object.assign(qs, additionalFields);
responseData = await slackApiRequest.call(
this,
'POST',
'/users.profile.get',
undefined,
qs,
additionalFields,
);
responseData = responseData.profile;