// ESLint flat config (ESLint 9+). // Enforces the partition dependency map in wiki/DependencyMap.md ยง4. // // Element types (folders) and allowed importers: // shared : importable by every other element (no internal imports of its own). // engine : imports shared. // anchor : imports shared, engine. // source : imports shared, engine. // binder : imports shared, engine, anchor. // work : imports shared, engine, anchor, source. (NOT binder.) // app : imports anything. // // Path aliases (@shared/*, @engine/*, etc.) come from tsconfig.json paths and // are resolved by eslint-import-resolver-typescript. import js from "@eslint/js"; import tseslint from "typescript-eslint"; import boundaries from "eslint-plugin-boundaries"; import importPlugin from "eslint-plugin-import"; import globals from "globals"; export default tseslint.config( { ignores: ["dist/", "node_modules/", "coverage/", "**/*.d.ts"], }, js.configs.recommended, ...tseslint.configs.recommended, { files: ["src/**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2022, sourceType: "module", globals: { ...globals.browser, ...globals.node }, }, plugins: { boundaries, import: importPlugin, }, settings: { "import/resolver": { typescript: { project: "./tsconfig.json" }, }, "boundaries/elements": [ { type: "shared", pattern: "src/shared/**" }, { type: "engine", pattern: "src/engine/**" }, { type: "anchor", pattern: "src/anchor/**" }, { type: "source", pattern: "src/source/**" }, { type: "binder", pattern: "src/binder/**" }, { type: "work", pattern: "src/work/**" }, { type: "app", pattern: "src/app/**" }, ], }, rules: { "boundaries/element-types": [ 2, { default: "disallow", rules: [ { from: "shared", allow: [] }, { from: "engine", allow: ["shared"] }, { from: "anchor", allow: ["shared", "engine"] }, { from: "source", allow: ["shared", "engine"] }, { from: "binder", allow: ["shared", "engine", "anchor"] }, { from: "work", allow: ["shared", "engine", "anchor", "source"] }, { from: "app", allow: ["shared", "engine", "anchor", "source", "binder", "work"] }, ], }, ], }, }, );