mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
build: Update ESLint to v9 (#16639)
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
const sharedOptions = require('@n8n/eslint-config/shared');
|
||||
|
||||
/**
|
||||
* @type {import('@types/eslint').ESLint.ConfigData}
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['@n8n/eslint-config/node'],
|
||||
|
||||
...sharedOptions(__dirname),
|
||||
|
||||
parserOptions: {
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
|
||||
ignorePatterns: ['jest.config.js'],
|
||||
|
||||
rules: {
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
|
||||
'n8n-local-rules/no-dynamic-import-template': 'error',
|
||||
'n8n-local-rules/misplaced-n8n-typeorm-import': 'error',
|
||||
'n8n-local-rules/no-type-unsafe-event-emitter': 'error',
|
||||
complexity: 'error',
|
||||
|
||||
// TODO: Remove this
|
||||
'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',
|
||||
},
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
'./src/databases/**/*.ts',
|
||||
'./src/modules/**/*.ts',
|
||||
'./test/**/*.ts',
|
||||
'./src/**/__tests__/**/*.ts',
|
||||
],
|
||||
rules: {
|
||||
'n8n-local-rules/misplaced-n8n-typeorm-import': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./test/**/*.ts', './src/**/__tests__/**/*.ts'],
|
||||
rules: {
|
||||
'n8n-local-rules/no-type-unsafe-event-emitter': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./src/decorators/**/*.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-types': [
|
||||
'warn',
|
||||
{
|
||||
types: {
|
||||
Function: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./test/**/*.ts', './src/**/__tests__/**/*.ts'],
|
||||
rules: {
|
||||
'n8n-local-rules/no-dynamic-import-template': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
102
packages/cli/eslint.config.mjs
Normal file
102
packages/cli/eslint.config.mjs
Normal file
@@ -0,0 +1,102 @@
|
||||
import { defineConfig, globalIgnores } from 'eslint/config';
|
||||
import { nodeConfig } from '@n8n/eslint-config/node';
|
||||
|
||||
export default defineConfig(
|
||||
globalIgnores(['scripts/**/*.mjs']),
|
||||
nodeConfig,
|
||||
{
|
||||
rules: {
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
|
||||
'n8n-local-rules/no-dynamic-import-template': 'error',
|
||||
'n8n-local-rules/misplaced-n8n-typeorm-import': 'error',
|
||||
'n8n-local-rules/no-type-unsafe-event-emitter': 'error',
|
||||
|
||||
// TODO: Remove this
|
||||
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
|
||||
'import-x/no-cycle': 'warn',
|
||||
'import-x/extensions': 'warn',
|
||||
'import-x/order': 'warn',
|
||||
'no-ex-assign': 'warn',
|
||||
'no-case-declarations': 'warn',
|
||||
'no-fallthrough': 'warn',
|
||||
'no-unsafe-optional-chaining': 'warn',
|
||||
'no-empty': 'warn',
|
||||
'no-async-promise-executor': 'warn',
|
||||
complexity: 'warn',
|
||||
'@typescript-eslint/require-await': 'warn',
|
||||
'@typescript-eslint/no-empty-object-type': 'warn',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
||||
'@typescript-eslint/naming-convention': 'warn',
|
||||
'@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/no-restricted-types': 'warn',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
|
||||
'@typescript-eslint/only-throw-error': 'warn',
|
||||
'@typescript-eslint/no-require-imports': 'warn',
|
||||
'@typescript-eslint/no-unsafe-call': 'warn',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
||||
'@typescript-eslint/array-type': 'warn',
|
||||
'@typescript-eslint/unbound-method': 'warn',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
||||
'no-useless-escape': 'warn',
|
||||
'@typescript-eslint/prefer-optional-chain': 'warn',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./src/databases/migrations/**/*.ts'],
|
||||
rules: {
|
||||
'unicorn/filename-case': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'./src/databases/**/*.ts',
|
||||
'./src/modules/**/*.ts',
|
||||
'./test/**/*.ts',
|
||||
'./src/**/__tests__/**/*.ts',
|
||||
],
|
||||
rules: {
|
||||
'n8n-local-rules/misplaced-n8n-typeorm-import': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./test/**/*.ts', './src/**/__tests__/**/*.ts'],
|
||||
rules: {
|
||||
'n8n-local-rules/no-type-unsafe-event-emitter': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./src/decorators/**/*.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-restricted-types': [
|
||||
'warn',
|
||||
{
|
||||
types: {
|
||||
Function: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['./test/**/*.ts', './src/**/__tests__/**/*.ts'],
|
||||
rules: {
|
||||
'id-denylist': 'warn',
|
||||
'prefer-const': 'warn',
|
||||
'n8n-local-rules/no-dynamic-import-template': 'off',
|
||||
'import-x/no-duplicates': 'warn',
|
||||
'import-x/no-default-export': 'warn',
|
||||
'@typescript-eslint/no-unsafe-return': 'warn',
|
||||
'@typescript-eslint/no-unsafe-argument': 'warn',
|
||||
'@typescript-eslint/no-unused-expressions': 'warn',
|
||||
'@typescript-eslint/restrict-template-expressions': 'warn',
|
||||
'n8n-local-rules/no-uncaught-json-parse': 'warn',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -109,7 +109,7 @@ export class Execute extends BaseCommand {
|
||||
this.logger.info(JSON.stringify(data, null, 2));
|
||||
|
||||
const { error } = data.data.resultData;
|
||||
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
||||
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
||||
throw {
|
||||
...error,
|
||||
stack: error.stack,
|
||||
|
||||
@@ -111,7 +111,7 @@ setGlobalState({
|
||||
defaultTimezone: globalConfig.generic.timezone,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
// eslint-disable-next-line import-x/no-default-export
|
||||
export default config;
|
||||
|
||||
export type Config = typeof config;
|
||||
|
||||
@@ -38,7 +38,7 @@ import { userHasScopes } from '@/permissions.ee/check-access';
|
||||
import type { CredentialRequest, ListQuery } from '@/requests';
|
||||
import { CredentialsTester } from '@/services/credentials-tester.service';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { ProjectService } from '@/services/project.service.ee';
|
||||
import { RoleService } from '@/services/role.service';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { IRun, IWorkflowBase, WorkflowExecuteMode } from 'n8n-workflow';
|
||||
import type { IWorkflowErrorData } from '@/interfaces';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
import { UrlService } from '@/services/url.service';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { WorkflowExecutionService } from '@/workflows/workflow-execution.service';
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ import { WorkflowStatisticsService } from '@/services/workflow-statistics.servic
|
||||
import { isWorkflowIdValid } from '@/utils';
|
||||
import { WorkflowStaticDataService } from '@/workflows/workflow-static-data.service';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { executeErrorWorkflow } from './execute-error-workflow';
|
||||
import { restoreBinaryDataId } from './restore-binary-data-id';
|
||||
import { saveExecutionProgress } from './save-execution-progress';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Container } from '@n8n/di';
|
||||
import { Help } from '@oclif/core';
|
||||
|
||||
// oclif expects a default export
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
// eslint-disable-next-line import-x/no-default-export
|
||||
export default class CustomHelp extends Help {
|
||||
async showRootHelp() {
|
||||
Container.get(Logger).info(
|
||||
|
||||
@@ -516,7 +516,7 @@ export class LoadNodesAndCredentials {
|
||||
|
||||
async setupHotReload() {
|
||||
const { default: debounce } = await import('lodash/debounce');
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line import-x/no-extraneous-dependencies
|
||||
const { watch } = await import('chokidar');
|
||||
|
||||
const { Push } = await import('@/push');
|
||||
|
||||
@@ -61,7 +61,7 @@ function builder(
|
||||
await redisCache.expire(key, ttlSeconds);
|
||||
},
|
||||
async set(key, value, ttl) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-throw-literal, @typescript-eslint/restrict-template-expressions
|
||||
// eslint-disable-next-line @typescript-eslint/only-throw-error, @typescript-eslint/restrict-template-expressions
|
||||
if (!isCacheable(value)) throw new NoCacheableError(`"${value}" is not a cacheable value`);
|
||||
const t = ttl ?? options?.ttl;
|
||||
if (t !== undefined && t !== 0) await redisCache.set(key, getVal(value), 'PX', t);
|
||||
@@ -73,7 +73,7 @@ function builder(
|
||||
const multi = redisCache.multi();
|
||||
for (const [key, value] of args) {
|
||||
if (!isCacheable(value))
|
||||
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
||||
// eslint-disable-next-line @typescript-eslint/only-throw-error
|
||||
throw new NoCacheableError(`"${getVal(value)}" is not a cacheable value`);
|
||||
multi.set(key, getVal(value), 'PX', t);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ function builder(
|
||||
for (const field in fieldValueRecord) {
|
||||
const value = fieldValueRecord[field];
|
||||
if (!isCacheable(fieldValueRecord[field])) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-throw-literal, @typescript-eslint/restrict-template-expressions
|
||||
// eslint-disable-next-line @typescript-eslint/only-throw-error, @typescript-eslint/restrict-template-expressions
|
||||
throw new NoCacheableError(`"${value}" is not a cacheable value`);
|
||||
}
|
||||
fieldValueRecord[field] = getVal(value);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { UserError, PROJECT_ROOT } from 'n8n-workflow';
|
||||
|
||||
import { FolderNotFoundError } from '@/errors/folder-not-found.error';
|
||||
import type { ListQuery } from '@/requests';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { WorkflowService } from '@/workflows/workflow.service';
|
||||
|
||||
export interface SimpleFolderNode {
|
||||
|
||||
@@ -71,14 +71,14 @@ export class ProjectService {
|
||||
) {}
|
||||
|
||||
private get workflowService() {
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
return import('@/workflows/workflow.service').then(({ WorkflowService }) =>
|
||||
Container.get(WorkflowService),
|
||||
);
|
||||
}
|
||||
|
||||
private get credentialsService() {
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
return import('@/credentials/credentials.service').then(({ CredentialsService }) =>
|
||||
Container.get(CredentialsService),
|
||||
);
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
* Display an intersection type without implementation details.
|
||||
* @doc https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
export type Resolve<T> = T extends Function ? T : { [K in keyof T]: T[K] };
|
||||
|
||||
@@ -36,7 +36,7 @@ import { ActiveExecutions } from '@/active-executions';
|
||||
import { CredentialsHelper } from '@/credentials-helper';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import type { AiEventMap, AiEventPayload } from '@/events/maps/ai.event-map';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { getLifecycleHooksForSubExecutions } from '@/execution-lifecycle/execution-lifecycle-hooks';
|
||||
import { ExecutionDataService } from '@/executions/execution-data.service';
|
||||
import {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ActiveExecutions } from '@/active-executions';
|
||||
import config from '@/config';
|
||||
import { ExecutionNotFoundError } from '@/errors/execution-not-found-error';
|
||||
import { MaxStalledCountError } from '@/errors/max-stalled-count.error';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import {
|
||||
getLifecycleHooksForRegularMain,
|
||||
getLifecycleHooksForScalingWorker,
|
||||
|
||||
@@ -33,7 +33,7 @@ import { validateEntity } from '@/generic-helpers';
|
||||
import type { ListQuery } from '@/requests';
|
||||
import { hasSharing } from '@/requests';
|
||||
import { OwnershipService } from '@/services/ownership.service';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
// eslint-disable-next-line import-x/no-cycle
|
||||
import { ProjectService } from '@/services/project.service.ee';
|
||||
import { RoleService } from '@/services/role.service';
|
||||
import { TagService } from '@/services/tag.service';
|
||||
|
||||
Reference in New Issue
Block a user