diff --git a/packages/@n8n_io/eslint-config/base.js b/packages/@n8n_io/eslint-config/base.js index db7803a40c..6c89ea6e52 100644 --- a/packages/@n8n_io/eslint-config/base.js +++ b/packages/@n8n_io/eslint-config/base.js @@ -36,6 +36,9 @@ const config = (module.exports = { */ 'eslint-plugin-n8n-local-rules', + /** https://github.com/sweepline/eslint-plugin-unused-imports */ + 'unused-imports', + /** https://github.com/sindresorhus/eslint-plugin-unicorn */ 'eslint-plugin-unicorn', ], @@ -426,6 +429,15 @@ const config = (module.exports = { */ 'import/prefer-default-export': 'off', + // ---------------------------------- + // no-unused-imports + // ---------------------------------- + + /** + * https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md + */ + 'unused-imports/no-unused-imports': process.env.NODE_ENV === 'development' ? 'warn' : 'error', + /** https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unnecessary-await.md */ 'unicorn/no-unnecessary-await': 'error', diff --git a/packages/@n8n_io/eslint-config/package.json b/packages/@n8n_io/eslint-config/package.json index 65c1b7c745..34e0abc03a 100644 --- a/packages/@n8n_io/eslint-config/package.json +++ b/packages/@n8n_io/eslint-config/package.json @@ -16,6 +16,7 @@ "eslint-plugin-n8n-local-rules": "~1.0", "eslint-plugin-prettier": "~4.2", "eslint-plugin-unicorn": "~46.0", + "eslint-plugin-unused-imports": "~2.0", "eslint-plugin-vue": "~7.17" }, "scripts": { diff --git a/packages/cli/src/UserManagement/UserManagementHelper.ts b/packages/cli/src/UserManagement/UserManagementHelper.ts index 88927f4c73..e299544840 100644 --- a/packages/cli/src/UserManagement/UserManagementHelper.ts +++ b/packages/cli/src/UserManagement/UserManagementHelper.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { In } from 'typeorm'; -import type express from 'express'; import { compare, genSaltSync, hash } from 'bcryptjs'; import { Container } from 'typedi'; @@ -12,7 +11,6 @@ import type { User } from '@db/entities/User'; import { MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH } from '@db/entities/User'; import type { Role } from '@db/entities/Role'; import { RoleRepository } from '@db/repositories'; -import type { AuthenticatedRequest } from '@/requests'; import config from '@/config'; import { getWebhookBaseUrl } from '@/WebhookHelpers'; import { License } from '@/License'; diff --git a/packages/cli/src/WorkflowRunner.ts b/packages/cli/src/WorkflowRunner.ts index 8e42685023..c785a2fa22 100644 --- a/packages/cli/src/WorkflowRunner.ts +++ b/packages/cli/src/WorkflowRunner.ts @@ -21,7 +21,6 @@ import type { IRun, WorkflowExecuteMode, WorkflowHooks, - WorkflowSettings, } from 'n8n-workflow'; import { ErrorReporterProxy as ErrorReporter, diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index d058b37f7e..0b0a578fe2 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -28,7 +28,6 @@ import type { INodeActionTypeDescription, IDisplayOptions, IExecutionsSummary, - IAbstractEventMessage, FeatureFlags, ExecutionStatus, ITelemetryTrackProperties, diff --git a/packages/editor-ui/src/__tests__/server/factories/credentialType.ts b/packages/editor-ui/src/__tests__/server/factories/credentialType.ts index 517e4e7207..7fdd221cf8 100644 --- a/packages/editor-ui/src/__tests__/server/factories/credentialType.ts +++ b/packages/editor-ui/src/__tests__/server/factories/credentialType.ts @@ -1,5 +1,4 @@ import { Factory } from 'miragejs'; -import { faker } from '@faker-js/faker'; import type { ICredentialType } from 'n8n-workflow'; const credentialTypes = [ diff --git a/packages/editor-ui/src/api/workflow-webhooks.ts b/packages/editor-ui/src/api/workflow-webhooks.ts index a6f4e92a67..601073a7b0 100644 --- a/packages/editor-ui/src/api/workflow-webhooks.ts +++ b/packages/editor-ui/src/api/workflow-webhooks.ts @@ -1,5 +1,4 @@ import type { IOnboardingCallPrompt, IUser } from '@/Interface'; -import { IOnboardingCallPromptResponse } from '@/Interface'; import { get, post } from '@/utils'; const N8N_API_BASE_URL = 'https://api.n8n.io/api'; diff --git a/packages/editor-ui/src/api/workflows.ts b/packages/editor-ui/src/api/workflows.ts index 508ed74e4a..7b2d1133cb 100644 --- a/packages/editor-ui/src/api/workflows.ts +++ b/packages/editor-ui/src/api/workflows.ts @@ -1,6 +1,5 @@ import type { IExecutionsCurrentSummaryExtended, IRestApiContext } from '@/Interface'; import type { ExecutionFilters, ExecutionOptions, IDataObject } from 'n8n-workflow'; -import { ExecutionStatus, WorkflowExecuteMode } from 'n8n-workflow'; import { makeRestApiRequest } from '@/utils'; export async function getNewWorkflow(context: IRestApiContext, name?: string) { diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index b798e5d9fb..287409312b 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -26,7 +26,6 @@ import { workflowHelpers } from '@/mixins/workflowHelpers'; import mixins from 'vue-typed-mixins'; import type { INodeUi } from '@/Interface'; -import { IExecutionResponse } from '@/Interface'; import type { IBinaryKeyData, IDataObject, diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index f7b6f81609..f26b98036b 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -111,7 +111,7 @@