generated from coulomb/repo-seed
Add link: dependency on citation-engine, retarget @shared/@engine aliases, remove in-repo shared/engine copies. ADR-0002 accepted (option B). 172 tests, typecheck, and lint pass.
76 lines
2.6 KiB
JavaScript
76 lines
2.6 KiB
JavaScript
// ESLint flat config (ESLint 9+).
|
|
// Enforces the partition dependency map in wiki/DependencyMap.md §4.
|
|
//
|
|
// shared/ and engine/ live in the linked @citation-evidence/engine package;
|
|
// boundary rules for those partitions are enforced in citation-engine.
|
|
//
|
|
// Element types (folders) and allowed importers:
|
|
// shared : importable by every other element (package: citation-engine).
|
|
// engine : imports shared (package: citation-engine).
|
|
// anchor : imports shared, engine.
|
|
// source : imports shared, engine.
|
|
// binder : imports shared, engine, anchor.
|
|
// work : imports shared, engine, anchor, source. (NOT binder.)
|
|
// app : imports anything.
|
|
|
|
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";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, resolve } from "node:path";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const engineSrc = resolve(__dirname, "../citation-engine/src");
|
|
|
|
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: `${engineSrc}/shared/**` },
|
|
{ type: "engine", pattern: `${engineSrc}/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"] },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
); |