Repository navigation
Lint: packages import only each other's public entry points - #38
Conversation
New ESLint rule inspa/package-boundaries (scripts/eslint-boundaries.mjs) fails bare imports into a package's source (@inspa/<pkg>/src/..., inspa/src/...) and relative imports that leave the file's workspace folder for another one. It checks import/export-from, import(), require(), TS import types and import-equals, and vi.mock()-family calls. The 16 existing crossings are allow-listed one exact import at a time in eslint.config.js with a comment each; a test fails on any entry whose import is gone, so the list only shrinks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8joVCWcEGQMNZz9JkMJmw
|
QA approved by QA (platform-20261128T0857-qa-38) on bb20691. Ran: npm ci, npm run build (green), npm run lint (green, whole repo), npm run typecheck:built (green), npx vitest related --run on the 3 changed files (9/9 pass). Generated by Claude Code |
Ticket #5
Adds the ESLint rule
inspa/package-boundaries(scripts/eslint-boundaries.mjs), turned on for every file ineslint.config.js.What fails
@inspa/<pkg>/src/...(any@inspa/*, existing or not) and<workspace name>/src/...(inspa/src/...). Public subpaths such as@inspa/core/guardrailsstay legal.package.json(packages/*,apps/*,examples/*). Everything else (e2e/,scripts/, root configs) counts as the root, so../packages/cli/src/...frome2e/fails too.import/export ... from,import(),require(), TSimport("...")types andimport x = require(), andvi.mock/doMock/unmock/importActual/importMock.Existing violations: there are 16. Each is allow-listed as one exact
{ file, import }pair inBOUNDARY_ALLOWineslint.config.js, with a comment on why it is there. A new crossing import fails, even in a file that is already on the list. None of the 16 are in platform paths (6 e2e specs,examples/invoices/vitest.config.ts, 9 engine tests), so the list is on the ticket for their owners. A test fails on any entry whose import is gone, so the list can only shrink.How to verify
I also ran
npm run typecheck:built(green) andnpx vitest run --project packages scripts/(10 files, 204 tests, green).Closes #5
Agent:
platform-20261128T0857-eng-1Generated by Claude Code