From 72523462ea27d462dacc95adac8244d76ca1db78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 31 Jul 2023 11:00:48 +0200 Subject: [PATCH] refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) --- packages/@n8n/client-oauth2/package.json | 4 ++-- .../@n8n/client-oauth2/src/ClientOAuth2.ts | 3 +-- .../client-oauth2/src/ClientOAuth2Token.ts | 2 -- packages/@n8n/client-oauth2/src/CodeFlow.ts | 1 - packages/@n8n/client-oauth2/src/utils.ts | 3 --- packages/cli/package.json | 4 ++-- packages/cli/src/AbstractServer.ts | 1 - packages/cli/src/ActiveExecutions.ts | 13 ++++------- packages/cli/src/ActiveWebhooks.ts | 11 ++++----- packages/cli/src/ActiveWorkflowRunner.ts | 23 ++++++------------- packages/cli/src/CommunityNodes/helpers.ts | 4 ---- .../cli/src/CommunityNodes/packageModel.ts | 2 +- packages/cli/src/CredentialsHelper.ts | 10 +++----- packages/cli/src/CurlConverterHelper.ts | 1 - packages/cli/src/Db.ts | 5 +--- packages/cli/src/ExternalHooks.ts | 8 ++----- packages/cli/src/GenericHelpers.ts | 11 ++------- packages/cli/src/InternalHooks.ts | 3 --- packages/cli/src/Ldap/LdapService.ee.ts | 1 - packages/cli/src/Logger.ts | 8 +------ .../credentials/credentials.service.ts | 3 --- packages/cli/src/Queue.ts | 1 - packages/cli/src/ReloadNodesAndCredentials.ts | 1 - packages/cli/src/ResponseHelper.ts | 7 +++--- packages/cli/src/Server.ts | 5 ++-- packages/cli/src/TestWebhooks.ts | 14 ++++------- .../UserManagement/UserManagementHelper.ts | 3 --- packages/cli/src/WaitTracker.ts | 8 +------ packages/cli/src/WaitingWebhooks.ts | 5 +--- packages/cli/src/WebhookHelpers.ts | 15 +++++------- packages/cli/src/WorkflowCredentials.ts | 8 ++----- .../cli/src/WorkflowExecuteAdditionalData.ts | 16 ++++--------- packages/cli/src/WorkflowHelpers.ts | 10 ++++---- packages/cli/src/WorkflowRunner.ts | 13 ++++------- packages/cli/src/WorkflowRunnerProcess.ts | 16 ++++--------- packages/cli/src/auth/jwt.ts | 2 -- packages/cli/src/commands/executeBatch.ts | 3 +-- .../cli/src/commands/export/credentials.ts | 1 - packages/cli/src/commands/export/workflow.ts | 1 - packages/cli/src/commands/import/workflow.ts | 3 --- packages/cli/src/commands/start.ts | 8 +++---- packages/cli/src/commands/update/workflow.ts | 3 --- packages/cli/src/commands/webhook.ts | 2 +- packages/cli/src/commands/worker.ts | 5 ++-- packages/cli/src/config/schema.ts | 2 -- packages/cli/src/constants.ts | 3 --- .../credentials/credentials.controller.ee.ts | 1 - .../src/credentials/credentials.controller.ts | 2 -- .../src/credentials/credentials.service.ee.ts | 1 - .../src/credentials/credentials.service.ts | 5 +--- .../src/credentials/oauth2Credential.api.ts | 1 - packages/cli/src/curlconverter.d.ts | 2 -- ...1630451444017-UpdateWorkflowCredentials.ts | 1 - .../mysqldb/1658932910559-AddNodeIds.ts | 1 - ...690000000001-MigrateIntegerKeysToString.ts | 1 - ...1630419189837-UpdateWorkflowCredentials.ts | 1 - .../postgresdb/1658932090381-AddNodeIds.ts | 3 +-- ...690000000000-MigrateIntegerKeysToString.ts | 1 - ...1630330987096-UpdateWorkflowCredentials.ts | 2 +- .../sqlite/1658930531669-AddNodeIds.ts | 2 +- .../src/databases/utils/migrationHelpers.ts | 1 - .../cli/src/decorators/registerController.ts | 1 - .../variables/variables.service.ee.ts | 2 +- .../MessageEventBusDestinationSentry.ee.ts | 3 +-- .../MessageEventBusDestinationSyslog.ee.ts | 2 -- .../MessageEventBusDestinationWebhook.ee.ts | 15 +++++++----- .../MessageEventBusLogWriter.ts | 3 +-- .../MessageEventBusLogWriterWorker.ts | 1 - .../cli/src/eventbus/eventBus.controller.ts | 3 --- .../cli/src/executions/executions.service.ts | 3 --- .../cli/src/license/license.controller.ts | 2 -- packages/cli/src/services/cache.service.ts | 1 - packages/cli/src/sso/saml/saml.service.ee.ts | 1 - packages/cli/src/telemetry/index.ts | 3 --- .../cli/src/workflows/workflows.controller.ts | 2 -- .../cli/test/integration/shared/testDb.ts | 1 - packages/core/package.json | 4 ++-- packages/core/src/ActiveWorkflows.ts | 21 ++++++----------- packages/core/src/Constants.ts | 1 - packages/core/src/Credentials.ts | 2 -- packages/core/src/ExtractValue.ts | 1 - packages/core/src/LoadNodeDetails.ts | 1 - packages/core/src/NodeExecuteFunctions.ts | 9 +++----- packages/core/src/UserSettings.ts | 5 +--- packages/core/src/WorkflowExecute.ts | 21 +++++------------ packages/node-dev/commands/build.ts | 5 ++-- packages/node-dev/commands/new.ts | 7 +++--- packages/node-dev/package.json | 4 ++-- packages/node-dev/src/Build.ts | 7 +++--- packages/workflow/package.json | 4 ++-- packages/workflow/src/AugmentObject.ts | 1 - packages/workflow/src/Constants.ts | 1 - packages/workflow/src/Expression.ts | 6 ++--- .../src/Extensions/ArrayExtensions.ts | 4 +--- .../workflow/src/Extensions/DateExtensions.ts | 3 +-- .../src/Extensions/ExpressionExtension.ts | 11 +-------- .../src/Extensions/ObjectExtensions.ts | 2 +- .../src/Extensions/StringExtensions.ts | 2 -- packages/workflow/src/Interfaces.ts | 2 +- packages/workflow/src/LoggerProxy.ts | 1 - packages/workflow/src/NodeErrors.ts | 12 +++------- packages/workflow/src/NodeHelpers.ts | 16 ++++--------- packages/workflow/src/ObservableObject.ts | 10 +++----- packages/workflow/src/RoutingNode.ts | 17 +++++--------- packages/workflow/src/TelemetryHelpers.ts | 2 +- packages/workflow/src/Workflow.ts | 15 +++--------- packages/workflow/src/WorkflowDataProxy.ts | 18 +++++---------- packages/workflow/src/WorkflowHooks.ts | 6 ++--- packages/workflow/src/utils.ts | 8 +------ packages/workflow/test/Helpers.ts | 2 -- 110 files changed, 160 insertions(+), 415 deletions(-) diff --git a/packages/@n8n/client-oauth2/package.json b/packages/@n8n/client-oauth2/package.json index 6dba1df398..d9257d62ac 100644 --- a/packages/@n8n/client-oauth2/package.json +++ b/packages/@n8n/client-oauth2/package.json @@ -7,8 +7,8 @@ "typecheck": "tsc", "build": "tsc -p tsconfig.build.json", "format": "prettier --write . --ignore-path ../../../.prettierignore", - "lint": "eslint --quiet .", - "lintfix": "eslint . --fix", + "lint": "eslint . --quiet --report-unused-disable-directives", + "lintfix": "eslint . --fix --report-unused-disable-directives", "watch": "tsc -p tsconfig.build.json --watch", "test": "jest", "test:dev": "jest --watch" diff --git a/packages/@n8n/client-oauth2/src/ClientOAuth2.ts b/packages/@n8n/client-oauth2/src/ClientOAuth2.ts index 1fb6304e36..87178255e9 100644 --- a/packages/@n8n/client-oauth2/src/ClientOAuth2.ts +++ b/packages/@n8n/client-oauth2/src/ClientOAuth2.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/restrict-plus-operands */ + /* eslint-disable @typescript-eslint/no-explicit-any */ import * as qs from 'querystring'; import { Agent } from 'https'; diff --git a/packages/@n8n/client-oauth2/src/ClientOAuth2Token.ts b/packages/@n8n/client-oauth2/src/ClientOAuth2Token.ts index fe2e71deae..9b696dff22 100644 --- a/packages/@n8n/client-oauth2/src/ClientOAuth2Token.ts +++ b/packages/@n8n/client-oauth2/src/ClientOAuth2Token.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/naming-convention */ import type { ClientOAuth2, ClientOAuth2Options, ClientOAuth2RequestObject } from './ClientOAuth2'; import { auth, expects, getRequestOptions } from './utils'; diff --git a/packages/@n8n/client-oauth2/src/CodeFlow.ts b/packages/@n8n/client-oauth2/src/CodeFlow.ts index 20679188a8..3fda119a00 100644 --- a/packages/@n8n/client-oauth2/src/CodeFlow.ts +++ b/packages/@n8n/client-oauth2/src/CodeFlow.ts @@ -69,7 +69,6 @@ export class CodeFlow { } if (!url.search?.substring(1)) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions throw new TypeError(`Unable to process uri: ${urlString}`); } diff --git a/packages/@n8n/client-oauth2/src/utils.ts b/packages/@n8n/client-oauth2/src/utils.ts index 3b3bd88d97..550c1dcf99 100644 --- a/packages/@n8n/client-oauth2/src/utils.ts +++ b/packages/@n8n/client-oauth2/src/utils.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/restrict-plus-operands */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-explicit-any */ import type { ClientOAuth2Options, ClientOAuth2RequestObject } from './ClientOAuth2'; import { ERROR_RESPONSES } from './constants'; diff --git a/packages/cli/package.json b/packages/cli/package.json index 93192fe7d4..f343968ecc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -26,8 +26,8 @@ "dev": "concurrently -k -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"nodemon\"", "dev:worker": "concurrently -k -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"nodemon worker\"", "format": "prettier --write . --ignore-path ../../.prettierignore", - "lint": "eslint --quiet .", - "lintfix": "eslint . --fix", + "lint": "eslint . --quiet --report-unused-disable-directives", + "lintfix": "eslint . --fix --report-unused-disable-directives", "postpack": "rm -f oclif.manifest.json", "prepack": "oclif-dev manifest", "start": "run-script-os", diff --git a/packages/cli/src/AbstractServer.ts b/packages/cli/src/AbstractServer.ts index b9dabaa951..9b82e230e9 100644 --- a/packages/cli/src/AbstractServer.ts +++ b/packages/cli/src/AbstractServer.ts @@ -95,7 +95,6 @@ export abstract class AbstractServer { // Make sure that each request has the "parsedUrl" parameter app.use((req, res, next) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion req.parsedUrl = parseUrl(req)!; req.rawBody = emptyBuffer; next(); diff --git a/packages/cli/src/ActiveExecutions.ts b/packages/cli/src/ActiveExecutions.ts index 2cccb4fb6c..9c1c79c692 100644 --- a/packages/cli/src/ActiveExecutions.ts +++ b/packages/cli/src/ActiveExecutions.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ + import { Container, Service } from 'typedi'; import type { IDeferredPromise, @@ -94,7 +92,7 @@ export class ActiveExecutions { * Attaches an execution * */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + attachWorkflowExecution(executionId: string, workflowExecution: PCancelable) { if (this.activeExecutions[executionId] === undefined) { throw new Error( @@ -123,7 +121,6 @@ export class ActiveExecutions { return; } - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.activeExecutions[executionId].responsePromise?.resolve(response); } @@ -137,7 +134,7 @@ export class ActiveExecutions { } // Resolve all the waiting promises - // eslint-disable-next-line no-restricted-syntax + for (const promise of this.activeExecutions[executionId].postExecutePromises) { promise.resolve(fullRunData); } @@ -176,7 +173,6 @@ export class ActiveExecutions { this.activeExecutions[executionId].workflowExecution!.cancel(); } - // eslint-disable-next-line consistent-return return this.getPostExecutePromise(executionId); } @@ -196,7 +192,6 @@ export class ActiveExecutions { this.activeExecutions[executionId].postExecutePromises.push(waitPromise); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access return waitPromise.promise(); } @@ -208,7 +203,7 @@ export class ActiveExecutions { const returnData: IExecutionsCurrentSummary[] = []; let data; - // eslint-disable-next-line no-restricted-syntax + for (const id of Object.keys(this.activeExecutions)) { data = this.activeExecutions[id]; returnData.push({ diff --git a/packages/cli/src/ActiveWebhooks.ts b/packages/cli/src/ActiveWebhooks.ts index 8e3dcda62d..27489eaddd 100644 --- a/packages/cli/src/ActiveWebhooks.ts +++ b/packages/cli/src/ActiveWebhooks.ts @@ -35,7 +35,6 @@ export class ActiveWebhooks { throw new Error('Webhooks can only be added for saved workflows as an id is needed!'); } if (webhookData.path.endsWith('/')) { - // eslint-disable-next-line no-param-reassign webhookData.path = webhookData.path.slice(0, -1); } @@ -139,7 +138,7 @@ export class ActiveWebhooks { Object.keys(this.webhookUrls) .filter((key) => key.includes(path)) - // eslint-disable-next-line array-callback-return + .map((key) => { methods.push(key.split('|')[0]); }); @@ -164,7 +163,7 @@ export class ActiveWebhooks { if (webhookId) { if (path.startsWith(webhookId)) { const cutFromIndex = path.indexOf('/') + 1; - // eslint-disable-next-line no-param-reassign + path = path.slice(cutFromIndex); } return `${httpMethod}|${webhookId}|${path.split('/').length}`; @@ -177,7 +176,6 @@ export class ActiveWebhooks { * */ async removeWorkflow(workflow: Workflow): Promise { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const workflowId = workflow.id!.toString(); if (this.workflowWebhooks[workflowId] === undefined) { @@ -190,9 +188,8 @@ export class ActiveWebhooks { const mode = 'internal'; // Go through all the registered webhooks of the workflow and remove them - // eslint-disable-next-line no-restricted-syntax + for (const webhookData of webhooks) { - // eslint-disable-next-line no-await-in-loop await workflow.runWebhookMethod( 'delete', webhookData, @@ -218,7 +215,7 @@ export class ActiveWebhooks { */ async removeAll(workflows: Workflow[]): Promise { const removePromises = []; - // eslint-disable-next-line no-restricted-syntax + for (const workflow of workflows) { removePromises.push(this.removeWorkflow(workflow)); } diff --git a/packages/cli/src/ActiveWorkflowRunner.ts b/packages/cli/src/ActiveWorkflowRunner.ts index daae8a28f8..429228e90f 100644 --- a/packages/cli/src/ActiveWorkflowRunner.ts +++ b/packages/cli/src/ActiveWorkflowRunner.ts @@ -1,8 +1,5 @@ /* eslint-disable prefer-spread */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable no-param-reassign */ -/* eslint-disable no-await-in-loop */ -/* eslint-disable no-restricted-syntax */ + /* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ @@ -94,7 +91,6 @@ export class ActiveWorkflowRunner { private webhookRepository: WebhookRepository, ) {} - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types async init() { // Get the active workflows from database @@ -141,7 +137,7 @@ export class ActiveWorkflowRunner { Logger.info( ' => ERROR: Workflow could not be activated on first try, keep on trying if not an auth issue', ); - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + Logger.info(` ${error.message}`); Logger.error( `Issue on initial workflow activation try "${workflowData.name}" (startup)`, @@ -257,7 +253,7 @@ export class ActiveWorkflowRunner { } // @ts-ignore - // eslint-disable-next-line no-param-reassign + path = webhook.webhookPath; // extracting params from path // @ts-ignore @@ -323,7 +319,7 @@ export class ActiveWorkflowRunner { undefined, req, res, - // eslint-disable-next-line consistent-return + (error: Error | null, data: object) => { if (error !== null) { return reject(error); @@ -445,7 +441,6 @@ export class ActiveWorkflowRunner { } try { - // eslint-disable-next-line no-await-in-loop // TODO: this should happen in a transaction, that way we don't need to manually remove this in `catch` await this.webhookRepository.insert(webhook); const webhookExists = await workflow.runWebhookMethod( @@ -478,7 +473,7 @@ export class ActiveWorkflowRunner { // This means that further initializations will always fail // when inserting to database. This is why we ignore this error // as it's expected to happen. - // eslint-disable-next-line no-continue + continue; } @@ -487,7 +482,6 @@ export class ActiveWorkflowRunner { } catch (error) { ErrorReporter.error(error); Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Could not remove webhooks of workflow "${workflow.id}" because of error: "${error.message}"`, ); } @@ -566,7 +560,7 @@ export class ActiveWorkflowRunner { * Runs the given workflow * */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + async runWorkflow( workflowData: IWorkflowDb, node: INode, @@ -634,7 +628,6 @@ export class ActiveWorkflowRunner { responsePromise?: IDeferredPromise, donePromise?: IDeferredPromise, ): void => { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions Logger.debug(`Received event to trigger execution for workflow "${workflow.name}"`); void WorkflowHelpers.saveStaticData(workflow); const executePromise = this.runWorkflow( @@ -691,10 +684,9 @@ export class ActiveWorkflowRunner { responsePromise?: IDeferredPromise, donePromise?: IDeferredPromise, ): void => { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions Logger.debug(`Received trigger for workflow "${workflow.name}"`); void WorkflowHelpers.saveStaticData(workflow); - // eslint-disable-next-line id-denylist + const executePromise = this.runWorkflow( workflowData, node, @@ -983,7 +975,6 @@ export class ActiveWorkflowRunner { } catch (error) { ErrorReporter.error(error); Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Could not remove webhooks of workflow "${workflowId}" because of error: "${error.message}"`, ); } diff --git a/packages/cli/src/CommunityNodes/helpers.ts b/packages/cli/src/CommunityNodes/helpers.ts index 328a3f6a32..11a3eb9fb1 100644 --- a/packages/cli/src/CommunityNodes/helpers.ts +++ b/packages/cli/src/CommunityNodes/helpers.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable @typescript-eslint/naming-convention */ import { promisify } from 'util'; import { exec } from 'child_process'; import { access as fsAccess, mkdir as fsMkdir } from 'fs/promises'; @@ -152,8 +150,6 @@ export function matchMissingPackages( try { const parsedPackageData = parseNpmPackageName(missingPackageName); return parsedPackageData.packageName; - - // eslint-disable-next-line no-empty } catch {} return undefined; }); diff --git a/packages/cli/src/CommunityNodes/packageModel.ts b/packages/cli/src/CommunityNodes/packageModel.ts index 522dbc8dbc..46197655c8 100644 --- a/packages/cli/src/CommunityNodes/packageModel.ts +++ b/packages/cli/src/CommunityNodes/packageModel.ts @@ -63,7 +63,7 @@ export async function persistInstalledPackageData( return promises; }); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return installedPackage!; } catch (error) { LoggerProxy.error('Failed to save installed packages and nodes', { diff --git a/packages/cli/src/CredentialsHelper.ts b/packages/cli/src/CredentialsHelper.ts index 1f541b0f4d..4b85896525 100644 --- a/packages/cli/src/CredentialsHelper.ts +++ b/packages/cli/src/CredentialsHelper.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable no-restricted-syntax */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-return */ @@ -110,7 +109,7 @@ export class CredentialsHelper extends ICredentialsHelper { if (credentialType.authenticate) { if (typeof credentialType.authenticate === 'function') { // Special authentication function is defined - // eslint-disable-next-line @typescript-eslint/no-unsafe-call + return credentialType.authenticate(credentials, requestOptions as IHttpRequestOptions); } @@ -411,7 +410,6 @@ export class CredentialsHelper extends ICredentialsHelper { decryptedData, ) as ICredentialDataDecryptedObject; } catch (e) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access e.message += ' [Error resolving credentials]'; throw e; } @@ -552,7 +550,7 @@ export class CredentialsHelper extends ICredentialsHelper { if (typeof credentialTestFunction === 'function') { // The credentials get tested via a function that is defined on the node const credentialTestFunctions = NodeExecuteFunctions.getCredentialTestFunctions(); - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call + return credentialTestFunction.call(credentialTestFunctions, credentialsDecrypted); } @@ -687,9 +685,7 @@ export class CredentialsHelper extends ICredentialsHelper { return { status: 'Error', message: - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions errorResponseData.statusMessage || - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Received HTTP status code: ${errorResponseData.statusCode}`, }; } diff --git a/packages/cli/src/CurlConverterHelper.ts b/packages/cli/src/CurlConverterHelper.ts index 04ee444f25..3f6be3ba98 100644 --- a/packages/cli/src/CurlConverterHelper.ts +++ b/packages/cli/src/CurlConverterHelper.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import curlconverter from 'curlconverter'; import get from 'lodash/get'; import type { IDataObject } from 'n8n-workflow'; diff --git a/packages/cli/src/Db.ts b/packages/cli/src/Db.ts index cd27c7e737..bc83c12b46 100644 --- a/packages/cli/src/Db.ts +++ b/packages/cli/src/Db.ts @@ -1,8 +1,5 @@ -/* eslint-disable import/no-mutable-exports */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable no-case-declarations */ -/* eslint-disable @typescript-eslint/naming-convention */ + import { Container } from 'typedi'; import type { DataSourceOptions as ConnectionOptions, EntityManager, LoggerOptions } from 'typeorm'; import { DataSource as Connection } from 'typeorm'; diff --git a/packages/cli/src/ExternalHooks.ts b/packages/cli/src/ExternalHooks.ts index 5674306279..315131284b 100644 --- a/packages/cli/src/ExternalHooks.ts +++ b/packages/cli/src/ExternalHooks.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -/* eslint-disable import/no-dynamic-require */ -/* eslint-disable no-restricted-syntax */ + import { Service } from 'typedi'; import * as Db from '@/Db'; import type { @@ -51,13 +50,11 @@ export class ExternalHooks implements IExternalHooksClass { delete require.cache[require.resolve(hookFilePath)]; } - // eslint-disable-next-line import/no-dynamic-require - // eslint-disable-next-line global-require const hookFile = require(hookFilePath) as IExternalHooksFileData; this.loadHooks(hookFile); } catch (error) { throw new Error( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `Problem loading external hook file "${hookFilePath}": ${error.message}`, { cause: error as Error }, ); @@ -96,7 +93,6 @@ export class ExternalHooks implements IExternalHooksClass { } for (const externalHookFunction of this.externalHooks[hookName]) { - // eslint-disable-next-line no-await-in-loop, @typescript-eslint/await-thenable await externalHookFunction.apply(externalHookFunctions, hookParameters); } } diff --git a/packages/cli/src/GenericHelpers.ts b/packages/cli/src/GenericHelpers.ts index 56d6c9ce97..1860f5052a 100644 --- a/packages/cli/src/GenericHelpers.ts +++ b/packages/cli/src/GenericHelpers.ts @@ -1,9 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable no-param-reassign */ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import type express from 'express'; import type { ExecutionError, @@ -56,7 +50,7 @@ export function getSessionId(req: express.Request): string | undefined { * - If the name already exists more than once with suffixes, it looks for the max suffix * and returns the requested name with max suffix + 1. */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + export async function generateUniqueName( requestedName: string, entityType: 'workflow' | 'credentials', @@ -85,7 +79,6 @@ export async function generateUniqueName( const suffix = Number(parts[1]); - // eslint-disable-next-line no-restricted-globals if (!isNaN(suffix) && Math.ceil(suffix) > acc) { acc = Math.ceil(suffix); } @@ -129,7 +122,7 @@ export async function validateEntity( * @returns * @memberof ActiveWorkflowRunner */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + export async function createErrorExecution( error: ExecutionError, node: INode, diff --git a/packages/cli/src/InternalHooks.ts b/packages/cli/src/InternalHooks.ts index 8fe2bc42f5..7cb5e4e065 100644 --- a/packages/cli/src/InternalHooks.ts +++ b/packages/cli/src/InternalHooks.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { Service } from 'typedi'; import { snakeCase } from 'change-case'; import { BinaryDataManager } from 'n8n-core'; diff --git a/packages/cli/src/Ldap/LdapService.ee.ts b/packages/cli/src/Ldap/LdapService.ee.ts index 63394a4145..216af1da33 100644 --- a/packages/cli/src/Ldap/LdapService.ee.ts +++ b/packages/cli/src/Ldap/LdapService.ee.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-underscore-dangle */ import type { Entry as LdapUser, ClientOptions } from 'ldapts'; import { Client } from 'ldapts'; import type { LdapConfig } from './types'; diff --git a/packages/cli/src/Logger.ts b/packages/cli/src/Logger.ts index bbfc2213fa..2a113cb8cc 100644 --- a/packages/cli/src/Logger.ts +++ b/packages/cli/src/Logger.ts @@ -1,7 +1,4 @@ -/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-shadow */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { inspect } from 'util'; import winston from 'winston'; @@ -24,7 +21,6 @@ export class Logger implements ILogger { .map((output) => output.trim()); this.logger = winston.createLogger({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment level, silent: level === 'silent', }); @@ -36,9 +32,8 @@ export class Logger implements ILogger { winston.format.metadata(), winston.format.timestamp(), winston.format.colorize({ all: true }), - // eslint-disable-next-line @typescript-eslint/no-shadow + winston.format.printf(({ level, message, timestamp, metadata }) => { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions return `${timestamp} | ${level.padEnd(18)} | ${message}${ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument Object.keys(metadata).length ? ` ${JSON.stringify(inspect(metadata))}` : '' @@ -118,7 +113,6 @@ export class Logger implements ILogger { let activeLoggerInstance: Logger | undefined; -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function getLogger() { if (activeLoggerInstance === undefined) { activeLoggerInstance = new Logger(); diff --git a/packages/cli/src/PublicApi/v1/handlers/credentials/credentials.service.ts b/packages/cli/src/PublicApi/v1/handlers/credentials/credentials.service.ts index e207ac55bc..41460ccb7c 100644 --- a/packages/cli/src/PublicApi/v1/handlers/credentials/credentials.service.ts +++ b/packages/cli/src/PublicApi/v1/handlers/credentials/credentials.service.ts @@ -46,7 +46,6 @@ export async function createCredential( } else { // Add the added date for node access permissions newCredential.nodesAccess.forEach((nodeAccess) => { - // eslint-disable-next-line no-param-reassign nodeAccess.date = new Date(); }); } @@ -115,7 +114,6 @@ export function sanitizeCredentials( const credentialsList = argIsArray ? credentials : [credentials]; const sanitizedCredentials = credentialsList.map((credential) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { data, nodesAccess, shared, ...rest } = credential; return rest; }); @@ -191,7 +189,6 @@ export function toJsonSchema(properties: INodeProperties[]): IDataObject { let dependantValue: string | number | boolean = ''; if (displayOptionsValues && Array.isArray(displayOptionsValues) && displayOptionsValues[0]) { - // eslint-disable-next-line prefer-destructuring dependantValue = displayOptionsValues[0]; } diff --git a/packages/cli/src/Queue.ts b/packages/cli/src/Queue.ts index c1af79b7e0..ecf862a1d0 100644 --- a/packages/cli/src/Queue.ts +++ b/packages/cli/src/Queue.ts @@ -83,7 +83,6 @@ export class Queue { this.jobQueue.on('global:progress', (jobId, progress: WebhookResponse) => { this.activeExecutions.resolveResponsePromise( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access progress.executionId, WebhookHelpers.decodeWebhookResponse(progress.response), ); diff --git a/packages/cli/src/ReloadNodesAndCredentials.ts b/packages/cli/src/ReloadNodesAndCredentials.ts index 8bb28f450b..3867cc0ed6 100644 --- a/packages/cli/src/ReloadNodesAndCredentials.ts +++ b/packages/cli/src/ReloadNodesAndCredentials.ts @@ -10,7 +10,6 @@ export const reloadNodesAndCredentials = async ( nodeTypes: NodeTypes, push: Push, ) => { - // eslint-disable-next-line import/no-extraneous-dependencies const { default: debounce } = await import('lodash/debounce'); // eslint-disable-next-line import/no-extraneous-dependencies const { watch } = await import('chokidar'); diff --git a/packages/cli/src/ResponseHelper.ts b/packages/cli/src/ResponseHelper.ts index 312990f683..c759fd5bcd 100644 --- a/packages/cli/src/ResponseHelper.ts +++ b/packages/cli/src/ResponseHelper.ts @@ -1,8 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable no-console */ + /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable no-param-reassign */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + import type { Request, Response } from 'express'; import { parse, stringify } from 'flatted'; import picocolors from 'picocolors'; @@ -216,7 +215,7 @@ export function flattenExecutionData(fullExecutionData: IExecutionDb): IExecutio stoppedAt: fullExecutionData.stoppedAt, finished: fullExecutionData.finished ? fullExecutionData.finished : false, workflowId: fullExecutionData.workflowId, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + workflowData: fullExecutionData.workflowData!, status: fullExecutionData.status, }; diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 43533141ae..cfbd897b47 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -2,9 +2,9 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */ /* eslint-disable prefer-const */ -/* eslint-disable @typescript-eslint/no-invalid-void-type */ + /* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-var-requires */ + /* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -933,7 +933,6 @@ export class Server extends AbstractServer { await this.externalHooks.run('oauth1.authenticate', [oAuthOptions, oauthRequestData]); - // eslint-disable-next-line new-cap const oauth = new clientOAuth1(oAuthOptions); const options: RequestOptions = { diff --git a/packages/cli/src/TestWebhooks.ts b/packages/cli/src/TestWebhooks.ts index 7acbefc591..b9fb05837d 100644 --- a/packages/cli/src/TestWebhooks.ts +++ b/packages/cli/src/TestWebhooks.ts @@ -1,6 +1,3 @@ -/* eslint-disable consistent-return */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable no-param-reassign */ import type express from 'express'; import { Service } from 'typedi'; @@ -69,7 +66,7 @@ export class TestWebhooks { if (webhookData === undefined) { const pathElements = path.split('/'); const webhookId = pathElements.shift(); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + webhookData = activeWebhooks.get(httpMethod, pathElements.join('/'), webhookId); if (webhookData === undefined) { // The requested webhook is not registered @@ -117,7 +114,6 @@ export class TestWebhooks { throw new ResponseHelper.NotFoundError('Could not find node to process webhook.'); } - // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { try { const executionMode = 'manual'; @@ -211,7 +207,7 @@ export class TestWebhooks { let key: string; const activatedKey: string[] = []; - // eslint-disable-next-line no-restricted-syntax + for (const webhookData of webhooks) { key = `${activeWebhooks.getWebhookKey( webhookData.httpMethod, @@ -230,11 +226,10 @@ export class TestWebhooks { }; try { - // eslint-disable-next-line no-await-in-loop await activeWebhooks.add(workflow, webhookData, mode, activation); } catch (error) { activatedKey.forEach((deleteKey) => delete testWebhookData[deleteKey]); - // eslint-disable-next-line no-await-in-loop + await activeWebhooks.removeWorkflow(workflow); throw error; } @@ -250,12 +245,11 @@ export class TestWebhooks { cancelTestWebhook(workflowId: string): boolean { let foundWebhook = false; const { activeWebhooks, push, testWebhookData } = this; - // eslint-disable-next-line no-restricted-syntax + for (const webhookKey of Object.keys(testWebhookData)) { const { sessionId, timeout, workflow, workflowData } = testWebhookData[webhookKey]; if (workflowData.id !== workflowId) { - // eslint-disable-next-line no-continue continue; } diff --git a/packages/cli/src/UserManagement/UserManagementHelper.ts b/packages/cli/src/UserManagement/UserManagementHelper.ts index 6b23f1207c..db65a7b13a 100644 --- a/packages/cli/src/UserManagement/UserManagementHelper.ts +++ b/packages/cli/src/UserManagement/UserManagementHelper.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { In } from 'typeorm'; import { compare, genSaltSync, hash } from 'bcryptjs'; import { Container } from 'typedi'; @@ -196,7 +194,6 @@ export function rightDiff( ): T2[] { // create map { itemKey => true } for fast lookup for diff const keyMap = arr1.reduce<{ [key: string]: true }>((map, item) => { - // eslint-disable-next-line no-param-reassign map[keyExtractor1(item)] = true; return map; }, {}); diff --git a/packages/cli/src/WaitTracker.ts b/packages/cli/src/WaitTracker.ts index 8af5074828..3711c4a74d 100644 --- a/packages/cli/src/WaitTracker.ts +++ b/packages/cli/src/WaitTracker.ts @@ -1,8 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/naming-convention */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { ErrorReporterProxy as ErrorReporter, LoggerProxy as Logger, @@ -46,7 +41,6 @@ export class WaitTracker { void this.getWaitingExecutions(); } - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types async getWaitingExecutions() { Logger.debug('Wait tracker querying database for waiting executions'); // Find all the executions which should be triggered in the next 70 seconds @@ -82,7 +76,7 @@ export class WaitTracker { ); // Add timers for each waiting execution that they get started at the correct time - // eslint-disable-next-line no-restricted-syntax + for (const execution of executions) { const executionId = execution.id; if (this.waitingExecutions[executionId] === undefined) { diff --git a/packages/cli/src/WaitingWebhooks.ts b/packages/cli/src/WaitingWebhooks.ts index aa70f71ac2..09789279ac 100644 --- a/packages/cli/src/WaitingWebhooks.ts +++ b/packages/cli/src/WaitingWebhooks.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable no-param-reassign */ import type { INode, WebhookHttpMethod } from 'n8n-workflow'; import { NodeHelpers, Workflow, LoggerProxy as Logger } from 'n8n-workflow'; import { Service } from 'typedi'; @@ -145,7 +142,7 @@ export class WaitingWebhooks { fullExecutionData.id, req, res, - // eslint-disable-next-line consistent-return + (error: Error | null, data: object) => { if (error !== null) { return reject(error); diff --git a/packages/cli/src/WebhookHelpers.ts b/packages/cli/src/WebhookHelpers.ts index c286d12a9e..e17377a1a1 100644 --- a/packages/cli/src/WebhookHelpers.ts +++ b/packages/cli/src/WebhookHelpers.ts @@ -1,18 +1,16 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable no-param-reassign */ + /* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable id-denylist */ /* eslint-disable prefer-spread */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable no-restricted-syntax */ + /* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable prefer-destructuring */ + import type express from 'express'; import get from 'lodash/get'; import stream from 'stream'; @@ -92,7 +90,7 @@ export function getWorkflowWebhooks( if (parentNodes !== undefined && !parentNodes.includes(node.name)) { // If parentNodes are given check only them if they have webhooks // and no other ones - // eslint-disable-next-line no-continue + continue; } returnData.push.apply( @@ -325,7 +323,7 @@ export async function executeWebhook( } } else { // Send default response - // eslint-disable-next-line no-lonely-if + if (!didSendResponse) { responseCallback(null, { data: { @@ -685,7 +683,6 @@ export async function executeWebhook( throw new ResponseHelper.InternalServerError(e.message); }); - // eslint-disable-next-line consistent-return return executionId; } catch (e) { if (!didSendResponse) { diff --git a/packages/cli/src/WorkflowCredentials.ts b/packages/cli/src/WorkflowCredentials.ts index 94d31f49a4..cb0fc4c4b7 100644 --- a/packages/cli/src/WorkflowCredentials.ts +++ b/packages/cli/src/WorkflowCredentials.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-prototype-builtins */ import type { INode, IWorkflowCredentials } from 'n8n-workflow'; import * as Db from '@/Db'; @@ -11,14 +10,12 @@ export async function WorkflowCredentials(nodes: INode[]): Promise { date.setHours(date.getHours() - maxAge); // date reformatting needed - see https://github.com/typeorm/typeorm/issues/2286 - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const utcDate = DateUtils.mixedDateToUtcDatetimeString(date); const toPrune: Array> = [ diff --git a/packages/cli/src/WorkflowHelpers.ts b/packages/cli/src/WorkflowHelpers.ts index f71f026e30..4692f5cdb3 100644 --- a/packages/cli/src/WorkflowHelpers.ts +++ b/packages/cli/src/WorkflowHelpers.ts @@ -96,7 +96,6 @@ export async function executeErrorWorkflow( if (workflowData === null) { // The error workflow could not be found Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Calling Error Workflow for "${workflowErrorData.workflow.id}". Could not find error workflow "${workflowId}"`, { workflowId }, ); @@ -142,7 +141,6 @@ export async function executeErrorWorkflow( if (workflowStartNode === undefined) { Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Calling Error Workflow for "${workflowErrorData.workflow.id}". Could not find "${ERROR_TRIGGER_TYPE}" in workflow "${workflowId}"`, ); return; @@ -191,7 +189,7 @@ export async function executeErrorWorkflow( } catch (error) { ErrorReporter.error(error); Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `Calling Error Workflow for "${workflowErrorData.workflow.id}": "${error.message}"`, { workflowId: workflowErrorData.workflow.id }, ); @@ -207,13 +205,13 @@ export async function saveStaticData(workflow: Workflow): Promise { if (isWorkflowIdValid(workflow.id)) { // Workflow is saved so update in database try { - // eslint-disable-next-line @typescript-eslint/no-use-before-define, @typescript-eslint/no-non-null-assertion + // eslint-disable-next-line @typescript-eslint/no-use-before-define await saveStaticDataById(workflow.id!, workflow.staticData); workflow.staticData.__dataChanged = false; } catch (error) { ErrorReporter.error(error); Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `There was a problem saving the workflow with id "${workflow.id}" to save changed staticData: "${error.message}"`, { workflowId: workflow.id }, ); @@ -273,7 +271,7 @@ export async function replaceInvalidCredentials(workflow: WorkflowEntity): Promi // for loop to run DB fetches sequential and use cache to keep pressure off DB // trade-off: longer response time for less DB queries - /* eslint-disable no-await-in-loop */ + for (const node of nodes) { if (!node.credentials || node.disabled) { continue; diff --git a/packages/cli/src/WorkflowRunner.ts b/packages/cli/src/WorkflowRunner.ts index 8a22a27b3d..4eb966d1ce 100644 --- a/packages/cli/src/WorkflowRunner.ts +++ b/packages/cli/src/WorkflowRunner.ts @@ -1,15 +1,10 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable no-console */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ + /* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/prefer-optional-chain */ -/* eslint-disable no-param-reassign */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/no-unused-vars */ + import type { IProcessMessage } from 'n8n-core'; import { WorkflowExecute } from 'n8n-core'; @@ -808,7 +803,7 @@ export class WorkflowRunner { // They will display as unknown to the user // Instead of pending forever as executing when it // actually isn't anymore. - // eslint-disable-next-line @typescript-eslint/await-thenable, no-await-in-loop + this.activeExecutions.remove(executionId); } diff --git a/packages/cli/src/WorkflowRunnerProcess.ts b/packages/cli/src/WorkflowRunnerProcess.ts index 24f0a2c3a2..e5566876c2 100644 --- a/packages/cli/src/WorkflowRunnerProcess.ts +++ b/packages/cli/src/WorkflowRunnerProcess.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable consistent-return */ + /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-shadow */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/no-use-before-define */ /* eslint-disable @typescript-eslint/unbound-method */ import 'source-map-support/register'; @@ -76,7 +76,6 @@ class WorkflowRunnerProcess { [key: string]: IWorkflowExecuteProcess; } = {}; - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types static async stopProcess() { setTimeout(() => { // Attempt a graceful shutdown, giving executions 30 seconds to finish @@ -90,7 +89,6 @@ class WorkflowRunnerProcess { await initErrorHandling(); - // eslint-disable-next-line no-multi-assign const logger = (this.logger = getLogger()); LoggerProxy.init(logger); @@ -193,12 +191,10 @@ class WorkflowRunnerProcess { } try { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment await sendToParentProcess('sendMessageToUI', { source, message }); } catch (error) { ErrorReporter.error(error); this.logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access `There was a problem sending UI data to parent process: "${error.message}"`, ); } @@ -328,7 +324,7 @@ class WorkflowRunnerProcess { * Sends hook data to the parent process that it executes them * */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any async sendHookToParentProcess(hook: string, parameters: any[]) { try { await sendToParentProcess('processHook', { @@ -377,7 +373,7 @@ class WorkflowRunnerProcess { }; const preExecuteFunctions = WorkflowExecuteAdditionalData.hookFunctionsPreExecute(); - // eslint-disable-next-line no-restricted-syntax + for (const key of Object.keys(preExecuteFunctions)) { if (hookFunctions[key] === undefined) { hookFunctions[key] = []; @@ -444,7 +440,6 @@ process.on('message', async (message: IProcessMessage) => { if (workflowRunner.workflowExecute !== undefined) { const executionIds = Object.keys(workflowRunner.childExecutions); - // eslint-disable-next-line no-restricted-syntax for (const executionId of executionIds) { const childWorkflowExecute = workflowRunner.childExecutions[executionId]; runData = childWorkflowExecute.workflowExecute.getFullRunData( @@ -456,7 +451,7 @@ process.on('message', async (message: IProcessMessage) => { : new WorkflowOperationError('Workflow-Execution has been canceled!'); // If there is any data send it to parent process, if execution timedout add the error - // eslint-disable-next-line no-await-in-loop + await childWorkflowExecute.workflowExecute.processSuccessExecution( workflowRunner.childExecutions[executionId].startedAt, childWorkflowExecute.workflow, @@ -507,7 +502,6 @@ process.on('message', async (message: IProcessMessage) => { // Stop process process.exit(); } else if (message.type === 'executionId') { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access workflowRunner.executionIdCallback(message.data.executionId); } } catch (error) { diff --git a/packages/cli/src/auth/jwt.ts b/packages/cli/src/auth/jwt.ts index 3c80c1d865..53f3b7f276 100644 --- a/packages/cli/src/auth/jwt.ts +++ b/packages/cli/src/auth/jwt.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ - import jwt from 'jsonwebtoken'; import type { Response } from 'express'; import { createHash } from 'crypto'; diff --git a/packages/cli/src/commands/executeBatch.ts b/packages/cli/src/commands/executeBatch.ts index cc2470c741..000a7b0152 100644 --- a/packages/cli/src/commands/executeBatch.ts +++ b/packages/cli/src/commands/executeBatch.ts @@ -518,7 +518,7 @@ export class ExecuteBatch extends BaseCommand { setOutput(key: string, value: any) { // Temporary hack until we move to the new action. const output = process.env.GITHUB_OUTPUT; - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + fs.appendFileSync(output as unknown as fs.PathOrFileDescriptor, `${key}=${value}${os.EOL}`); } @@ -667,7 +667,6 @@ export class ExecuteBatch extends BaseCommand { const resultError = data.data.resultData.error; if (resultError) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment executionResult.error = resultError.hasOwnProperty('description') && resultError.description !== null ? resultError.description diff --git a/packages/cli/src/commands/export/credentials.ts b/packages/cli/src/commands/export/credentials.ts index 7d8734f13a..c47c75346f 100644 --- a/packages/cli/src/commands/export/credentials.ts +++ b/packages/cli/src/commands/export/credentials.ts @@ -134,7 +134,6 @@ export class ExportCredentialsCommand extends BaseCommand { for (i = 0; i < credentials.length; i++) { fileContents = JSON.stringify(credentials[i], null, flags.pretty ? 2 : undefined); const filename = `${ - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/restrict-plus-operands (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + credentials[i].id }.json`; diff --git a/packages/cli/src/commands/export/workflow.ts b/packages/cli/src/commands/export/workflow.ts index 69f795e5bc..873b69b80c 100644 --- a/packages/cli/src/commands/export/workflow.ts +++ b/packages/cli/src/commands/export/workflow.ts @@ -119,7 +119,6 @@ export class ExportWorkflowsCommand extends BaseCommand { for (i = 0; i < workflows.length; i++) { fileContents = JSON.stringify(workflows[i], null, flags.pretty ? 2 : undefined); const filename = `${ - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands, @typescript-eslint/no-non-null-assertion (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + workflows[i].id }.json`; diff --git a/packages/cli/src/commands/import/workflow.ts b/packages/cli/src/commands/import/workflow.ts index b2b1969328..4f85151ab3 100644 --- a/packages/cli/src/commands/import/workflow.ts +++ b/packages/cli/src/commands/import/workflow.ts @@ -126,7 +126,6 @@ export class ImportWorkflowsCommand extends BaseCommand { this.transformCredentials(node, credentials); if (!node.id) { - // eslint-disable-next-line no-param-reassign node.id = uuid(); } }); @@ -168,7 +167,6 @@ export class ImportWorkflowsCommand extends BaseCommand { workflow.nodes.forEach((node: INode) => { this.transformCredentials(node, credentials); if (!node.id) { - // eslint-disable-next-line no-param-reassign node.id = uuid(); } if (!node.credentials?.id) { @@ -274,7 +272,6 @@ export class ImportWorkflowsCommand extends BaseCommand { nodeCredentials.id = matchingCredentials[0].id; } - // eslint-disable-next-line no-param-reassign node.credentials[type] = nodeCredentials; } } diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 95d56062bd..84afe4770c 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -123,12 +123,12 @@ export class Start extends BaseCommand { while (executingWorkflows.length !== 0) { if (count++ % 4 === 0) { console.log(`Waiting for ${executingWorkflows.length} active executions to finish...`); - // eslint-disable-next-line array-callback-return + executingWorkflows.map((execution) => { console.log(` - Execution ID ${execution.id}, workflow ID: ${execution.workflowId}`); }); } - // eslint-disable-next-line no-await-in-loop + await sleep(500); executingWorkflows = activeExecutionsInstance.getActiveExecutions(); } @@ -259,7 +259,7 @@ export class Start extends BaseCommand { LoggerProxy.info('Attempting to reinstall missing packages', { missingPackages }); try { // Optimistic approach - stop if any installation fails - // eslint-disable-next-line no-restricted-syntax + for (const missingPackage of missingPackages) { await this.loadNodesAndCredentials.installNpmModule( missingPackage.packageName, @@ -360,7 +360,7 @@ export class Start extends BaseCommand { void this.stopProcess(); } else { // When anything else got pressed, record it and send it on enter into the child process - // eslint-disable-next-line no-lonely-if + if (key.charCodeAt(0) === 13) { // send to child process and print in terminal process.stdout.write('\n'); diff --git a/packages/cli/src/commands/update/workflow.ts b/packages/cli/src/commands/update/workflow.ts index a13721ce66..b293e266e3 100644 --- a/packages/cli/src/commands/update/workflow.ts +++ b/packages/cli/src/commands/update/workflow.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable no-console */ import { flags } from '@oclif/command'; import type { FindOptionsWhere } from 'typeorm'; import type { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity'; diff --git a/packages/cli/src/commands/webhook.ts b/packages/cli/src/commands/webhook.ts index a06ed770a9..57af6db6c9 100644 --- a/packages/cli/src/commands/webhook.ts +++ b/packages/cli/src/commands/webhook.ts @@ -46,7 +46,7 @@ export class Webhook extends BaseCommand { `Waiting for ${executingWorkflows.length} active executions to finish...`, ); } - // eslint-disable-next-line no-await-in-loop + await sleep(500); executingWorkflows = activeExecutionsInstance.getActiveExecutions(); } diff --git a/packages/cli/src/commands/worker.ts b/packages/cli/src/commands/worker.ts index e50fa29118..bae186b574 100644 --- a/packages/cli/src/commands/worker.ts +++ b/packages/cli/src/commands/worker.ts @@ -78,7 +78,7 @@ export class Worker extends BaseCommand { } active executions to finish... (wait ${waitLeft} more seconds)`, ); } - // eslint-disable-next-line no-await-in-loop + await sleep(500); } } catch (error) { @@ -238,7 +238,6 @@ export class Worker extends BaseCommand { // eslint-disable-next-line @typescript-eslint/no-shadow const { flags } = this.parse(Worker); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const redisConnectionTimeoutLimit = config.getEnv('queue.bull.redis.timeoutThreshold'); const queue = Container.get(Queue); @@ -309,7 +308,7 @@ export class Worker extends BaseCommand { app.get( '/healthz', - // eslint-disable-next-line consistent-return + async (req: express.Request, res: express.Response) => { LoggerProxy.debug('Health check started!'); diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index fdb5bf04da..31fdeb943c 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import path from 'path'; import convict from 'convict'; import { UserSettings } from 'n8n-core'; diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index 4eb63e67a2..699d0def3b 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/naming-convention */ import { readFileSync } from 'fs'; import { resolve, join, dirname } from 'path'; import type { n8n } from 'n8n-core'; diff --git a/packages/cli/src/credentials/credentials.controller.ee.ts b/packages/cli/src/credentials/credentials.controller.ee.ts index 409fb2c057..371f7f873c 100644 --- a/packages/cli/src/credentials/credentials.controller.ee.ts +++ b/packages/cli/src/credentials/credentials.controller.ee.ts @@ -36,7 +36,6 @@ EECredentialsController.get( relations: ['shared', 'shared.role', 'shared.user'], }); - // eslint-disable-next-line @typescript-eslint/unbound-method return allCredentials.map((credential: CredentialsEntity & CredentialWithSharings) => EECredentials.addOwnerAndSharings(credential), ); diff --git a/packages/cli/src/credentials/credentials.controller.ts b/packages/cli/src/credentials/credentials.controller.ts index ffa7cf9681..0ebc4c8dec 100644 --- a/packages/cli/src/credentials/credentials.controller.ts +++ b/packages/cli/src/credentials/credentials.controller.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-param-reassign */ -/* eslint-disable @typescript-eslint/no-unused-vars */ import express from 'express'; import type { INodeCredentialTestResult } from 'n8n-workflow'; import { deepCopy, LoggerProxy } from 'n8n-workflow'; diff --git a/packages/cli/src/credentials/credentials.service.ee.ts b/packages/cli/src/credentials/credentials.service.ee.ts index 2defaaaea9..29e2630604 100644 --- a/packages/cli/src/credentials/credentials.service.ee.ts +++ b/packages/cli/src/credentials/credentials.service.ee.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-param-reassign */ import type { DeleteResult, EntityManager, FindOptionsWhere } from 'typeorm'; import { In, Not } from 'typeorm'; import * as Db from '@/Db'; diff --git a/packages/cli/src/credentials/credentials.service.ts b/packages/cli/src/credentials/credentials.service.ts index e00820a958..50d445ec0d 100644 --- a/packages/cli/src/credentials/credentials.service.ts +++ b/packages/cli/src/credentials/credentials.service.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-restricted-syntax */ import { Credentials, UserSettings } from 'n8n-core'; import type { ICredentialDataDecryptedObject, @@ -111,7 +110,6 @@ export class CredentialsService { static async prepareCreateData( data: CredentialRequest.CredentialProperties, ): Promise { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { id, ...rest } = data; // This saves us a merge but requires some type casting. These @@ -327,7 +325,6 @@ export class CredentialsService { private static unredactRestoreValues(unmerged: any, replacement: any) { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument for (const [key, value] of Object.entries(unmerged)) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (value === CREDENTIAL_BLANKING_VALUE || value === CREDENTIAL_EMPTY_VALUE) { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access unmerged[key] = replacement[key]; @@ -340,7 +337,7 @@ export class CredentialsService { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access replacement[key] !== null ) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.unredactRestoreValues(value, replacement[key]); } } diff --git a/packages/cli/src/credentials/oauth2Credential.api.ts b/packages/cli/src/credentials/oauth2Credential.api.ts index b6a9573ba6..bcb3892ddf 100644 --- a/packages/cli/src/credentials/oauth2Credential.api.ts +++ b/packages/cli/src/credentials/oauth2Credential.api.ts @@ -317,7 +317,6 @@ oauth2CredentialController.get( decryptedDataOriginal.oauthTokenData = oauthToken.data; } - // eslint-disable-next-line @typescript-eslint/no-unsafe-call unset(decryptedDataOriginal, 'csrfSecret'); const credentials = new Credentials( diff --git a/packages/cli/src/curlconverter.d.ts b/packages/cli/src/curlconverter.d.ts index f55cf6c968..8808f9b5c7 100644 --- a/packages/cli/src/curlconverter.d.ts +++ b/packages/cli/src/curlconverter.d.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -/* eslint-disable import/no-default-export */ declare module 'curlconverter' { export function toJsonString(data: string): string; } diff --git a/packages/cli/src/databases/migrations/mysqldb/1630451444017-UpdateWorkflowCredentials.ts b/packages/cli/src/databases/migrations/mysqldb/1630451444017-UpdateWorkflowCredentials.ts index 083dc58ae5..78f1767622 100644 --- a/packages/cli/src/databases/migrations/mysqldb/1630451444017-UpdateWorkflowCredentials.ts +++ b/packages/cli/src/databases/migrations/mysqldb/1630451444017-UpdateWorkflowCredentials.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ diff --git a/packages/cli/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.ts b/packages/cli/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.ts index 9900e96ca5..11134d6a3f 100644 --- a/packages/cli/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.ts +++ b/packages/cli/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable n8n-local-rules/no-uncaught-json-parse */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ diff --git a/packages/cli/src/databases/migrations/mysqldb/1690000000001-MigrateIntegerKeysToString.ts b/packages/cli/src/databases/migrations/mysqldb/1690000000001-MigrateIntegerKeysToString.ts index 1e3a7062b1..4a9f71fda8 100644 --- a/packages/cli/src/databases/migrations/mysqldb/1690000000001-MigrateIntegerKeysToString.ts +++ b/packages/cli/src/databases/migrations/mysqldb/1690000000001-MigrateIntegerKeysToString.ts @@ -11,7 +11,6 @@ export class MigrateIntegerKeysToString1690000000001 implements IrreversibleMigr if (databaseType === 'mariadb') { collation = COLLATION_57; } else { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const dbVersionQuery = (await queryRunner.query('SELECT @@version')) as // eslint-disable-next-line @typescript-eslint/naming-convention | Array<{ '@@version': string }> | undefined; diff --git a/packages/cli/src/databases/migrations/postgresdb/1630419189837-UpdateWorkflowCredentials.ts b/packages/cli/src/databases/migrations/postgresdb/1630419189837-UpdateWorkflowCredentials.ts index 7a871a921b..513679bece 100644 --- a/packages/cli/src/databases/migrations/postgresdb/1630419189837-UpdateWorkflowCredentials.ts +++ b/packages/cli/src/databases/migrations/postgresdb/1630419189837-UpdateWorkflowCredentials.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ diff --git a/packages/cli/src/databases/migrations/postgresdb/1658932090381-AddNodeIds.ts b/packages/cli/src/databases/migrations/postgresdb/1658932090381-AddNodeIds.ts index 493c69dce0..08c340b1f6 100644 --- a/packages/cli/src/databases/migrations/postgresdb/1658932090381-AddNodeIds.ts +++ b/packages/cli/src/databases/migrations/postgresdb/1658932090381-AddNodeIds.ts @@ -1,6 +1,5 @@ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable n8n-local-rules/no-uncaught-json-parse */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import type { MigrationContext, ReversibleMigration } from '@db/types'; diff --git a/packages/cli/src/databases/migrations/postgresdb/1690000000000-MigrateIntegerKeysToString.ts b/packages/cli/src/databases/migrations/postgresdb/1690000000000-MigrateIntegerKeysToString.ts index 4b6adf28af..e06bcfb334 100644 --- a/packages/cli/src/databases/migrations/postgresdb/1690000000000-MigrateIntegerKeysToString.ts +++ b/packages/cli/src/databases/migrations/postgresdb/1690000000000-MigrateIntegerKeysToString.ts @@ -1,4 +1,3 @@ -/* eslint-disable n8n-local-rules/no-unneeded-backticks */ import type { MigrationContext, IrreversibleMigration } from '@db/types'; export class MigrateIntegerKeysToString1690000000000 implements IrreversibleMigration { diff --git a/packages/cli/src/databases/migrations/sqlite/1630330987096-UpdateWorkflowCredentials.ts b/packages/cli/src/databases/migrations/sqlite/1630330987096-UpdateWorkflowCredentials.ts index 57d7712c94..12872b9a5f 100644 --- a/packages/cli/src/databases/migrations/sqlite/1630330987096-UpdateWorkflowCredentials.ts +++ b/packages/cli/src/databases/migrations/sqlite/1630330987096-UpdateWorkflowCredentials.ts @@ -1,5 +1,5 @@ /* eslint-disable n8n-local-rules/no-uncaught-json-parse */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ diff --git a/packages/cli/src/databases/migrations/sqlite/1658930531669-AddNodeIds.ts b/packages/cli/src/databases/migrations/sqlite/1658930531669-AddNodeIds.ts index 6fe635848a..c6a2a785e9 100644 --- a/packages/cli/src/databases/migrations/sqlite/1658930531669-AddNodeIds.ts +++ b/packages/cli/src/databases/migrations/sqlite/1658930531669-AddNodeIds.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ + /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable n8n-local-rules/no-uncaught-json-parse */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ diff --git a/packages/cli/src/databases/utils/migrationHelpers.ts b/packages/cli/src/databases/utils/migrationHelpers.ts index bbb626395c..92ecac3a05 100644 --- a/packages/cli/src/databases/utils/migrationHelpers.ts +++ b/packages/cli/src/databases/utils/migrationHelpers.ts @@ -165,7 +165,6 @@ export async function runInBatches( let batchedQuery: string; let batchedQueryResults: unknown[]; - // eslint-disable-next-line no-param-reassign if (query.trim().endsWith(';')) query = query.trim().slice(0, -1); do { diff --git a/packages/cli/src/decorators/registerController.ts b/packages/cli/src/decorators/registerController.ts index 54ff6bbbbc..80e5ff7235 100644 --- a/packages/cli/src/decorators/registerController.ts +++ b/packages/cli/src/decorators/registerController.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ import { Router } from 'express'; import type { Application, Request, Response, RequestHandler } from 'express'; import type { Config } from '@/config'; diff --git a/packages/cli/src/environments/variables/variables.service.ee.ts b/packages/cli/src/environments/variables/variables.service.ee.ts index 429c656de3..60ab1232e9 100644 --- a/packages/cli/src/environments/variables/variables.service.ee.ts +++ b/packages/cli/src/environments/variables/variables.service.ee.ts @@ -42,7 +42,7 @@ export class EEVariablesService extends VariablesService { static async update(id: string, variable: Omit): Promise { this.validateVariable(variable); await collections.Variables.update(id, variable); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return (await this.get(id))!; } } diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts index a9f5c0fee0..6693c79218 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ + import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; import * as Sentry from '@sentry/node'; import { diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts index f5f4981667..e2115c3bcb 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import syslog from 'syslog-client'; import type { MessageEventBusDestinationOptions } from 'n8n-workflow'; diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts index 8eb9e0a75a..2a97f4471d 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts @@ -1,16 +1,18 @@ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ + import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; import axios from 'axios'; import type { AxiosRequestConfig, Method } from 'axios'; -import { jsonParse, LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow'; +import { + jsonParse, + LoggerProxy, + MessageEventBusDestinationTypeNames, + MessageEventBusDestinationWebhookOptions, +} from 'n8n-workflow'; import type { MessageEventBusDestinationOptions, - MessageEventBusDestinationWebhookOptions, MessageEventBusDestinationWebhookParameterItem, MessageEventBusDestinationWebhookParameterOptions, } from 'n8n-workflow'; @@ -20,7 +22,8 @@ import { Agent as HTTPSAgent } from 'https'; import config from '@/config'; import { isLogStreamingEnabled } from '../MessageEventBus/MessageEventBusHelper'; import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '../MessageEventBus/MessageEventBus'; +import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus'; export const isMessageEventBusDestinationWebhookOptions = ( candidate: unknown, diff --git a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts index efc0de1e21..80837609a9 100644 --- a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts +++ b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-explicit-any */ + import { isEventMessageOptions } from '../EventMessageClasses/AbstractEventMessage'; import { UserSettings } from 'n8n-core'; import path, { parse } from 'path'; @@ -219,7 +219,6 @@ export class MessageEventBusLogWriter { } } catch (error) { LoggerProxy.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Error reading line messages from file: ${logFileName}, line: ${line}, ${error.message}}`, ); } diff --git a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts index 2672a3b987..06d95a3bb2 100644 --- a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts +++ b/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts @@ -90,7 +90,6 @@ if (!isMainThread) { clearInterval(fileStatTimer); break; case 'initialize': - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const settings: MessageEventBusLogWriterOptions = { logFullBasePath: (data as MessageEventBusLogWriterOptions).logFullBasePath ?? '', keepNumberOfFiles: (data as MessageEventBusLogWriterOptions).keepNumberOfFiles ?? 10, diff --git a/packages/cli/src/eventbus/eventBus.controller.ts b/packages/cli/src/eventbus/eventBus.controller.ts index 7c9ce21ccc..123f9c33ad 100644 --- a/packages/cli/src/eventbus/eventBus.controller.ts +++ b/packages/cli/src/eventbus/eventBus.controller.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-explicit-any */ import express from 'express'; import { isEventMessageOptions } from './EventMessageClasses/AbstractEventMessage'; @@ -202,7 +200,6 @@ export class EventBusController { break; default: throw new BadRequestError( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Body is missing ${req.body.__type} options or type ${req.body.__type} is unknown`, ); } diff --git a/packages/cli/src/executions/executions.service.ts b/packages/cli/src/executions/executions.service.ts index ac934f09bd..73f4a73e10 100644 --- a/packages/cli/src/executions/executions.service.ts +++ b/packages/cli/src/executions/executions.service.ts @@ -1,6 +1,3 @@ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { validate as jsonSchemaValidate } from 'jsonschema'; import type { IWorkflowBase, JsonObject, ExecutionStatus } from 'n8n-workflow'; import { LoggerProxy, jsonParse, Workflow } from 'n8n-workflow'; diff --git a/packages/cli/src/license/license.controller.ts b/packages/cli/src/license/license.controller.ts index 46106f7bfb..6d4eb70577 100644 --- a/packages/cli/src/license/license.controller.ts +++ b/packages/cli/src/license/license.controller.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-param-reassign */ - import express from 'express'; import { LoggerProxy } from 'n8n-workflow'; diff --git a/packages/cli/src/services/cache.service.ts b/packages/cli/src/services/cache.service.ts index 64d203106c..1b10f20b4f 100644 --- a/packages/cli/src/services/cache.service.ts +++ b/packages/cli/src/services/cache.service.ts @@ -22,7 +22,6 @@ export class CacheService { backend === 'redis' || (backend === 'auto' && config.getEnv('executions.mode') === 'queue') ) { - // eslint-disable-next-line @typescript-eslint/naming-convention const { redisInsStore } = await import('cache-manager-ioredis-yet'); // #region TEMPORARY Redis Client Code diff --git a/packages/cli/src/sso/saml/saml.service.ee.ts b/packages/cli/src/sso/saml/saml.service.ee.ts index 5e1c2847a7..ebc68b2864 100644 --- a/packages/cli/src/sso/saml/saml.service.ee.ts +++ b/packages/cli/src/sso/saml/saml.service.ee.ts @@ -313,7 +313,6 @@ export class SamlService { } } catch (error) { throw new BadRequestError( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `Error fetching SAML Metadata from ${this._samlPreferences.metadataUrl}: ${error}`, ); } diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index 244c421c36..7e78ca996a 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import type RudderStack from '@rudderstack/rudder-sdk-node'; import { PostHogClient } from '@/posthog'; import type { ITelemetryTrackProperties } from 'n8n-workflow'; @@ -148,7 +146,6 @@ export class Telemetry { first: execTime, }; } else { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.executionCountsBuffer[workflowId][key]!.count++; } diff --git a/packages/cli/src/workflows/workflows.controller.ts b/packages/cli/src/workflows/workflows.controller.ts index c723fe7ba4..ead52e3063 100644 --- a/packages/cli/src/workflows/workflows.controller.ts +++ b/packages/cli/src/workflows/workflows.controller.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-param-reassign */ - import express from 'express'; import { v4 as uuid } from 'uuid'; import { LoggerProxy } from 'n8n-workflow'; diff --git a/packages/cli/test/integration/shared/testDb.ts b/packages/cli/test/integration/shared/testDb.ts index ea2d0d4403..5972fe5962 100644 --- a/packages/cli/test/integration/shared/testDb.ts +++ b/packages/cli/test/integration/shared/testDb.ts @@ -219,7 +219,6 @@ export async function createManyUsers( amount: number, attributes: Partial = {}, ): Promise { - // eslint-disable-next-line prefer-const let { email, password, firstName, lastName, globalRole, ...rest } = attributes; if (!globalRole) { globalRole = await getGlobalMemberRole(); diff --git a/packages/core/package.json b/packages/core/package.json index 3e06b6382e..96f90c1154 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -24,8 +24,8 @@ "build": "tsc -p tsconfig.build.json", "dev": "pnpm watch", "format": "prettier --write . --ignore-path ../../.prettierignore", - "lint": "eslint --quiet .", - "lintfix": "eslint . --fix", + "lint": "eslint . --quiet --report-unused-disable-directives", + "lintfix": "eslint . --fix --report-unused-disable-directives", "watch": "tsc -p tsconfig.build.json --watch", "test": "jest" }, diff --git a/packages/core/src/ActiveWorkflows.ts b/packages/core/src/ActiveWorkflows.ts index 31715c9e58..66eb1a0661 100644 --- a/packages/core/src/ActiveWorkflows.ts +++ b/packages/core/src/ActiveWorkflows.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable no-continue */ -/* eslint-disable no-await-in-loop */ -/* eslint-disable no-restricted-syntax */ + import { CronJob } from 'cron'; import type { @@ -31,7 +29,6 @@ export class ActiveWorkflows { * @param {string} id The id of the workflow to check */ isActive(id: string): boolean { - // eslint-disable-next-line no-prototype-builtins return this.workflowData.hasOwnProperty(id); } @@ -84,13 +81,12 @@ export class ActiveWorkflows { ); if (triggerResponse !== undefined) { // If a response was given save it - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.workflowData[id].triggerResponses!.push(triggerResponse); } } catch (error) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call throw new WorkflowActivationError( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `There was a problem activating the workflow: "${error.message}"`, { cause: error as Error, node: triggerNode }, ); @@ -102,7 +98,6 @@ export class ActiveWorkflows { this.workflowData[id].pollResponses = []; for (const pollNode of pollNodes) { try { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.workflowData[id].pollResponses!.push( await this.activatePolling( pollNode, @@ -114,9 +109,8 @@ export class ActiveWorkflows { ), ); } catch (error) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call throw new WorkflowActivationError( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `There was a problem activating the workflow: "${error.message}"`, { cause: error as Error, node: pollNode }, ); @@ -147,7 +141,6 @@ export class ActiveWorkflows { const cronTimes = (pollTimes.item || []).map(toCronExpression); // The trigger function to execute when the cron-time got reached const executeTrigger = async (testingTrigger = false) => { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions Logger.debug(`Polling trigger initiated for workflow "${workflow.name}"`, { workflowName: workflow.name, workflowId: workflow.id, @@ -177,7 +170,7 @@ export class ActiveWorkflows { // Start the cron-jobs const cronJobs: CronJob[] = []; - // eslint-disable-next-line @typescript-eslint/no-shadow + for (const cronTime of cronTimes) { const cronTimeParts = cronTime.split(' '); if (cronTimeParts.length > 0 && cronTimeParts[0].includes('*')) { @@ -221,7 +214,7 @@ export class ActiveWorkflows { await triggerResponse.closeFunction(); } catch (error) { Logger.error( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `There was a problem deactivating trigger of workflow "${id}": "${error.message}"`, { workflowId: id, @@ -239,7 +232,7 @@ export class ActiveWorkflows { await pollResponse.closeFunction(); } catch (error) { Logger.error( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `There was a problem deactivating polling trigger of workflow "${id}": "${error.message}"`, { workflowId: id, diff --git a/packages/core/src/Constants.ts b/packages/core/src/Constants.ts index 72894e6eaa..84cb1f5ba2 100644 --- a/packages/core/src/Constants.ts +++ b/packages/core/src/Constants.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ export const CUSTOM_EXTENSION_ENV = 'N8N_CUSTOM_EXTENSIONS'; export const DOWNLOADED_NODES_SUBDIRECTORY = 'nodes'; export const ENCRYPTION_KEY_ENV_OVERWRITE = 'N8N_ENCRYPTION_KEY'; diff --git a/packages/core/src/Credentials.ts b/packages/core/src/Credentials.ts index 577f7fd700..7837fbcabb 100644 --- a/packages/core/src/Credentials.ts +++ b/packages/core/src/Credentials.ts @@ -12,7 +12,6 @@ export class Credentials extends ICredentials { * Returns if the given nodeType has access to data */ hasNodeAccess(nodeType: string): boolean { - // eslint-disable-next-line no-restricted-syntax for (const accessData of this.nodesAccess) { if (accessData.nodeType === nodeType) { return true; @@ -81,7 +80,6 @@ export class Credentials extends ICredentials { throw new Error('No data was set.'); } - // eslint-disable-next-line no-prototype-builtins if (!fullData.hasOwnProperty(key)) { throw new Error(`No data for key "${key}" exists.`); } diff --git a/packages/core/src/ExtractValue.ts b/packages/core/src/ExtractValue.ts index dcfadf4e2f..749fa12ce8 100644 --- a/packages/core/src/ExtractValue.ts +++ b/packages/core/src/ExtractValue.ts @@ -30,7 +30,6 @@ function findPropertyFromParameterName( ); }; - // eslint-disable-next-line no-restricted-syntax for (const p of paramParts) { const param = p.split('[')[0]; if (!property) { diff --git a/packages/core/src/LoadNodeDetails.ts b/packages/core/src/LoadNodeDetails.ts index 582183b987..12b807c7cc 100644 --- a/packages/core/src/LoadNodeDetails.ts +++ b/packages/core/src/LoadNodeDetails.ts @@ -76,7 +76,6 @@ export abstract class LoadNodeDetails { } protected getTempNode() { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion return this.workflow.getNode(TEMP_NODE_NAME)!; } } diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index aefb5d5003..f4ea6a3fab 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -3,15 +3,14 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/naming-convention */ -/* eslint-disable new-cap */ + /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/no-shadow */ -/* eslint-disable no-param-reassign */ + import type { GenericValue, IAdditionalCredentialOptions, @@ -2143,7 +2142,6 @@ export function getWebhookDescription( return undefined; } - // eslint-disable-next-line no-restricted-syntax for (const webhookDescription of nodeType.description.webhooks) { if (webhookDescription.name === name) { return webhookDescription; @@ -2561,7 +2559,6 @@ export function getExecuteFunctions( additionalData.sendMessageToUI(node.name, args); } } catch (error) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions Logger.warn(`There was a problem sending message to UI: ${error.message}`); } }, diff --git a/packages/core/src/UserSettings.ts b/packages/core/src/UserSettings.ts index 748c087bbd..ee947c3061 100644 --- a/packages/core/src/UserSettings.ts +++ b/packages/core/src/UserSettings.ts @@ -1,6 +1,5 @@ -/* eslint-disable no-param-reassign */ /* eslint-disable @typescript-eslint/no-use-before-define */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ + /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import fs from 'fs'; import path from 'path'; @@ -58,7 +57,6 @@ export async function prepareUserSettings(): Promise { userSettings.instanceId = await generateInstanceId(userSettings.encryptionKey); - // eslint-disable-next-line no-console console.log(`UserSettings were generated and saved to: ${settingsPath}`); return writeUserSettings(userSettings, settingsPath); @@ -202,7 +200,6 @@ export async function getUserSettings( const settingsFile = await fsReadFile(settingsPath, 'utf8'); try { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument settingsCache = JSON.parse(settingsFile); } catch (error) { throw new Error( diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index 6fe4838115..47258f615f 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -1,13 +1,8 @@ /* eslint-disable @typescript-eslint/prefer-optional-chain */ -/* eslint-disable no-await-in-loop */ -/* eslint-disable no-labels */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable no-continue */ -/* eslint-disable no-prototype-builtins */ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable no-param-reassign */ + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ import PCancelable from 'p-cancelable'; @@ -308,7 +303,6 @@ export class WorkflowExecute { return; } - // eslint-disable-next-line consistent-return return this.additionalData.hooks.executeHookFunctions(hookName, parameters); } @@ -828,7 +822,7 @@ export class WorkflowExecute { }; // Set the incoming data of the node that it can be saved correctly - // eslint-disable-next-line prefer-destructuring + executionData = this.runExecutionData.executionData!.nodeExecutionStack[0]; this.runExecutionData.resultData = { runData: { @@ -1033,7 +1027,7 @@ export class WorkflowExecute { if (runNodeData.closeFunction) { // Explanation why we do this can be found in n8n-workflow/Workflow.ts -> runNode - // eslint-disable-next-line @typescript-eslint/no-unsafe-call + closeFunction = runNodeData.closeFunction(); } } @@ -1531,7 +1525,7 @@ export class WorkflowExecute { // Check if static data changed let newStaticData: IDataObject | undefined; - // eslint-disable-next-line no-underscore-dangle + if (workflow.staticData.__dataChanged === true) { // Static data of workflow changed newStaticData = workflow.staticData; @@ -1539,7 +1533,6 @@ export class WorkflowExecute { await this.executeHook('workflowExecuteAfter', [fullRunData, newStaticData]).catch( // eslint-disable-next-line @typescript-eslint/no-shadow (error) => { - // eslint-disable-next-line no-console console.error('There was a problem running hook "workflowExecuteAfter"', error); }, ); @@ -1549,7 +1542,6 @@ export class WorkflowExecute { await closeFunction; } catch (errorClose) { Logger.error( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions `There was a problem deactivating trigger of workflow "${workflow.id}": "${errorClose.message}"`, { workflowId: workflow.id, @@ -1600,7 +1592,7 @@ export class WorkflowExecute { // Check if static data changed let newStaticData: IDataObject | undefined; - // eslint-disable-next-line no-underscore-dangle + if (workflow.staticData.__dataChanged === true) { // Static data of workflow changed newStaticData = workflow.staticData; @@ -1612,7 +1604,6 @@ export class WorkflowExecute { await closeFunction; } catch (error) { Logger.error( - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions `There was a problem deactivating trigger of workflow "${workflow.id}": "${error.message}"`, { workflowId: workflow.id, diff --git a/packages/node-dev/commands/build.ts b/packages/node-dev/commands/build.ts index 8c9f10020d..abca4e9205 100644 --- a/packages/node-dev/commands/build.ts +++ b/packages/node-dev/commands/build.ts @@ -25,7 +25,6 @@ export class Build extends Command { }), }; - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types async run() { // eslint-disable-next-line @typescript-eslint/no-shadow const { flags } = this.parse(Build); @@ -47,10 +46,10 @@ export class Build extends Command { this.log(`The nodes got built and saved into the following folder:\n${outputDirectory}`); } catch (error) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.log(`\nGOT ERROR: "${error.message}"`); this.log('===================================='); - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument this.log(error.stack); } } diff --git a/packages/node-dev/commands/new.ts b/packages/node-dev/commands/new.ts index e83cf86e52..222c163522 100644 --- a/packages/node-dev/commands/new.ts +++ b/packages/node-dev/commands/new.ts @@ -20,7 +20,6 @@ export class New extends Command { static examples = ['$ n8n-node-dev new']; - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types async run() { try { this.log('\nCreate new credentials/node'); @@ -105,7 +104,7 @@ export class New extends Command { // node file const destinationFilePath = join( process.cwd(), - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access `${changeCase.pascalCase(nodeName)}.${typeAnswers.type.toLowerCase()}.ts`, ); @@ -152,10 +151,10 @@ export class New extends Command { this.log(`Node got created: ${destinationFilePath}`); } catch (error) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.log(`\nGOT ERROR: "${error.message}"`); this.log('===================================='); - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-member-access + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.log(error.stack); } } diff --git a/packages/node-dev/package.json b/packages/node-dev/package.json index 514ec7a027..0f4ba5cee9 100644 --- a/packages/node-dev/package.json +++ b/packages/node-dev/package.json @@ -24,8 +24,8 @@ "build": "tsc --noEmit", "build-node-dev": "tsc", "format": "prettier --write . --ignore-path ../../.prettierignore", - "lint": "eslint --quiet .", - "lintfix": "eslint . --fix", + "lint": "eslint . --quiet --report-unused-disable-directives", + "lintfix": "eslint . --fix --report-unused-disable-directives", "postpack": "rm -f oclif.manifest.json", "prepack": "echo \"Building project...\" && rm -rf dist && tsc -b && oclif-dev manifest", "watch": "tsc --watch" diff --git a/packages/node-dev/src/Build.ts b/packages/node-dev/src/Build.ts index 096d4b6c06..b463bd1959 100644 --- a/packages/node-dev/src/Build.ts +++ b/packages/node-dev/src/Build.ts @@ -15,19 +15,19 @@ import type { IBuildOptions } from './Interfaces'; * directory: * https://github.com/Microsoft/TypeScript/issues/25430 */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + export async function createCustomTsconfig() { // Get path to simple tsconfig file which should be used for build const tsconfigPath = join(dirname(require.resolve('n8n-node-dev/src')), 'tsconfig-build.json'); // Read the tsconfig file const tsConfigString = await readFile(tsconfigPath, { encoding: 'utf8' }); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const tsConfig = jsonParse<{ include: string[] }>(tsConfigString); // Set absolute include paths const newIncludeFiles = []; - // eslint-disable-next-line no-restricted-syntax + for (const includeFile of tsConfig.include) { newIncludeFiles.push(join(process.cwd(), includeFile)); } @@ -101,7 +101,6 @@ export async function buildFiles({ let errorMessage = error.message; if (error.stdout !== undefined) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions errorMessage = `${errorMessage}\nGot following output:\n${error.stdout}`; } diff --git a/packages/workflow/package.json b/packages/workflow/package.json index de8fb5d911..170d1d4a5d 100644 --- a/packages/workflow/package.json +++ b/packages/workflow/package.json @@ -29,8 +29,8 @@ "typecheck": "tsc", "build": "tsc -p tsconfig.build.json", "format": "prettier --write . --ignore-path ../../.prettierignore", - "lint": "eslint --quiet .", - "lintfix": "eslint . --fix", + "lint": "eslint . --quiet --report-unused-disable-directives", + "lintfix": "eslint . --fix --report-unused-disable-directives", "watch": "tsc -p tsconfig.build.json --watch", "test": "jest", "test:dev": "jest --watch" diff --git a/packages/workflow/src/AugmentObject.ts b/packages/workflow/src/AugmentObject.ts index 2b35fb4d74..dd4e868f85 100644 --- a/packages/workflow/src/AugmentObject.ts +++ b/packages/workflow/src/AugmentObject.ts @@ -88,7 +88,6 @@ export function augmentObject(data: T): T { return newData[key]; } - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const value = Reflect.get(target, key, receiver); if (typeof value !== 'object' || value === null) return value; diff --git a/packages/workflow/src/Constants.ts b/packages/workflow/src/Constants.ts index c81cfd9e7c..661b9d014a 100644 --- a/packages/workflow/src/Constants.ts +++ b/packages/workflow/src/Constants.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/naming-convention */ export const BINARY_ENCODING = 'base64'; export const WAIT_TIME_UNLIMITED = '3000-01-01T00:00:00.000Z'; diff --git a/packages/workflow/src/Expression.ts b/packages/workflow/src/Expression.ts index 22e1d8c873..a99040b000 100644 --- a/packages/workflow/src/Expression.ts +++ b/packages/workflow/src/Expression.ts @@ -52,7 +52,7 @@ const AsyncFunction = (async () => {}).constructor as FunctionConstructor; const fnConstructors = { sync: Function.prototype.constructor, - // eslint-disable-next-line @typescript-eslint/ban-types + async: AsyncFunction.prototype.constructor, mock: () => { throw new ExpressionError('Arbitrary code execution detected'); @@ -130,7 +130,7 @@ export class Expression { // Is an expression // Remove the equal sign - // eslint-disable-next-line no-param-reassign + parameterValue = parameterValue.substr(1); // Generate a data proxy which allows to query workflow data @@ -573,7 +573,7 @@ export class Expression { // Data is an object const returnData: INodeParameters = {}; - // eslint-disable-next-line no-restricted-syntax + for (const [key, value] of Object.entries(parameterValue)) { returnData[key] = resolveParameterValue( value as NodeParameterValueType, diff --git a/packages/workflow/src/Extensions/ArrayExtensions.ts b/packages/workflow/src/Extensions/ArrayExtensions.ts index 06383a6c82..8c33fd98c4 100644 --- a/packages/workflow/src/Extensions/ArrayExtensions.ts +++ b/packages/workflow/src/Extensions/ArrayExtensions.ts @@ -182,7 +182,7 @@ function chunk(value: unknown[], extraArgs: number[]) { const chunks: unknown[][] = []; for (let i = 0; i < value.length; i += chunkSize) { // I have no clue why eslint thinks 2 numbers could be anything but that but here we are - // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + chunks.push(value.slice(i, i + chunkSize)); } return chunks; @@ -275,7 +275,6 @@ function union(value: unknown[], extraArgs: unknown[][]): unknown[] { } const newArr: unknown[] = Array.from(value); for (const v of others) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call if (newArr.findIndex((w) => deepEqual(w, v, { strict: true })) === -1) { newArr.push(v); } @@ -313,7 +312,6 @@ function intersection(value: unknown[], extraArgs: unknown[][]): unknown[] { } } for (const v of others) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call if (value.findIndex((w) => deepEqual(w, v, { strict: true })) !== -1) { newArr.push(v); } diff --git a/packages/workflow/src/Extensions/DateExtensions.ts b/packages/workflow/src/Extensions/DateExtensions.ts index 5ad709654a..6389e9fcb2 100644 --- a/packages/workflow/src/Extensions/DateExtensions.ts +++ b/packages/workflow/src/Extensions/DateExtensions.ts @@ -1,6 +1,5 @@ import { ExpressionExtensionError } from './../ExpressionError'; -/* eslint-disable @typescript-eslint/unbound-method */ -/* eslint-disable @typescript-eslint/explicit-member-accessibility */ + import { DateTime } from 'luxon'; import type { DateTimeUnit, diff --git a/packages/workflow/src/Extensions/ExpressionExtension.ts b/packages/workflow/src/Extensions/ExpressionExtension.ts index 6600f8e8ea..809d7a4886 100644 --- a/packages/workflow/src/Extensions/ExpressionExtension.ts +++ b/packages/workflow/src/Extensions/ExpressionExtension.ts @@ -88,7 +88,6 @@ export const hasNativeMethod = (method: string): boolean => { // eslint-disable-next-line @typescript-eslint/no-explicit-any function parseWithEsprimaNext(source: string, options?: any): any { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument const ast = esprimaParse(source, { loc: true, locations: true, @@ -451,7 +450,6 @@ interface FoundFunction { function: Function; } -// eslint-disable-next-line @typescript-eslint/ban-types function findExtendedFunction(input: unknown, functionName: string): FoundFunction | undefined { // eslint-disable-next-line @typescript-eslint/ban-types let foundFunction: Function | undefined; @@ -479,12 +477,7 @@ function findExtendedFunction(input: unknown, functionName: string): FoundFuncti const inputAny: any = input; // This is likely a builtin we're implementing for another type // (e.g. toLocaleString). We'll return that instead - if ( - inputAny && - functionName && - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - typeof inputAny[functionName] === 'function' - ) { + if (inputAny && functionName && typeof inputAny[functionName] === 'function') { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment return { type: 'native', function: inputAny[functionName] }; } @@ -508,7 +501,6 @@ function findExtendedFunction(input: unknown, functionName: string): FoundFuncti * ``` */ export function extend(input: unknown, functionName: string, args: unknown[]) { - // eslint-disable-next-line @typescript-eslint/ban-types const foundFunction = findExtendedFunction(input, functionName); // No type specific or generic function found. Check to see if @@ -522,7 +514,6 @@ export function extend(input: unknown, functionName: string, args: unknown[]) { } if (haveFunction.length > 1) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const lastType = `"${haveFunction.pop()!.typeName}"`; const typeNames = `${haveFunction.map((v) => `"${v.typeName}"`).join(', ')}, and ${lastType}`; throw new ExpressionExtensionError( diff --git a/packages/workflow/src/Extensions/ObjectExtensions.ts b/packages/workflow/src/Extensions/ObjectExtensions.ts index e1556d6e69..7274d4808c 100644 --- a/packages/workflow/src/Extensions/ObjectExtensions.ts +++ b/packages/workflow/src/Extensions/ObjectExtensions.ts @@ -64,7 +64,7 @@ export function compact(value: object): object { if (val !== null && val !== undefined && val !== 'nil' && val !== '') { if (typeof val === 'object') { if (Object.keys(val as object).length === 0) continue; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument newObj[key] = compact(val); } else { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access diff --git a/packages/workflow/src/Extensions/StringExtensions.ts b/packages/workflow/src/Extensions/StringExtensions.ts index 00343a05fd..69a9cae1bd 100644 --- a/packages/workflow/src/Extensions/StringExtensions.ts +++ b/packages/workflow/src/Extensions/StringExtensions.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/unbound-method */ // import { createHash } from 'crypto'; import { titleCase } from 'title-case'; import * as ExpressionError from '../ExpressionError'; @@ -295,7 +294,6 @@ function toSentenceCase(value: string) { const charIndex = current.search(CHAR_TEST_REGEXP); current = current.slice(0, charIndex) + - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion current[charIndex]!.toLocaleUpperCase() + current.slice(charIndex + 1).toLocaleLowerCase(); const puncIndex = current.search(PUNC_TEST_REGEXP); diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 9c2ec715a4..9da2110411 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -// eslint-disable-next-line max-classes-per-file + import type * as express from 'express'; import type FormData from 'form-data'; import type { IncomingHttpHeaders } from 'http'; diff --git a/packages/workflow/src/LoggerProxy.ts b/packages/workflow/src/LoggerProxy.ts index 57cf6419c9..24df176fff 100644 --- a/packages/workflow/src/LoggerProxy.ts +++ b/packages/workflow/src/LoggerProxy.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import type { ILogger, LogTypes } from './Interfaces'; let logger: ILogger | undefined; diff --git a/packages/workflow/src/NodeErrors.ts b/packages/workflow/src/NodeErrors.ts index 451e9db5dc..77fd2f7bfb 100644 --- a/packages/workflow/src/NodeErrors.ts +++ b/packages/workflow/src/NodeErrors.ts @@ -1,11 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/no-shadow */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable no-param-reassign */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -// eslint-disable-next-line max-classes-per-file + import { parseString } from 'xml2js'; import { removeCircularRefs, isTraversableObject } from './utils'; import type { IDataObject, INode, IStatusCodeMessages, JsonObject } from './Interfaces'; @@ -146,7 +143,6 @@ export abstract class NodeError extends ExecutionBaseError { potentialKeys: string[], traversalKeys: string[] = [], ): string | null { - // eslint-disable-next-line no-restricted-syntax for (const key of potentialKeys) { const value = jsonError[key]; if (value) { @@ -178,7 +174,6 @@ export abstract class NodeError extends ExecutionBaseError { } } - // eslint-disable-next-line no-restricted-syntax for (const key of traversalKeys) { const value = jsonError[key]; if (isTraversableObject(value)) { @@ -356,14 +351,13 @@ export class NodeApiError extends NodeError { } private setDescriptionFromXml(xml: string) { - // eslint-disable-next-line @typescript-eslint/naming-convention parseString(xml, { explicitArray: false }, (_, result) => { if (!result) return; // eslint-disable-next-line @typescript-eslint/no-unsafe-argument const topLevelKey = Object.keys(result)[0]; this.description = this.findProperty( - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument result[topLevelKey], ERROR_MESSAGE_PROPERTIES, ['Error'].concat(ERROR_NESTING_PROPERTIES), diff --git a/packages/workflow/src/NodeHelpers.ts b/packages/workflow/src/NodeHelpers.ts index 8e658c0e43..f13c9a1f66 100644 --- a/packages/workflow/src/NodeHelpers.ts +++ b/packages/workflow/src/NodeHelpers.ts @@ -1,17 +1,13 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ + /* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable no-console */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/no-use-before-define */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ -/* eslint-disable no-param-reassign */ -/* eslint-disable no-continue */ + /* eslint-disable prefer-spread */ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + import get from 'lodash/get'; import isEqual from 'lodash/isEqual'; @@ -415,7 +411,6 @@ export function getContext( } if (runExecutionData.executionData.contextData[key] === undefined) { - // eslint-disable-next-line no-param-reassign runExecutionData.executionData.contextData[key] = {}; } @@ -1258,7 +1253,6 @@ export const tryToParseObject = (value: unknown): object => { return value; } try { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const o = JSON.parse(String(value)); if (typeof o !== 'object' || Array.isArray(o)) { throw new Error(`The value "${String(value)}" is not a valid object.`); @@ -1318,7 +1312,7 @@ export const validateResourceMapperParameter = ( const key = `${nodeProperties.name}.${field.id}`; const fieldErrors: string[] = []; if (field.required && !skipRequiredCheck) { - if (value.value === null || fieldValue === null || fieldValue === undefined) { + if (value.value === null || fieldValue === undefined) { const error = `${fieldWordSingular} "${field.id}" is required`; fieldErrors.push(error); } diff --git a/packages/workflow/src/ObservableObject.ts b/packages/workflow/src/ObservableObject.ts index d5d0c8f422..c9c2b7e9b3 100644 --- a/packages/workflow/src/ObservableObject.ts +++ b/packages/workflow/src/ObservableObject.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-shadow */ -/* eslint-disable no-param-reassign */ -/* eslint-disable no-underscore-dangle */ + import type { IDataObject, IObservableObject } from './Interfaces'; interface IObservableOptions { @@ -14,14 +13,13 @@ export function create( option?: IObservableOptions, depth?: number, ): IDataObject { - // eslint-disable-next-line no-param-reassign, @typescript-eslint/prefer-nullish-coalescing + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing depth = depth || 0; // Make all the children of target also observable - // eslint-disable-next-line no-restricted-syntax + for (const key in target) { if (typeof target[key] === 'object' && target[key] !== null) { - // eslint-disable-next-line no-param-reassign target[key] = create( target[key] as IDataObject, // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing @@ -37,7 +35,6 @@ export function create( writable: true, }); return new Proxy(target, { - // eslint-disable-next-line @typescript-eslint/no-shadow deleteProperty(target, name) { if (parent === undefined) { // If no parent is given mark current data as changed @@ -65,7 +62,6 @@ export function create( typeof value === 'object' && // eslint-disable-next-line @typescript-eslint/no-unsafe-argument Object.keys(value).length === 0 - // eslint-disable-next-line no-empty ) { } else { (target as IObservableObject).__dataChanged = true; diff --git a/packages/workflow/src/RoutingNode.ts b/packages/workflow/src/RoutingNode.ts index c79a318f53..4253a0d19a 100644 --- a/packages/workflow/src/RoutingNode.ts +++ b/packages/workflow/src/RoutingNode.ts @@ -1,14 +1,10 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ -/* eslint-disable no-param-reassign */ -/* eslint-disable no-continue */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable no-await-in-loop */ -/* eslint-disable no-restricted-syntax */ + import get from 'lodash/get'; import merge from 'lodash/merge'; import set from 'lodash/set'; @@ -359,7 +355,6 @@ export class RoutingNode { if (action.type === 'setKeyValue') { const returnData: INodeExecutionData[] = []; - // eslint-disable-next-line @typescript-eslint/no-loop-func inputData.forEach((item) => { const returnItem: IDataObject = {}; for (const key of Object.keys(action.properties)) { @@ -454,7 +449,7 @@ export class RoutingNode { } } else { // No postReceive functionality got defined so simply add data as it is - // eslint-disable-next-line no-lonely-if + if (Array.isArray(responseData.body)) { returnData = responseData.body.map((json) => { return { @@ -814,7 +809,7 @@ export class RoutingNode { if (nodeProperties.routing.send.type === 'body') { // Send in "body" - // eslint-disable-next-line no-lonely-if + if (nodeProperties.routing.send.propertyInDotNotation === false) { // eslint-disable-next-line @typescript-eslint/no-explicit-any (returnData.options.body as Record)![propertyName] = value; @@ -823,7 +818,7 @@ export class RoutingNode { } } else { // Send in "query" - // eslint-disable-next-line no-lonely-if + if (nodeProperties.routing.send.propertyInDotNotation === false) { returnData.options.qs![propertyName] = value; } else { diff --git a/packages/workflow/src/TelemetryHelpers.ts b/packages/workflow/src/TelemetryHelpers.ts index 69231a167e..29c1c28761 100644 --- a/packages/workflow/src/TelemetryHelpers.ts +++ b/packages/workflow/src/TelemetryHelpers.ts @@ -161,7 +161,7 @@ export function generateNodesGraph( nodeItem.src_instance_id = options.sourceInstanceId; } - if (node.id && options?.nodeIdMap && options.nodeIdMap[node.id]) { + if (node.id && options?.nodeIdMap?.[node.id]) { nodeItem.src_node_id = options.nodeIdMap[node.id]; } diff --git a/packages/workflow/src/Workflow.ts b/packages/workflow/src/Workflow.ts index 981717df1d..02c104d2db 100644 --- a/packages/workflow/src/Workflow.ts +++ b/packages/workflow/src/Workflow.ts @@ -1,18 +1,11 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ -/* eslint-disable no-await-in-loop */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ + /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable no-param-reassign */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-for-in-array */ -/* eslint-disable no-prototype-builtins */ + /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ -/* eslint-disable no-underscore-dangle */ -/* eslint-disable no-continue */ -/* eslint-disable no-restricted-syntax */ import type { IConnections, @@ -214,7 +207,6 @@ export class Workflow { continue; } - // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (ignoreNodeTypes !== undefined && ignoreNodeTypes.includes(node.type)) { continue; } @@ -482,7 +474,6 @@ export class Workflow { const returnData: any = {}; for (const parameterName of Object.keys(parameterValue || {})) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access returnData[parameterName] = this.renameNodeInParameterValue( parameterValue![parameterName as keyof typeof parameterValue], currentName, diff --git a/packages/workflow/src/WorkflowDataProxy.ts b/packages/workflow/src/WorkflowDataProxy.ts index 68559fda2b..2a044cfc91 100644 --- a/packages/workflow/src/WorkflowDataProxy.ts +++ b/packages/workflow/src/WorkflowDataProxy.ts @@ -1,11 +1,8 @@ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/no-unused-vars */ -/* eslint-disable no-restricted-syntax */ -/* eslint-disable no-param-reassign */ + /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable no-prototype-builtins */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { DateTime, Duration, Interval, Settings } from 'luxon'; import * as jmespath from 'jmespath'; @@ -163,7 +160,7 @@ export class WorkflowDataProxy { }, get(target, name, receiver) { if (name === 'isProxy') return true; - // eslint-disable-next-line no-param-reassign + name = name.toString(); const contextData = NodeHelpers.getContext(that.runExecutionData!, 'node', node); @@ -183,7 +180,7 @@ export class WorkflowDataProxy { ownKeys(target) { return Reflect.ownKeys(target); }, - // eslint-disable-next-line @typescript-eslint/no-unused-vars + get(target, name, receiver) { if (name === 'isProxy') return true; name = name.toString(); @@ -326,7 +323,7 @@ export class WorkflowDataProxy { const taskData = that.runExecutionData.resultData.runData[nodeName][runIndex].data!; - if (taskData.main === null || !taskData.main.length || taskData.main[0] === null) { + if (!taskData.main?.length || taskData.main[0] === null) { // throw new Error(`No data found for item-index: "${itemIndex}"`); throw new ExpressionError('No data found from "main" input.', { runIndex: that.runIndex, @@ -425,7 +422,7 @@ export class WorkflowDataProxy { for (const propertyName in binaryData) { if (propertyName === 'data') { // Skip the data property - // eslint-disable-next-line no-continue + continue; } (returnData[keyName] as IDataObject)[propertyName] = binaryData[propertyName]; @@ -440,10 +437,7 @@ export class WorkflowDataProxy { // Get node parameter data return that.nodeParameterGetter(nodeName); } else if (name === 'runIndex') { - if ( - that.runExecutionData === null || - !that.runExecutionData.resultData.runData[nodeName] - ) { + if (!that.runExecutionData?.resultData.runData[nodeName]) { return -1; } return that.runExecutionData.resultData.runData[nodeName].length - 1; diff --git a/packages/workflow/src/WorkflowHooks.ts b/packages/workflow/src/WorkflowHooks.ts index 3462719bc2..1f5ad85a96 100644 --- a/packages/workflow/src/WorkflowHooks.ts +++ b/packages/workflow/src/WorkflowHooks.ts @@ -25,7 +25,7 @@ export class WorkflowHooks { workflowData: IWorkflowBase, optionalParameters?: IWorkflowHooksOptionalParameters, ) { - // eslint-disable-next-line no-param-reassign, @typescript-eslint/prefer-nullish-coalescing + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing optionalParameters = optionalParameters || {}; this.hookFunctions = hookFunctions; @@ -37,12 +37,10 @@ export class WorkflowHooks { this.retryOf = optionalParameters.retryOf ?? undefined; } - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any async executeHookFunctions(hookName: string, parameters: any[]) { if (this.hookFunctions[hookName] !== undefined && Array.isArray(this.hookFunctions[hookName])) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, no-restricted-syntax for (const hookFunction of this.hookFunctions[hookName]!) { - // eslint-disable-next-line no-await-in-loop await hookFunction.apply(this, parameters); } } diff --git a/packages/workflow/src/utils.ts b/packages/workflow/src/utils.ts index 03e1f57472..62eed4250f 100644 --- a/packages/workflow/src/utils.ts +++ b/packages/workflow/src/utils.ts @@ -131,13 +131,7 @@ export function assert(condition: T, msg?: string): asserts condition { } export const isTraversableObject = (value: any): value is JsonObject => { - return ( - value && - typeof value === 'object' && - !Array.isArray(value) && - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument - !!Object.keys(value).length - ); + return value && typeof value === 'object' && !Array.isArray(value) && !!Object.keys(value).length; }; export const removeCircularRefs = (obj: JsonObject, seen = new Set()) => { diff --git a/packages/workflow/test/Helpers.ts b/packages/workflow/test/Helpers.ts index 5409248d06..ad2b8c64b7 100644 --- a/packages/workflow/test/Helpers.ts +++ b/packages/workflow/test/Helpers.ts @@ -79,7 +79,6 @@ export class Credentials extends ICredentials { throw new Error('No data was set.'); } - // eslint-disable-next-line no-prototype-builtins if (!fullData.hasOwnProperty(key)) { throw new Error(`No data for key "${key}" exists.`); } @@ -327,7 +326,6 @@ export function getExecuteFunctions( additionalData.sendMessageToUI(node.name, args); } } catch (error) { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions console.error(`There was a problem sending message to UI: ${error.message}`); } },