build: Update ESLint to v9 (#16639)

This commit is contained in:
Elias Meire
2025-06-27 10:42:47 +02:00
committed by GitHub
parent a99ccfffe1
commit 0775fd859e
176 changed files with 5417 additions and 4111 deletions

View File

@@ -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'],
},
};

View 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 }],
},
},
);

View File

@@ -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"

View File

@@ -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);

View File

@@ -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 = {