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,
INodeExecutionData,
INodeType,
@@ -1829,10 +1828,7 @@ export class Telegram implements INodeType {
body.chat_id = this.getNodeParameter('chatId', i) as string;
body.message_id = this.getNodeParameter('messageId', i) as string;
const { disable_notification } = this.getNodeParameter(
'additionalFields',
i,
) as IDataObject;
const { disable_notification } = this.getNodeParameter('additionalFields', i);
if (disable_notification) {
body.disable_notification = true;
}
@@ -1981,16 +1977,16 @@ export class Telegram implements INodeType {
let responseData;
if (binaryData === true) {
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string;
const binaryData = items[i].binary![binaryPropertyName] as IBinaryData;
const itemBinaryData = items[i].binary![binaryPropertyName];
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
const propertyName = getPropertyName(operation);
const fileName = this.getNodeParameter('additionalFields.fileName', 0, '') as string;
const filename = fileName || binaryData.fileName?.toString();
const filename = fileName || itemBinaryData.fileName?.toString();
if (!fileName && !binaryData.fileName) {
if (!fileName && !itemBinaryData.fileName) {
throw new NodeOperationError(
this.getNode(),
`File name is needed to ${operation}. Make sure the property that holds the binary data
@@ -2007,7 +2003,7 @@ export class Telegram implements INodeType {
value: dataBuffer,
options: {
filename,
contentType: binaryData.mimeType,
contentType: itemBinaryData.mimeType,
},
},
};
@@ -2018,7 +2014,7 @@ export class Telegram implements INodeType {
}
if (resource === 'file' && operation === 'get') {
if (this.getNodeParameter('download', i, false) === true) {
if (this.getNodeParameter('download', i, false)) {
const filePath = responseData.result.file_path;
const credentials = await this.getCredentials('telegramApi');
@@ -2037,7 +2033,7 @@ export class Telegram implements INodeType {
);
const fileName = filePath.split('/').pop();
const binaryData = await this.helpers.prepareBinaryData(
const data = await this.helpers.prepareBinaryData(
Buffer.from(file.body as string),
fileName,
);
@@ -2045,7 +2041,7 @@ export class Telegram implements INodeType {
returnData.push({
json: responseData,
binary: {
data: binaryData,
data,
},
pairedItem: { item: i },
});