n8n/packages/@n8n/instance-ai/eslint.config.mjs
José Braulio González Valido ee46e64d50
chore(ai-builder): Typecheck the eval harness and pin its external contracts (no-changelog) (#34673)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 08:18:41 +00:00

84 lines
2.4 KiB
JavaScript

import { defineConfig } from 'eslint/config';
import { baseConfig } from '@n8n/eslint-config/base';
const LAZY_RUNTIME_IMPORT_MESSAGE =
'Use an existing lazy loader, or add one near first use. Static runtime imports of this dependency undo the idle-memory guardrail.';
const restrictedLazyRuntimeImports = [
'@daytona/sdk',
'@joplin/turndown-plugin-gfm',
'@mozilla/readability',
'csv-parse/sync',
'linkedom',
'pdf-parse',
'psl',
'turndown',
].map((name) => ({
name,
allowTypeImports: true,
message: LAZY_RUNTIME_IMPORT_MESSAGE,
}));
export default defineConfig(
baseConfig,
{
ignores: [
'scripts/**/*.cjs',
'skills/**/*.mjs',
// Local eval scratch output — never linted, never committed.
'.data/**',
'evaluations/.data/**',
// Deep-imports ai-workflow-builder.ee's evaluations source, so it sits outside
// evaluations/tsconfig.json (see its exclude) and the eslint project service.
'evaluations/cli/pairwise.ts',
],
},
{
rules: {
// Tool names may be kebab-case identifiers (e.g. 'list-workflows'), which
// require quotes in object literals. Skip naming checks for those.
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'objectLiteralProperty',
modifiers: ['requiresQuotes'],
format: null,
},
],
},
},
{
files: ['src/**/*.ts'],
ignores: ['src/**/__tests__/**/*.ts'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{ paths: restrictedLazyRuntimeImports },
],
},
},
{
files: ['src/tools/__tests__/**/*.test.ts'],
rules: {
// Tool execute() returns complex discriminated-union types that resolve
// differently across environments (error-typed in CI). Relax type-safety
// lint rules in test files where we assert on tool behavior, not types.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
},
},
{
files: ['evaluations/computer-use/report-html.ts'],
rules: {
// Large template literal + inline CSS: type-aware `no-unsafe-*` rules
// can false-positive (imports/fields show as `error` in some editors).
// `tsc -p` still typechecks this file (evaluations/** is in tsconfig).
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
},
},
);