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,26 +0,0 @@
|
||||
const sharedOptions = require('@n8n/eslint-config/shared');
|
||||
|
||||
/**
|
||||
* @type {import('@types/eslint').ESLint.ConfigData}
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['@n8n/eslint-config/base'],
|
||||
|
||||
...sharedOptions(__dirname),
|
||||
|
||||
rules: {
|
||||
complexity: 'error',
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
|
||||
// TODO: remove these
|
||||
'@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',
|
||||
/**
|
||||
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/return-await.md
|
||||
*/
|
||||
'@typescript-eslint/return-await': ['error', 'always'],
|
||||
},
|
||||
};
|
||||
45
packages/workflow/eslint.config.mjs
Normal file
45
packages/workflow/eslint.config.mjs
Normal file
@@ -0,0 +1,45 @@
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import { baseConfig } from '@n8n/eslint-config/base';
|
||||
|
||||
export default defineConfig(
|
||||
baseConfig,
|
||||
{
|
||||
rules: {
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
complexity: ['error', 23],
|
||||
|
||||
// TODO: remove these
|
||||
'no-empty': 'warn',
|
||||
'id-denylist': 'warn',
|
||||
'no-fallthrough': 'warn',
|
||||
'no-useless-escape': 'warn',
|
||||
'import-x/order': 'warn',
|
||||
'no-extra-boolean-cast': 'warn',
|
||||
'no-case-declarations': 'warn',
|
||||
'no-prototype-builtins': 'warn',
|
||||
'@typescript-eslint/naming-convention': 'warn',
|
||||
'@typescript-eslint/no-base-to-string': 'warn',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
||||
'@typescript-eslint/prefer-optional-chain': 'warn',
|
||||
'@typescript-eslint/return-await': ['error', 'always'],
|
||||
'@typescript-eslint/no-empty-object-type': 'warn',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
|
||||
'@typescript-eslint/no-unsafe-call': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.test.ts'],
|
||||
rules: {
|
||||
// TODO: remove these
|
||||
'prefer-const': 'warn',
|
||||
'@typescript-eslint/no-unused-expressions': 'warn',
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
||||
'@typescript-eslint/no-unsafe-return': 'warn',
|
||||
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -20,8 +20,8 @@
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"format": "biome format --write .",
|
||||
"format:check": "biome ci .",
|
||||
"lint": "eslint . --quiet",
|
||||
"lintfix": "eslint . --fix",
|
||||
"lint": "eslint src --quiet",
|
||||
"lintfix": "eslint src --fix",
|
||||
"watch": "tsc -p tsconfig.build.json --watch",
|
||||
"test": "jest",
|
||||
"test:dev": "jest --watch"
|
||||
|
||||
@@ -38,7 +38,7 @@ export const EXTENSION_OBJECTS: ExtensionMap[] = [
|
||||
booleanExtensions,
|
||||
];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
const genericExtensions: Record<string, Function> = {
|
||||
isEmpty,
|
||||
isNotEmpty,
|
||||
@@ -450,12 +450,12 @@ function isDate(input: unknown): boolean {
|
||||
|
||||
interface FoundFunction {
|
||||
type: 'native' | 'extended';
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
function: Function;
|
||||
}
|
||||
|
||||
function findExtendedFunction(input: unknown, functionName: string): FoundFunction | undefined {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
let foundFunction: Function | undefined;
|
||||
if (Array.isArray(input)) {
|
||||
foundFunction = arrayExtensions.functions[functionName];
|
||||
@@ -545,7 +545,7 @@ export function extend(input: unknown, functionName: string, args: unknown[]) {
|
||||
export function extendOptional(
|
||||
input: unknown,
|
||||
functionName: string,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
): Function | undefined {
|
||||
const foundFunction = findExtendedFunction(input, functionName);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ export interface ExtensionMap {
|
||||
functions: Record<string, Extension>;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
||||
export type Extension = Function & { doc?: DocMetadata };
|
||||
|
||||
export type NativeDoc = {
|
||||
|
||||
Reference in New Issue
Block a user