Centralize ESLint into a single root config

Replace the duplicated per-workspace eslint.config.mjs files in
apps/console, apps/trust, packages/ui, and packages/eslint-config with
one root eslint.config.mjs that reuses the shared @probo/eslint-config
rule sets and scopes them per directory. Linting now runs from the repo
root, so pin the type-checked project service root and broaden the
import-x resolver to every workspace tsconfig (the #/* aliases live in
each app's tsconfig.app.json).

Drop the now-redundant per-package lint scripts and lint-only devDeps,
and add a root lint script that runs eslint over the four dirs with
multithreading restored via --concurrency auto, then lints n8n-node
through a direct workspace call. packages/n8n-node keeps its own
external preset.

Collapse the redundant lint-js -> npm-lint Makefile chain into a single
lint-js target and update the make docs accordingly.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-19 16:36:09 +02:00
parent 652be7a984
commit 4d28dab2f4
14 changed files with 339 additions and 927 deletions

66
eslint.config.mjs Normal file
View File

@@ -0,0 +1,66 @@
import { configs } from "@probo/eslint-config";
import { defineConfig, globalIgnores } from "eslint/config";
// Workspaces that are linted by this root config. Each gets the shared rule
// sets below; everything else is ignored so a bare `eslint .` keeps the same
// scope as the previous per-workspace configs.
const appDirs = ["apps/console/**", "apps/trust/**"];
const reactDirs = [...appDirs, "packages/ui/**"];
const lintedDirs = [...reactDirs, "packages/eslint-config/**"];
export default defineConfig([
// Keep `configs.base` global so its `globalIgnores` (dist, __generated__,
// *.d.ts, ...) stay global rather than being scoped by a wrapping `files`.
configs.base,
globalIgnores([
"examples/**",
"packages/coredata/**",
"packages/cookie-banner/**",
"packages/emails/**",
"packages/eslint-relay-plugin-types/**",
"packages/helpers/**",
"packages/hooks/**",
"packages/i18n/**",
"packages/n8n-node/**",
"packages/prosemirror/**",
"packages/react-lazy/**",
"packages/relay/**",
"packages/routes/**",
"packages/tsconfig/**",
]),
{
files: lintedDirs,
extends: [configs.ts, configs.imports, configs.stylistic],
// Linting runs from the repo root, so pin the project service root and let
// it resolve each file to its nearest package tsconfig.json.
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: reactDirs,
extends: [configs.react],
},
{
files: appDirs,
extends: [configs.relay],
},
{
files: reactDirs,
ignores: ["packages/ui/tailwind.config.js"],
extends: [configs.languageOptions.browser],
},
{
files: ["packages/eslint-config/**"],
extends: [configs.languageOptions.node],
},
{
files: ["packages/ui/tailwind.config.js"],
extends: [configs.languageOptions.node],
languageOptions: {
sourceType: "commonjs",
},
},
]);