AgentLint Verified 100/1001,031 React + Vite repos analyzed

    React + Vite CLAUDE.md & AGENTS.md Template

    Strict component props, predictable hooks, and fast Vitest/Testing Library loops distilled from 1,031 React repos.

    # React + Vite App — Frontend Harness
    
    Vite + React 18 + TypeScript single-page application styled with Tailwind CSS and tested with Vitest + Testing Library.
    
    ## Commands
    
    - Install: `pnpm install --frozen-lockfile`
    - Fast single test: `npx vitest run src/components/FilterBar.test.tsx`
    - Full unit suite: `pnpm test`
    - Lint & typecheck: `pnpm lint && npx tsc --noEmit`
    - Build: `pnpm build`
    
    ## Rules
    
    - Don't mirror props or computable values into `useState` + `useEffect`. Instead derive values directly during render or via `useMemo`. Because effect-synced state triggers double renders and stale UI bugs.
    - Don't silence `react-hooks/exhaustive-deps` warnings with ESLint disable comments. Instead extract stable callbacks or restructure state. Because missing dependencies hide stale-closure defects.
    - Don't introduce new primitive UI components before checking `src/components/ui/`. Instead reuse existing primitives so focus states and tokens stay consistent.
    - When changing client routes or state stores, read `docs/frontend-architecture.md` first.
    
    ## Continuity & Safety
    
    - Keep `.env*` and `CLAUDE.local.md` out of git — never embed private keys in `VITE_*` browser variables.
    - Record passing test commands and visual check notes in `HANDOFF.md`.

    Most Adopted React + Vite Rules Across Real Open-Source Repos

    Measured across 1,031 public React + Vite repositories in the 4,533-repo harness study:

    reactframework

    React component patterns (940 TypeScript + 91 JavaScript repos in corpus)

    57.5%1031 repos
    tailwindcsstooling

    Tailwind CSS utility styling

    38.8%595 repos
    unit-teststesting

    Component & hook unit tests for every change

    36.3%651 repos
    eslinttooling

    ESLint + react-hooks exhaustive-deps

    36.9%565 repos
    vitesttesting

    Vitest + React Testing Library

    32.6%499 repos
    Essential Commands (Checks W1 & W7)
    install
    pnpm install --frozen-lockfile
    fastTest
    npx vitest run src/components/CheckoutForm.test.tsx
    fullTest
    pnpm test
    lint
    pnpm lint && npx tsc --noEmit
    build
    pnpm build
    Common React + Vite Agent Pitfalls
    • 01Agents add derived state into useEffect + useState pairs instead of computing values during render, causing flicker and stale closures.
    • 02Spreading untyped ...props hides invalid DOM attributes and breaks strict TypeScript boundaries.
    • 03Forgetting to clean up subscriptions or timers inside effects causes test leaks.

    More Verified Stack Templates