// ESLint flat config — enforces the DependencyMap §2 edge set for // `evidence-binder`: it may depend on `citation-engine` and `evidence-anchor`, // and must NOT depend on `evidence-source`, `citation-work`, or the umbrella // `citation-evidence`. import js from "@eslint/js"; import tseslint from "typescript-eslint"; import importPlugin from "eslint-plugin-import"; import globals from "globals"; // Package specifiers and relative-path prefixes that would cross a forbidden // dependency edge. Anchor and engine are the only allowed sibling edges. const FORBIDDEN_EDGES = [ { name: "@citation-evidence/evidence-source", message: "binder must not depend on evidence-source (DependencyMap §2)." }, { name: "@citation-evidence/work", message: "binder must not depend on citation-work (DependencyMap §2)." }, { name: "@citation-evidence/citation-work", message: "binder must not depend on citation-work (DependencyMap §2)." }, ]; const FORBIDDEN_PATTERNS = [ { group: ["../evidence-source/*", "../citation-work/*", "../citation-evidence/*"], message: "binder must not reach into evidence-source, citation-work, or the umbrella (DependencyMap §2)." }, ]; 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.node, ...globals.browser }, }, plugins: { import: importPlugin, }, settings: { "import/resolver": { typescript: { project: "./tsconfig.json" }, }, }, rules: { "no-restricted-imports": [ "error", { paths: FORBIDDEN_EDGES, patterns: FORBIDDEN_PATTERNS, }, ], }, }, );