Issue 465
tech-debt: Lint rule: no raw form elements outside the UI kit
Back to our planDone
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-elementsfromeslint-plugin-react, whicheslint-config-nextalready loads. Use it rather than anotherno-restricted-syntaxblock. In flat config, a laterno-restricted-syntaxfor 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 eslintfails on a rawinput,button,selectortextareain 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 lintpasses onmain's code.
Generated by Claude Code, opens in a new tab