web: enforce TSX roles with a positive source whitelist #164

Open
opened 2026-07-30 08:08:28 +00:00 by perishadmin · 0 comments
Contributor

Problem

web.tsx-under-components currently inspects only direct .tsx files below
apps/web/src/lib. A nested file such as
apps/web/src/lib/ui/topology-scene.tsx therefore passes plumb doctor.

That blind spot also prevents the style-free component policy from activating
when a repository has no apps/web/src/lib/components directory. Noema
demonstrated the combined escape with:

  • apps/web/src/lib/ui/topology-scene.tsx
  • apps/web/src/lib/ui/topology-scene.scss

Plumb v0.16.0 reported the repository clean.

Proposed rule

Make the allowed TSX roles a recursive positive whitelist:

  • apps/web/src/main.tsx
  • apps/web/src/views/**/*.tsx
  • apps/web/src/lib/components/**/*.tsx

Reject every other .tsx file below apps/web/src. Hooks and other reusable
logic remain .ts.

Acceptance criteria

  • Nested TSX outside the whitelist is rejected.
  • Nested TSX below lib/components is accepted.
  • Nested views are accepted.
  • main.tsx is accepted.
  • Existing style-free enforcement continues to cover
    apps/web/src/lib/components/**.
  • Rule documentation and evidence describe recursive coverage rather than only
    direct files.
## Problem `web.tsx-under-components` currently inspects only direct `.tsx` files below `apps/web/src/lib`. A nested file such as `apps/web/src/lib/ui/topology-scene.tsx` therefore passes `plumb doctor`. That blind spot also prevents the style-free component policy from activating when a repository has no `apps/web/src/lib/components` directory. Noema demonstrated the combined escape with: - `apps/web/src/lib/ui/topology-scene.tsx` - `apps/web/src/lib/ui/topology-scene.scss` Plumb v0.16.0 reported the repository clean. ## Proposed rule Make the allowed TSX roles a recursive positive whitelist: - `apps/web/src/main.tsx` - `apps/web/src/views/**/*.tsx` - `apps/web/src/lib/components/**/*.tsx` Reject every other `.tsx` file below `apps/web/src`. Hooks and other reusable logic remain `.ts`. ## Acceptance criteria - Nested TSX outside the whitelist is rejected. - Nested TSX below `lib/components` is accepted. - Nested views are accepted. - `main.tsx` is accepted. - Existing style-free enforcement continues to cover `apps/web/src/lib/components/**`. - Rule documentation and evidence describe recursive coverage rather than only direct files.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
PerishLab/plumb#164
No description provided.