Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8784 chore(core): enforce the core package boundary with ESLint (#10134)
Jiayuan Zhangb4b9ab92bf11
diff --git a/AGENTS.md b/AGENTS.mdindex c0df9bdf79..97070f8456 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -13,7 +13,7 @@ Multica is a task management platform where people and agents collaborate on iss| Location | Responsibility and constraints || --- | --- || `server/` | Go backend; Chi, sqlc, WebSocket |-| `packages/core/` | Headless logic, API client, Query hooks, shared Zustand stores. No UI libraries, `react-dom`, `localStorage`, or `process.env`; use `StorageAdapter` for persistence. |+| `packages/core/` | Headless logic, API client, Query hooks, shared Zustand stores. No UI libraries, `react-dom`, `localStorage`, or `process.env`; use `StorageAdapter` for persistence. Lint enforces this outside tests (`packages/core/eslint.config.mjs`). || `packages/ui/` | UI primitives and shared styles. No business logic or `@multica/core` imports. || `packages/views/` | Shared web/desktop pages and business components. No store definitions, `next/*`, or `react-router-dom`; use `NavigationAdapter`, `useNavigation()`, and `<AppLink>`. || `apps/web/` | Next.js routes/layouts and web-only UI. Framework APIs stay here; shared navigation adapters live in `apps/web/platform/`. |diff --git a/packages/core/eslint.config.mjs b/packages/core/eslint.config.mjsindex 50da62496d..35e9aac76f 100644--- a/packages/core/eslint.config.mjs+++ b/packages/core/eslint.config.mjs@@ -1,3 +1,103 @@import reactConfig from "@multica/eslint-config/react";+import { ICON_LIBRARY_IMPORT_PATTERNS } from "@multica/eslint-config/base";-export default [...reactConfig];+// Package boundary (AGENTS.md): core is headless and runs unchanged in web,+// desktop and SSR. No UI libraries, no react-dom, no next/*, no Web Storage+// globals and no process.env outside tests — tests may stub env and storage.++const UI_LIBRARIES = [+ "react-dom",+ "@multica/ui",+ "@multica/views",+ "@base-ui/react",+ "@radix-ui",+ "sonner",+ "cmdk",+ "recharts",+ "next-themes",+];+const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+const UI_LIBRARY_IMPORT_PATTERN = {+ regex: `^(${UI_LIBRARIES.map(escape).join("|")})(/.*)?$`,+ message:+ "packages/core is headless: no react-dom or UI libraries. Render in packages/ui or packages/views and pass UI into core through props or the platform layer.",+};+const NEXT_IMPORT_PATTERN = {+ regex: "^next(/.*)?$",+ message:+ "packages/core is shared by web and desktop: keep next/* in apps/web and have the app layer pass the value in.",+};++const PROCESS_ENV = {+ object: "process",+ property: "env",+ message:+ "packages/core must not read process.env. Have the app layer pass the value in (CoreProvider props or a function argument).",+};++const WEB_STORAGE = [+ {+ name: "localStorage",+ message:+ "Persist through the StorageAdapter (platform/storage.ts or the adapter injected via CoreProvider), not localStorage directly.",+ },+ {+ name: "sessionStorage",+ message:+ "packages/core must not touch sessionStorage directly. Persist through the StorageAdapter, or have the app layer pass the value in.",+ },+];++// `allowedStorage` lifts the Web Storage ban for the files that legitimately+// own it; every other restriction stays on.+const boundaryRules = (allowedStorage = []) => {+ const storage = WEB_STORAGE.filter((s) => !allowedStorage.includes(s.name));+ return {+ "no-restricted-globals": ["error", ...storage],+ "no-restricted-properties": [+ "error",+ PROCESS_ENV,+ ...storage.flatMap(({ name, message }) =>+ ["window", "globalThis", "self"].map((object) => ({+ object,+ property: name,+ message,+ })),+ ),+ ],+ };+};++const TESTS = ["**/*.test.{ts,tsx}", "**/test/**", "**/vitest.config.*"];++export default [+ ...reactConfig,+ {+ files: ["**/*.{ts,tsx}"],+ ignores: TESTS,+ rules: {+ ...boundaryRules(),+ "no-restricted-imports": [+ "error",+ {+ patterns: [+ ...ICON_LIBRARY_IMPORT_PATTERNS,+ UI_LIBRARY_IMPORT_PATTERN,+ NEXT_IMPORT_PATTERN,+ ],+ },+ ],+ },+ },+ // The sanctioned `defaultStorage` adapter.+ {+ files: ["platform/storage.ts"],+ rules: boundaryRules(["localStorage"]),+ },+ // Exception dedupe is scoped to the browser tab session, which the+ // StorageAdapter cannot express.+ {+ files: ["analytics/exception-dedupe.ts"],+ rules: boundaryRules(["sessionStorage"]),+ },+];