Uh oh!
There was an error while loading. Please reload this page.
PR-UI-DEAD-EXPORT-SWEEP-0: delete 26 unused ui.tsx exports + lock-contract - #325
Conversation
…tract
Net: -222 lines from ui.tsx (797 → 590), +112 lines for the new
dead-export contract.
Background: `packages/ui/src/ui.tsx` accumulated ~30 named exports that
no source file outside ui.tsx itself imported. Most were Base UI primitive
re-exports (`DialogTrigger = BaseDialog.Trigger`) or shadcn-style wrappers
that components.tsx + every renderer/primitive consumer ignored. They
cost autocomplete noise, bundle weight, tsc work, and design-discussion
clarity ("we have a Card variant" — except nothing uses it).
Deleted (no external consumer, no internal use):
- Card family: Card, CardHeader, CardTitle, CardDescription, CardContent
- Avatar family: Avatar, AvatarImage, AvatarFallback
- Accordion (entire section): all 5 — `packages/ui/src/primitives/accordion.tsx`
already owns the alive duplicates exported as `PrimitiveAccordion*`
- ScrollArea (entire section): ScrollAreaRoot, ScrollAreaViewport,
ScrollAreaScrollbar — `primitives/scroll-area.tsx` owns the alive impl
- Popover (entire section): PopoverRoot/Trigger/Portal/Backdrop/Positioner/Popup
- Dialog sub-pieces: DialogTrigger, DialogTitle, DialogDescription
- Field sub-pieces: FieldControl, FieldError
- Tooltip sub-pieces: TooltipRoot, TooltipPortal, TooltipPositioner
- Sheet sub-piece: SheetRoot
- Form re-alias of BaseForm
Demoted from `export` to internal `const` (used only inside ui.tsx by
DialogContent/SheetContent/SheetPopup wrappers):
- DialogPortal, DialogBackdrop, DialogPopup
- SheetSide type
Also removed 6 now-unused Base UI imports (Accordion, Avatar, Form, Popover,
ScrollArea, Toast) and 1 unused icon (`ChevronRight`).
Locked the rule with `ui-tsx-dead-export-contract.test.ts`:
- every named export in ui.tsx must have a consumer outside ui.tsx OR be
in `ALLOWED_PENDING` with a justification (empty by default; capped at 5)
- second assertion prevents `ALLOWED_PENDING` from rotting unmaintained
Updated existing `ui-tsx-design-contract.test.ts`: z-50 count 5 → 4
(PopoverPopup deletion), `transition-[height]` entry removed (Accordion
deletion).
Full desktop test suite: 1578/1580 pass. Two pre-existing failures
(streaming-handoff, subagent-ui-contract — React `useRef` issues that
also fail on main without these changes) are unrelated.f25a95d to
dac5539Compare
Why
packages/ui/src/ui.tsxaccumulated ~30 named exports that no source file outside ui.tsx itself imported. Most were Base UI primitive re-exports (DialogTrigger = BaseDialog.Trigger) or shadcn-style wrappers that components.tsx + every renderer/primitive consumer ignored. They cost autocomplete noise, bundle weight, tsc work, and design-discussion clarity ("we have a Card variant" — except nothing uses it).This is the 清理 (cleanup) lane per WAWQAQ msg
97d44da7("打磨和清理和整理"). Companion to@maka-审美专家's scout notenotes/punch-list-organize.md.What
Net: −222 lines from
ui.tsx(797 → 590), +112 lines for the new dead-export contract.Deleted (no external consumer, no internal use):
Card,CardHeader,CardTitle,CardDescription,CardContentAvatar,AvatarImage,AvatarFallbackprimitives/accordion.tsxalready owns the alive duplicates exported asPrimitiveAccordion*primitives/scroll-area.tsxowns the alive implPopoverRoot/Trigger/Portal/Backdrop/Positioner/PopupDialogTrigger,DialogTitle,DialogDescriptionFieldControl,FieldErrorTooltipRoot,TooltipPortal,TooltipPositionerSheetRootFormre-alias ofBaseFormDemoted from
exportto internalconst(used only inside ui.tsx byDialogContent/SheetContent/SheetPopupwrappers):DialogPortal,DialogBackdrop,DialogPopupSheetSidetypeAlso removed 6 now-unused Base UI imports (
Accordion,Avatar,Form,Popover,ScrollArea,Toast) and 1 unused icon (ChevronRight).Contract
New
apps/desktop/src/main/__tests__/ui-tsx-dead-export-contract.test.ts:ui.tsxmust have a consumer outsideui.tsxOR be inALLOWED_PENDINGwith a justification (empty by default; capped at 5)ALLOWED_PENDINGfrom rotting unmaintainedUpdated existing
ui-tsx-design-contract.test.ts:z-50count 5 → 4 (PopoverPopup deletion),transition-[height]entry removed (Accordion deletion).Tests
npm -w @maka/ui run build— cleannpm -w @maka/desktop run typecheck— cleannpm -w @maka/desktop run test— 1578/1580 passstreaming-handoff,subagent-ui-contract— ReactuseRefissues that also fail on main without these changes) are unrelated; verified bygit stash+ re-running onupstream/mainScope discipline
components.tsxCardimport removed (had been unused since theCardJSX never appeared)Locks the rule WAWQAQ + aesthetics expert called for: don't reintroduce dead exports in ui.tsx.