diff --git a/package.json b/package.json index 97ee59687d..2f94b38c11 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "nock": "^13.3.2", "nodemon": "^3.0.1", "p-limit": "^3.1.0", - "prettier": "*", + "prettier": "^3.0.0", "rimraf": "^5.0.1", "run-script-os": "^1.0.7", "start-server-and-test": "^2.0.0", @@ -73,7 +73,6 @@ "@types/node": "^18.16.16", "chokidar": "3.5.2", "jsonwebtoken": "9.0.0", - "prettier": "^3.0.0", "semver": "^7.5.4", "tough-cookie": "^4.1.3", "tslib": "^2.6.1", diff --git a/packages/cli/.eslintrc.js b/packages/cli/.eslintrc.js index 1b19418266..694ed381d8 100644 --- a/packages/cli/.eslintrc.js +++ b/packages/cli/.eslintrc.js @@ -18,7 +18,14 @@ module.exports = { // TODO: Remove this 'import/no-cycle': 'warn', 'import/order': 'off', - 'import/extensions': 'off', + 'import/extensions': 'warn', '@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }], + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-base-to-string': 'warn', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', + '@typescript-eslint/no-redundant-type-constituents': 'warn', + '@typescript-eslint/ban-types': 'warn', + '@typescript-eslint/no-unsafe-enum-comparison': 'warn', + '@typescript-eslint/no-unsafe-declaration-merging': 'warn', }, }; diff --git a/packages/cli/src/ActiveWorkflowRunner.ts b/packages/cli/src/ActiveWorkflowRunner.ts index 051ffcd5a7..daae8a28f8 100644 --- a/packages/cli/src/ActiveWorkflowRunner.ts +++ b/packages/cli/src/ActiveWorkflowRunner.ts @@ -58,13 +58,16 @@ import type { WorkflowEntity } from '@db/entities/WorkflowEntity'; import type { WebhookEntity } from '@db/entities/WebhookEntity'; import { ActiveExecutions } from '@/ActiveExecutions'; import { createErrorExecution } from '@/GenericHelpers'; -import { WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, WORKFLOW_REACTIVATE_MAX_TIMEOUT } from '@/constants'; +import { + STARTING_NODES, + WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, + WORKFLOW_REACTIVATE_MAX_TIMEOUT, +} from '@/constants'; import { NodeTypes } from '@/NodeTypes'; import { WorkflowRunner } from '@/WorkflowRunner'; import { ExternalHooks } from '@/ExternalHooks'; import { whereClause } from './UserManagement/UserManagementHelper'; import { WorkflowsService } from './workflows/workflows.services'; -import { STARTING_NODES } from './constants'; import { webhookNotFoundErrorMessage } from './utils'; import { In } from 'typeorm'; import { WebhookRepository } from '@db/repositories'; diff --git a/packages/cli/src/CredentialsHelper.ts b/packages/cli/src/CredentialsHelper.ts index 03cbf74b68..1f541b0f4d 100644 --- a/packages/cli/src/CredentialsHelper.ts +++ b/packages/cli/src/CredentialsHelper.ts @@ -172,7 +172,7 @@ export class CredentialsHelper extends ICredentialsHelper { (property) => property.type === 'hidden' && property?.typeOptions?.expirable === true, ); - if (expirableProperty === undefined || expirableProperty.name === undefined) { + if (expirableProperty?.name === undefined) { return undefined; } diff --git a/packages/cli/src/CredentialsOverwrites.ts b/packages/cli/src/CredentialsOverwrites.ts index c3a5702df1..81b86c3651 100644 --- a/packages/cli/src/CredentialsOverwrites.ts +++ b/packages/cli/src/CredentialsOverwrites.ts @@ -1,6 +1,6 @@ import config from '@/config'; -import type { ICredentialDataDecryptedObject, ICredentialTypes } from 'n8n-workflow'; -import { deepCopy, LoggerProxy as Logger, jsonParse } from 'n8n-workflow'; +import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; +import { deepCopy, LoggerProxy as Logger, jsonParse, ICredentialTypes } from 'n8n-workflow'; import type { ICredentialsOverwrite } from '@/Interfaces'; class CredentialsOverwritesClass { diff --git a/packages/cli/src/TestWebhooks.ts b/packages/cli/src/TestWebhooks.ts index c9a36e9f2e..7acbefc591 100644 --- a/packages/cli/src/TestWebhooks.ts +++ b/packages/cli/src/TestWebhooks.ts @@ -35,7 +35,10 @@ export class TestWebhooks { }; } = {}; - constructor(private activeWebhooks: ActiveWebhooks, private push: Push) { + constructor( + private activeWebhooks: ActiveWebhooks, + private push: Push, + ) { activeWebhooks.testWebhooks = true; } diff --git a/packages/cli/src/WaitingWebhooks.ts b/packages/cli/src/WaitingWebhooks.ts index 7d66fda525..aa70f71ac2 100644 --- a/packages/cli/src/WaitingWebhooks.ts +++ b/packages/cli/src/WaitingWebhooks.ts @@ -16,7 +16,10 @@ import { ExecutionRepository } from '@db/repositories'; @Service() export class WaitingWebhooks { - constructor(private nodeTypes: NodeTypes, private executionRepository: ExecutionRepository) {} + constructor( + private nodeTypes: NodeTypes, + private executionRepository: ExecutionRepository, + ) {} async executeWebhook( httpMethod: WebhookHttpMethod, diff --git a/packages/cli/src/commands/execute.ts b/packages/cli/src/commands/execute.ts index fbccee762c..c708e664de 100644 --- a/packages/cli/src/commands/execute.ts +++ b/packages/cli/src/commands/execute.ts @@ -70,11 +70,7 @@ export class Execute extends BaseCommand { // Do a basic check if the data in the file looks right // TODO: Later check with the help of TypeScript data if it is valid or not - if ( - workflowData === null || - workflowData.nodes === undefined || - workflowData.connections === undefined - ) { + if (workflowData?.nodes === undefined || workflowData.connections === undefined) { this.logger.info(`The file "${flags.file}" does not contain valid workflow data.`); return; } diff --git a/packages/cli/src/controllers/translation.controller.ts b/packages/cli/src/controllers/translation.controller.ts index 6d36d650d2..8238e73ebd 100644 --- a/packages/cli/src/controllers/translation.controller.ts +++ b/packages/cli/src/controllers/translation.controller.ts @@ -17,7 +17,10 @@ export declare namespace TranslationRequest { @Authorized() @RestController('/') export class TranslationController { - constructor(private config: Config, private credentialTypes: ICredentialTypes) {} + constructor( + private config: Config, + private credentialTypes: ICredentialTypes, + ) {} @Get('/credential-translation') async getCredentialTranslation(req: TranslationRequest.Credential) { diff --git a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts b/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts index f71b03a413..7d4fbff4ad 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts +++ b/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts @@ -3,7 +3,7 @@ import { DateTime } from 'luxon'; import type { EventMessageTypeNames, JsonObject } from 'n8n-workflow'; import { v4 as uuid } from 'uuid'; import type { AbstractEventPayload } from './AbstractEventPayload'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; +import { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; import type { EventNamesTypes } from '.'; function modifyUnderscoredKeys( diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts index 0a5117b00b..373958e7db 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts @@ -1,12 +1,17 @@ import { v4 as uuid } from 'uuid'; -import type { INodeCredentials, MessageEventBusDestinationOptions } from 'n8n-workflow'; -import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow'; +import type { INodeCredentials } from 'n8n-workflow'; +import { + LoggerProxy, + MessageEventBusDestinationTypeNames, + MessageEventBusDestinationOptions, +} from 'n8n-workflow'; import * as Db from '@/Db'; import type { AbstractEventMessage } from '../EventMessageClasses/AbstractEventMessage'; import type { EventMessageTypes } from '../EventMessageClasses'; import type { DeleteResult, InsertResult } from 'typeorm'; import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '../MessageEventBus/MessageEventBus'; +import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus'; export abstract class MessageEventBusDestination implements MessageEventBusDestinationOptions { // Since you can't have static abstract functions - this just serves as a reminder that you need to implement these. Please. diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts index ab1c4ca379..a9f5c0fee0 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts @@ -3,15 +3,17 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; import * as Sentry from '@sentry/node'; -import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow'; -import type { - MessageEventBusDestinationOptions, +import { + LoggerProxy, + MessageEventBusDestinationTypeNames, MessageEventBusDestinationSentryOptions, } from 'n8n-workflow'; +import type { MessageEventBusDestinationOptions } from 'n8n-workflow'; import { isLogStreamingEnabled } from '../MessageEventBus/MessageEventBusHelper'; import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric'; import { N8N_VERSION } from '@/constants'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '../MessageEventBus/MessageEventBus'; +import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus'; export const isMessageEventBusDestinationSentryOptions = ( candidate: unknown, diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts index 13d6a1636c..f5f4981667 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts +++ b/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts @@ -2,15 +2,17 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import syslog from 'syslog-client'; -import type { - MessageEventBusDestinationOptions, +import type { MessageEventBusDestinationOptions } from 'n8n-workflow'; +import { + LoggerProxy, + MessageEventBusDestinationTypeNames, MessageEventBusDestinationSyslogOptions, } from 'n8n-workflow'; -import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow'; import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; 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 isMessageEventBusDestinationSyslogOptions = ( candidate: unknown, diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index 02a01ed691..244c421c36 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -40,7 +40,10 @@ export class Telemetry { private executionCountsBuffer: IExecutionsBuffer = {}; - constructor(private postHog: PostHogClient, private license: License) {} + constructor( + private postHog: PostHogClient, + private license: License, + ) {} setInstanceId(instanceId: string) { this.instanceId = instanceId; @@ -70,9 +73,12 @@ export class Telemetry { } private startPulse() { - this.pulseIntervalReference = setInterval(async () => { - void this.pulse(); - }, 6 * 60 * 60 * 1000); // every 6 hours + this.pulseIntervalReference = setInterval( + async () => { + void this.pulse(); + }, + 6 * 60 * 60 * 1000, + ); // every 6 hours } private async pulse(): Promise { diff --git a/packages/cli/src/workflows/workflows.controller.ts b/packages/cli/src/workflows/workflows.controller.ts index 0191cf28cd..c723fe7ba4 100644 --- a/packages/cli/src/workflows/workflows.controller.ts +++ b/packages/cli/src/workflows/workflows.controller.ts @@ -169,8 +169,7 @@ workflowsController.get( // Do a very basic check if it is really a n8n-workflow-json if ( - workflowData === undefined || - workflowData.nodes === undefined || + workflowData?.nodes === undefined || !Array.isArray(workflowData.nodes) || workflowData.connections === undefined || typeof workflowData.connections !== 'object' || diff --git a/packages/cli/src/workflows/workflows.services.ee.ts b/packages/cli/src/workflows/workflows.services.ee.ts index 97b8df7e9c..44ddaa9e1c 100644 --- a/packages/cli/src/workflows/workflows.services.ee.ts +++ b/packages/cli/src/workflows/workflows.services.ee.ts @@ -90,9 +90,8 @@ export class EEWorkflowsService extends WorkflowsService { } static addOwnerId(workflow: WorkflowForList, workflowOwnerRole: Role): void { - const ownerId = workflow.shared?.find( - ({ roleId }) => String(roleId) === workflowOwnerRole.id, - )?.userId; + const ownerId = workflow.shared?.find(({ roleId }) => String(roleId) === workflowOwnerRole.id) + ?.userId; workflow.ownedBy = ownerId ? { id: ownerId } : null; delete workflow.shared; } diff --git a/packages/cli/test/integration/shared/testDb.ts b/packages/cli/test/integration/shared/testDb.ts index 55a042d282..ea2d0d4403 100644 --- a/packages/cli/test/integration/shared/testDb.ts +++ b/packages/cli/test/integration/shared/testDb.ts @@ -577,7 +577,7 @@ export const getBootstrapDBOptions = (type: TestDBType) => name: type, database: type, ...baseOptions(type), - } as const); + }) as const; const getDBOptions = (type: TestDBType, name: string) => ({ type, diff --git a/packages/core/src/BinaryDataManager/index.ts b/packages/core/src/BinaryDataManager/index.ts index 56b9f1550a..46d0f446f8 100644 --- a/packages/core/src/BinaryDataManager/index.ts +++ b/packages/core/src/BinaryDataManager/index.ts @@ -185,7 +185,7 @@ export class BinaryDataManager { } async duplicateBinaryData( - inputData: Array | unknown, + inputData: Array, executionId: string, ): Promise { if (inputData && this.managers[this.binaryDataMode]) { diff --git a/packages/core/src/UserSettings.ts b/packages/core/src/UserSettings.ts index cef8db649b..748c087bbd 100644 --- a/packages/core/src/UserSettings.ts +++ b/packages/core/src/UserSettings.ts @@ -77,7 +77,7 @@ export async function getEncryptionKey(): Promise { const userSettings = await getUserSettings(); - if (userSettings === undefined || userSettings.encryptionKey === undefined) { + if (userSettings?.encryptionKey === undefined) { throw new Error(RESPONSE_ERROR_MESSAGES.NO_ENCRYPTION_KEY); } diff --git a/packages/design-system/.eslintrc.js b/packages/design-system/.eslintrc.js index fbf2795ffe..a14832cc55 100644 --- a/packages/design-system/.eslintrc.js +++ b/packages/design-system/.eslintrc.js @@ -12,13 +12,13 @@ module.exports = { 'n8n-local-rules/dangerously-use-html-string-missing': 'off', // TODO: Remove these - 'import/no-default-export': 'off', + 'import/no-default-export': 'warn', 'import/order': 'off', '@typescript-eslint/no-unsafe-argument': 'warn', '@typescript-eslint/no-unsafe-return': 'warn', '@typescript-eslint/no-unsafe-member-access': 'warn', - '@typescript-eslint/prefer-optional-chain': 'off', - '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/prefer-optional-chain': 'warn', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', }, overrides: [ diff --git a/packages/editor-ui/.eslintrc.js b/packages/editor-ui/.eslintrc.js index 94174db5c4..d35df662f4 100644 --- a/packages/editor-ui/.eslintrc.js +++ b/packages/editor-ui/.eslintrc.js @@ -10,45 +10,45 @@ module.exports = { rules: { // TODO: Remove these - 'id-denylist': 'off', - 'import/extensions': 'off', - 'import/no-default-export': 'off', - 'import/no-extraneous-dependencies': 'off', + 'id-denylist': 'warn', + 'import/extensions': 'warn', + 'import/no-default-export': 'warn', + 'import/no-extraneous-dependencies': 'warn', 'import/order': 'off', 'import/no-cycle': 'warn', - 'import/no-duplicates': 'off', - indent: 'off', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/dot-notation': 'off', - '@typescript-eslint/lines-between-class-members': 'off', - '@typescript-eslint/member-delimiter-style': 'off', - '@typescript-eslint/naming-convention': 'off', - '@typescript-eslint/no-empty-interface': 'off', - '@typescript-eslint/no-for-in-array': 'off', - '@typescript-eslint/no-loop-func': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-shadow': 'off', - '@typescript-eslint/no-this-alias': 'off', - '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off', - '@typescript-eslint/no-unnecessary-type-assertion': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-return': 'off', - '@typescript-eslint/no-unused-expressions': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-nullish-coalescing': 'off', - '@typescript-eslint/prefer-optional-chain': 'off', - '@typescript-eslint/restrict-plus-operands': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/unbound-method': 'off', + 'import/no-duplicates': 'warn', + indent: 'warn', + '@typescript-eslint/ban-types': 'warn', + '@typescript-eslint/dot-notation': 'warn', + '@typescript-eslint/lines-between-class-members': 'warn', + '@typescript-eslint/member-delimiter-style': 'warn', + '@typescript-eslint/naming-convention': 'warn', + '@typescript-eslint/no-empty-interface': 'warn', + '@typescript-eslint/no-for-in-array': 'warn', + '@typescript-eslint/no-loop-func': 'warn', + '@typescript-eslint/no-non-null-assertion': 'warn', + '@typescript-eslint/no-shadow': 'warn', + '@typescript-eslint/no-this-alias': 'warn', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn', + '@typescript-eslint/no-unnecessary-type-assertion': 'warn', + '@typescript-eslint/no-unsafe-argument': 'warn', + '@typescript-eslint/no-unsafe-assignment': 'warn', + '@typescript-eslint/no-unsafe-call': 'warn', + '@typescript-eslint/no-unsafe-member-access': 'warn', + '@typescript-eslint/no-unsafe-return': 'warn', + '@typescript-eslint/no-unused-expressions': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-use-before-define': 'warn', + '@typescript-eslint/no-var-requires': 'warn', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', + '@typescript-eslint/prefer-optional-chain': 'warn', + '@typescript-eslint/restrict-plus-operands': 'warn', + '@typescript-eslint/restrict-template-expressions': 'warn', + '@typescript-eslint/unbound-method': 'warn', '@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }], - '@typescript-eslint/no-redundant-type-constituents': 'off', - '@typescript-eslint/no-base-to-string': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-unsafe-enum-comparison': 'off', + '@typescript-eslint/no-redundant-type-constituents': 'warn', + '@typescript-eslint/no-base-to-string': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unsafe-enum-comparison': 'warn', }, }; diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index cfa12225a0..19031838c2 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -65,7 +65,7 @@ "n8n-workflow": "workspace:*", "normalize-wheel": "^1.0.1", "pinia": "^2.1.6", - "prettier": "*", + "prettier": "^3.0.0", "stream-browserify": "^3.0.0", "timeago.js": "^4.0.2", "uuid": "^8.3.2", diff --git a/packages/nodes-base/.eslintrc.js b/packages/nodes-base/.eslintrc.js index bdb2bee4aa..47760b17a0 100644 --- a/packages/nodes-base/.eslintrc.js +++ b/packages/nodes-base/.eslintrc.js @@ -12,25 +12,31 @@ module.exports = { rules: { // TODO: remove all the following rules - eqeqeq: 'off', - 'id-denylist': 'off', - 'import/extensions': 'off', - 'import/order': 'off', - 'prefer-spread': 'off', - 'import/no-extraneous-dependencies': 'off', + eqeqeq: 'warn', + 'id-denylist': 'warn', + 'import/extensions': 'warn', + 'import/order': 'warn', + 'prefer-spread': 'warn', + 'import/no-extraneous-dependencies': 'warn', '@typescript-eslint/naming-convention': ['error', { selector: 'memberLike', format: null }], - '@typescript-eslint/no-explicit-any': 'off', //812 warnings, better to fix in separate PR - '@typescript-eslint/no-non-null-assertion': 'off', //665 errors, better to fix in separate PR - '@typescript-eslint/no-unsafe-assignment': 'off', //7084 problems, better to fix in separate PR - '@typescript-eslint/no-unsafe-call': 'off', //541 errors, better to fix in separate PR - '@typescript-eslint/no-unsafe-member-access': 'off', //4591 errors, better to fix in separate PR - '@typescript-eslint/no-unsafe-return': 'off', //438 errors, better to fix in separate PR + '@typescript-eslint/no-explicit-any': 'warn', //812 warnings, better to fix in separate PR + '@typescript-eslint/no-non-null-assertion': 'warn', //665 errors, better to fix in separate PR + '@typescript-eslint/no-unsafe-assignment': 'warn', //7084 problems, better to fix in separate PR + '@typescript-eslint/no-unsafe-call': 'warn', //541 errors, better to fix in separate PR + '@typescript-eslint/no-unsafe-member-access': 'warn', //4591 errors, better to fix in separate PR + '@typescript-eslint/no-unsafe-return': 'warn', //438 errors, better to fix in separate PR '@typescript-eslint/no-unused-expressions': ['error', { allowTernary: true }], - '@typescript-eslint/restrict-template-expressions': 'off', //1152 errors, better to fix in separate PR - '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/restrict-template-expressions': 'warn', //1152 errors, better to fix in separate PR + '@typescript-eslint/unbound-method': 'warn', '@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }], - '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', + '@typescript-eslint/no-base-to-string': 'warn', + '@typescript-eslint/no-redundant-type-constituents': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-unsafe-argument': 'warn', + '@typescript-eslint/prefer-optional-chain': 'warn', + '@typescript-eslint/restrict-plus-operands': 'warn', }, overrides: [ diff --git a/packages/nodes-base/nodes/Amqp/AmqpTrigger.node.ts b/packages/nodes-base/nodes/Amqp/AmqpTrigger.node.ts index d69fa908b6..d8c2d9c306 100644 --- a/packages/nodes-base/nodes/Amqp/AmqpTrigger.node.ts +++ b/packages/nodes-base/nodes/Amqp/AmqpTrigger.node.ts @@ -198,9 +198,12 @@ export class AmqpTrigger implements INodeType { this.emit([this.helpers.returnJsonArray([data as any])]); if (!context.receiver?.has_credit()) { - setTimeout(() => { - context.receiver?.add_credit(pullMessagesNumber); - }, (options.sleepTime as number) || 10); + setTimeout( + () => { + context.receiver?.add_credit(pullMessagesNumber); + }, + (options.sleepTime as number) || 10, + ); } }); diff --git a/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts b/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts index 6c09d2a900..2473fc973a 100644 --- a/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts +++ b/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts @@ -572,7 +572,9 @@ export class AwsS3V2 implements INodeType { const servicePath = bucketName.includes('.') ? 's3' : `${bucketName}.s3`; const basePath = bucketName.includes('.') ? `/${bucketName}` : ''; - const destination = `${basePath}/${destinationParts.slice(2, destinationParts.length).join('/')}`; + const destination = `${basePath}/${destinationParts + .slice(2, destinationParts.length) + .join('/')}`; responseData = await awsApiRequestREST.call(this, servicePath, 'GET', basePath, '', { location: '', diff --git a/packages/nodes-base/nodes/EmailReadImap/v1/EmailReadImapV1.node.ts b/packages/nodes-base/nodes/EmailReadImap/v1/EmailReadImapV1.node.ts index 004edde494..be149e125e 100644 --- a/packages/nodes-base/nodes/EmailReadImap/v1/EmailReadImapV1.node.ts +++ b/packages/nodes-base/nodes/EmailReadImap/v1/EmailReadImapV1.node.ts @@ -619,12 +619,15 @@ export class EmailReadImapV1 implements INodeType { let reconnectionInterval: NodeJS.Timeout | undefined; if (options.forceReconnect !== undefined) { - reconnectionInterval = setInterval(async () => { - this.logger.verbose('Forcing reconnection of IMAP node.'); - connection.end(); - connection = await establishConnection(); - await connection.openBox(mailbox); - }, (options.forceReconnect as number) * 1000 * 60); + reconnectionInterval = setInterval( + async () => { + this.logger.verbose('Forcing reconnection of IMAP node.'); + connection.end(); + connection = await establishConnection(); + await connection.openBox(mailbox); + }, + (options.forceReconnect as number) * 1000 * 60, + ); } // When workflow and so node gets set to inactive close the connectoin diff --git a/packages/nodes-base/nodes/EmailReadImap/v2/EmailReadImapV2.node.ts b/packages/nodes-base/nodes/EmailReadImap/v2/EmailReadImapV2.node.ts index 29677d10a7..fc0bed1701 100644 --- a/packages/nodes-base/nodes/EmailReadImap/v2/EmailReadImapV2.node.ts +++ b/packages/nodes-base/nodes/EmailReadImap/v2/EmailReadImapV2.node.ts @@ -628,20 +628,23 @@ export class EmailReadImapV2 implements INodeType { let reconnectionInterval: NodeJS.Timeout | undefined; if (options.forceReconnect !== undefined) { - reconnectionInterval = setInterval(async () => { - this.logger.verbose('Forcing reconnect to IMAP server'); - try { - isCurrentlyReconnecting = true; - if (connection.closeBox) await connection.closeBox(false); - connection.end(); - connection = await establishConnection(); - await connection.openBox(mailbox); - } catch (error) { - this.logger.error(error as string); - } finally { - isCurrentlyReconnecting = false; - } - }, (options.forceReconnect as number) * 1000 * 60); + reconnectionInterval = setInterval( + async () => { + this.logger.verbose('Forcing reconnect to IMAP server'); + try { + isCurrentlyReconnecting = true; + if (connection.closeBox) await connection.closeBox(false); + connection.end(); + connection = await establishConnection(); + await connection.openBox(mailbox); + } catch (error) { + this.logger.error(error as string); + } finally { + isCurrentlyReconnecting = false; + } + }, + (options.forceReconnect as number) * 1000 * 60, + ); } // When workflow and so node gets set to inactive close the connectoin diff --git a/packages/nodes-base/nodes/FileMaker/GenericFunctions.ts b/packages/nodes-base/nodes/FileMaker/GenericFunctions.ts index 2b689ce8f7..f8e8a855f6 100644 --- a/packages/nodes-base/nodes/FileMaker/GenericFunctions.ts +++ b/packages/nodes-base/nodes/FileMaker/GenericFunctions.ts @@ -76,12 +76,11 @@ export async function getToken( return response.response.token; } catch (error) { - let message - if ( error.statusCode === 502 ) { - message = 'The server is not responding. Is the DataAPI enabled?' - } - else if (error.error ) { - message = error.error.messages[0].code + ' - ' + error.error.messages[0].message + let message; + if (error.statusCode === 502) { + message = 'The server is not responding. Is the DataAPI enabled?'; + } else if (error.error) { + message = error.error.messages[0].code + ' - ' + error.error.messages[0].message; } else { message = error.message; } @@ -267,7 +266,7 @@ export async function logout( }; const response = await this.helpers.request(requestOptions); - return response + return response; } export function parseSort(this: IExecuteFunctions, i: number): object | null { diff --git a/packages/nodes-base/nodes/ItemLists/V1/ItemListsV1.node.ts b/packages/nodes-base/nodes/ItemLists/V1/ItemListsV1.node.ts index 762d720d72..1684b71642 100644 --- a/packages/nodes-base/nodes/ItemLists/V1/ItemListsV1.node.ts +++ b/packages/nodes-base/nodes/ItemLists/V1/ItemListsV1.node.ts @@ -1167,7 +1167,7 @@ return 0;`, ({ json: { ...item.json, __INDEX: index }, pairedItem: { item: index }, - } as INodeExecutionData), + }) as INodeExecutionData, ); //sort items using the compare keys newItems.sort((a, b) => { diff --git a/packages/nodes-base/nodes/ItemLists/V2/ItemListsV2.node.ts b/packages/nodes-base/nodes/ItemLists/V2/ItemListsV2.node.ts index d8f36ebcef..d2d952218f 100644 --- a/packages/nodes-base/nodes/ItemLists/V2/ItemListsV2.node.ts +++ b/packages/nodes-base/nodes/ItemLists/V2/ItemListsV2.node.ts @@ -1207,7 +1207,7 @@ return 0;`, ({ json: { ...item.json, __INDEX: index }, pairedItem: { item: index }, - } as INodeExecutionData), + }) as INodeExecutionData, ); //sort items using the compare keys newItems.sort((a, b) => { diff --git a/packages/nodes-base/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.ts b/packages/nodes-base/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.ts index c4f6d708c9..c526ec8425 100644 --- a/packages/nodes-base/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.ts +++ b/packages/nodes-base/nodes/ItemLists/V3/actions/itemList/removeDuplicates.operation.ts @@ -162,7 +162,7 @@ export async function execute( ({ json: { ...item.json, __INDEX: index }, pairedItem: { item: index }, - } as INodeExecutionData), + }) as INodeExecutionData, ); //sort items using the compare keys newItems.sort((a, b) => { diff --git a/packages/nodes-base/nodes/Npm/PackageDescription.ts b/packages/nodes-base/nodes/Npm/PackageDescription.ts index 4f88f96cfd..75ebf7ed75 100644 --- a/packages/nodes-base/nodes/Npm/PackageDescription.ts +++ b/packages/nodes-base/nodes/Npm/PackageDescription.ts @@ -92,7 +92,7 @@ export const packageOperations: INodeProperties[] = [ return items.flatMap(({ json }) => (json.objects as Array<{ package: PackageJson }>).map( ({ package: { name, version, description } }) => - ({ json: { name, version, description } } as INodeExecutionData), + ({ json: { name, version, description } }) as INodeExecutionData, ), ); }, diff --git a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts index 1f9d76c53c..439c9501d4 100644 --- a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts +++ b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts @@ -131,7 +131,6 @@ export class Rundeck implements INodeType { }, default: '', placeholder: 'Add Filters', - required: false, description: 'Filter Rundeck nodes by name', }, diff --git a/packages/nodes-base/nodes/SeaTable/types.ts b/packages/nodes-base/nodes/SeaTable/types.ts index 765be76513..cc8ee249fe 100644 --- a/packages/nodes-base/nodes/SeaTable/types.ts +++ b/packages/nodes-base/nodes/SeaTable/types.ts @@ -56,16 +56,12 @@ export type TEndpointVariableName = 'access_token' | 'dtable_uuid' | 'server'; // Template Literal Types requires-ts-4.1.5 -- deferred export type TMethod = 'GET' | 'POST'; -type TDeferredEndpoint = string; -type TDeferredEndpointExpr = string; type TEndpoint = | '/api/v2.1/dtable/app-access-token/' - | '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/' - | TDeferredEndpoint; -export type TEndpointExpr = TEndpoint | TDeferredEndpointExpr; + | '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/'; +export type TEndpointExpr = TEndpoint; export type TEndpointResolvedExpr = - | TEndpoint - | string; /* deferred: but already in use for header values, e.g. authentication */ + TEndpoint; /* deferred: but already in use for header values, e.g. authentication */ export type TDateTimeFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZ' /* moment.js */; diff --git a/packages/nodes-base/nodes/TheHive/QueryFunctions.ts b/packages/nodes-base/nodes/TheHive/QueryFunctions.ts index 7bb5a4f604..40b74d8865 100644 --- a/packages/nodes-base/nodes/TheHive/QueryFunctions.ts +++ b/packages/nodes-base/nodes/TheHive/QueryFunctions.ts @@ -14,7 +14,6 @@ export declare type queryIndexSignature = | '_id' | '_between' | '_parent' - | '_parent' | '_child' | '_type' | '_string' diff --git a/packages/nodes-base/nodes/Webhook/error.ts b/packages/nodes-base/nodes/Webhook/error.ts index d9397a93e0..35001d67e4 100644 --- a/packages/nodes-base/nodes/Webhook/error.ts +++ b/packages/nodes-base/nodes/Webhook/error.ts @@ -1,5 +1,8 @@ export class WebhookAuthorizationError extends Error { - constructor(readonly responseCode: number, message?: string) { + constructor( + readonly responseCode: number, + message?: string, + ) { if (message === undefined) { message = 'Authorization problem!'; if (responseCode === 401) { diff --git a/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts b/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts index 36f63f62ea..db0f7626cd 100644 --- a/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts +++ b/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts @@ -87,9 +87,7 @@ export function getAutomaticSecret(credentials: ICredentialDataDecryptedObject) return createHash('md5').update(data).digest('hex'); } -export function setMetadata( - data: IShoppingLine[] | IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[], -) { +export function setMetadata(data: IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[]) { for (let i = 0; i < data.length; i++) { //@ts-ignore\ if (data[i].metadataUi?.metadataValues) { @@ -105,7 +103,7 @@ export function setMetadata( } export function toSnakeCase( - data: IShoppingLine[] | IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[] | IDataObject, + data: IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[] | IDataObject, ) { if (!Array.isArray(data)) { data = [data]; diff --git a/packages/workflow/.eslintrc.js b/packages/workflow/.eslintrc.js index ed914e6f96..79997056e7 100644 --- a/packages/workflow/.eslintrc.js +++ b/packages/workflow/.eslintrc.js @@ -9,6 +9,12 @@ module.exports = { ...sharedOptions(__dirname), rules: { - 'import/order': 'off', // TODO: remove this + // TODO: remove these + 'import/order': 'off', + '@typescript-eslint/no-base-to-string': 'warn', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-redundant-type-constituents': 'warn', + '@typescript-eslint/prefer-nullish-coalescing': 'warn', + '@typescript-eslint/prefer-optional-chain': 'warn', }, }; diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index ed2f1f88a7..9c2ec715a4 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -1199,9 +1199,10 @@ export interface INodePropertyValueExtractorRegex extends INodePropertyValueExtr } export interface INodePropertyValueExtractorFunction { - (this: IExecuteSingleFunctions, value: string | NodeParameterValue): - | Promise - | (string | NodeParameterValue); + ( + this: IExecuteSingleFunctions, + value: string | NodeParameterValue, + ): Promise | (string | NodeParameterValue); } export type INodePropertyValueExtractor = INodePropertyValueExtractorRegex; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e06fe46bdd..bb2a32e3fa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,7 +11,6 @@ overrides: '@types/node': ^18.16.16 chokidar: 3.5.2 jsonwebtoken: 9.0.0 - prettier: ^3.0.0 semver: ^7.5.4 tough-cookie: ^4.1.3 tslib: ^2.6.1 @@ -4945,7 +4944,7 @@ packages: less-loader: 11.1.3(less@4.1.3)(webpack@5.75.0) postcss: 8.4.27 postcss-loader: 7.3.3(postcss@8.4.27)(webpack@5.75.0) - prettier: 3.0.0 + prettier: 2.8.8 react: 17.0.2 react-dom: 18.2.0(react@17.0.2) resolve-url-loader: 5.0.0 @@ -5259,7 +5258,7 @@ packages: jscodeshift: 0.14.0(@babel/preset-env@7.22.9) leven: 3.1.0 ora: 5.4.1 - prettier: 3.0.0 + prettier: 2.8.8 prompts: 2.4.2 puppeteer-core: 2.1.1 read-pkg-up: 7.0.1 @@ -5310,7 +5309,7 @@ packages: globby: 11.1.0 jscodeshift: 0.14.0(@babel/preset-env@7.22.9) lodash: 4.17.21 - prettier: 3.0.0 + prettier: 2.8.8 recast: 0.23.3 transitivePeerDependencies: - supports-color @@ -10886,7 +10885,7 @@ packages: indefinite: 2.4.1 pascal-case: 3.1.2 pluralize: 8.0.0 - prettier: 3.0.0 + prettier: 2.8.8 sentence-case: 3.0.4 title-case: 3.0.3 transitivePeerDependencies: @@ -17114,6 +17113,12 @@ packages: fast-diff: 1.2.0 dev: true + /prettier@2.8.8: + resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} + engines: {node: '>=10.13.0'} + hasBin: true + dev: true + /prettier@3.0.0: resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==} engines: {node: '>=14'}