Skip to content
SprecherEast
Issue 465

tech-debt: Lint rule: no raw form elements outside the UI kit

Back to our plan
Done
frontendtech-debtpriority: medium

Summary

Turn on the lint rule the shared-components epic (#163) asks for: outside the UI kit, code can't use a raw <input>, <button>, <select> or <textarea>. Screens then always get the kit's tested, accessible versions (Button, Field), and a slip fails lint instead of reaching a review.

Details

Epic #163, "Rules": "A lint rule blocks raw input, button, select and textarea elements outside platform/ui/." Its acceptance criteria include "The lint rule is on."

  • Native first: react/forbid-elements from eslint-plugin-react, which eslint-config-next already loads. Use it rather than another no-restricted-syntax block. In flat config, a later no-restricted-syntax for the same files replaces the theme-token selectors (#146) instead of adding to them.
  • Scope: src/**/*.tsx, except:
    • src/platform/ui/**: the kit itself
    • tests
    • src/app/(payload)/**, which is generated
    • Payload admin components in src/platform/payload/admin/**, which render inside Payload's own admin UI and its styles, not the site's kit
  • Today: one raw element outside the kit, src/platform/payload/admin/SeedButton.client.tsx, which is an admin component.

Acceptance criteria

  • Not done: npx eslint fails on a raw input, button, select or textarea in a module or route, with a message naming the kit component to use instead.
  • Not done: The kit, tests, generated Payload routes and Payload admin components are exempt.
  • Not done: npm run lint passes on main's code.

Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab