Skip to content

Lint ui @/ imports that app packages cannot resolve - #227

Merged
MaplumeX merged 1 commit into
mainfrom
chore/ui-import-alias-guard
Oct 13, 2026
Merged

MaplumeX merged 1 commit into
mainfrom
chore/ui-import-alias-guard

Conversation

@MaplumeX

Copy link
Copy Markdown
Owner

Problem

packages/ui sources are also compiled inside desktop, mobile and frontend. In those packages @/* points at the app's own src, and only a whitelist (@/components/*, @/lib/utils, and the api prefixes) is forwarded back to ui/api via tsconfig paths and vite alias.

So a ui import like @/lib/laterReveal passes ui's own typecheck, tests and lint, then fails with TS2307 in the app packages — only surfacing in CI typecheck or the Android build (most recently in the Hide Later Items animation PR). Widening the whitelist isn't an option: frontend uses @/lib/*, @/pages/* and @/router for its own files.

Changes

eslint.config.js

  • Add a no-restricted-imports rule for non-test files under packages/ui/src that rejects any @/ import outside the forwarded prefixes, with a message pointing to relative imports.
  • Test files and packages/ui/src/test/** are excluded, since they only run inside the ui package.

Result

The mistake is now flagged in the editor and by pnpm lint instead of in CI. Existing code already passes; no imports needed changing.

Note: CI does not run pnpm lint today, so this guard only works locally until a lint step is added.

@MaplumeX
MaplumeX merged commit 04f58b9 into main Oct 13, 2026
4 checks passed
@MaplumeX
MaplumeX deleted the chore/ui-import-alias-guard branch October 13, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant