|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `apps/docs`: Storybook docs, examples, and UI tests. |
| 5 | +- `packages/components`: Source for `@lambdacurry/forms` (`src/**`, built to `dist/`). |
| 6 | +- `types/`: Shared ambient types. |
| 7 | +- `.changeset/`: Versioning and release metadata. |
| 8 | +- Root configs: `biome.json`, `turbo.json`, `tsconfig.json`, `package.json` (Yarn workspaces). |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- `yarn dev`: Run all workspace dev tasks via Turbo. |
| 12 | +- `yarn build`: Build all packages/apps. |
| 13 | +- `yarn serve`: Serve built Storybook (`apps/docs`). |
| 14 | +- `yarn test`: Run workspace tests (Storybook test-runner in `apps/docs`). |
| 15 | +- `yarn format-and-lint` | `:fix`: Check/auto-fix with Biome. |
| 16 | +- Per workspace (examples): |
| 17 | + - `yarn workspace @lambdacurry/forms build` |
| 18 | + - `yarn workspace @lambdacurry/forms-docs dev` |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Indentation: 2 spaces; max line width 120; single quotes (Biome enforced). |
| 22 | +- TypeScript + React (ES modules). Keep components pure and typed. |
| 23 | +- Filenames: kebab-case (e.g., `text-field.tsx`, `data-table-filter/**`). |
| 24 | +- Components/Types: PascalCase; hooks: camelCase with `use*` prefix. |
| 25 | +- Imports: organized automatically (Biome). Prefer local `index.ts` barrels when useful. |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Framework: Storybook Test Runner (Playwright under the hood) in `apps/docs`. |
| 29 | +- Naming: co-locate tests as `*.test.tsx` near stories/components. |
| 30 | +- Run: `yarn test` (CI-like) or `yarn workspace @lambdacurry/forms-docs test:local`. |
| 31 | +- Cover critical interactions (forms, validation, a11y, filter behavior). Add stories to exercise states. |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +- Commits: short imperative subject, optional scope, concise body explaining rationale. |
| 35 | + - Example: `Fix: remove deprecated dropdown select`. |
| 36 | +- PRs: clear description, linked issues, screenshots or Storybook links, notes on testing. |
| 37 | +- Required checks: `yarn format-and-lint` passes; build succeeds; tests updated/added. |
| 38 | +- Versioning: when changing published package(s), add a Changeset (`yarn changeset`) before merge. |
| 39 | + |
| 40 | +## Security & Configuration |
| 41 | +- Node `22.9.0` (`.nvmrc`) and Yarn 4 (`packageManager`). |
| 42 | +- Do not commit secrets. Keep large artifacts out of VCS (`dist`, `node_modules`). |
| 43 | +- PR previews for Storybook are published via GitHub Pages; verify links in PR comments. |
| 44 | + |
| 45 | +## Cursor Rules Review |
| 46 | +- `.cursor/rules/react-typescript-patterns.mdc` (Always): React 19 + TS conventions, refs, props/types, naming. |
| 47 | +- `.cursor/rules/ui-component-patterns.mdc` (Always): Radix + Tailwind 4 + CVA patterns, a11y, performance. |
| 48 | +- `.cursor/rules/form-component-patterns.mdc`: Remix Hook Form + Zod wrappers, errors, server actions. |
| 49 | +- `.cursor/rules/storybook-testing.mdc`: Storybook play tests, router stub decorator, local/CI flows. |
| 50 | +- `.cursor/rules/monorepo-organization.mdc`: Imports/exports, package boundaries, Turbo/Vite/TS paths. |
| 51 | +- `.cursor/rules/versioning-with-npm.mdc`: npm CLI version bumps (patch-first), CI publishes on merge. |
| 52 | + |
| 53 | +When to review before starting work |
| 54 | +- Building/refactoring UI components: react-typescript-patterns + ui-component-patterns. |
| 55 | +- Form-aware components or validation: form-component-patterns. |
| 56 | +- Writing/updating stories or interaction tests: storybook-testing. |
| 57 | +- Moving files, changing exports/imports, adding deps/build entries: monorepo-organization. |
| 58 | +- Complex UI (data table, Radix primitives, variants): ui-component-patterns for a11y/perf. |
| 59 | + |
| 60 | +Quick checklist |
| 61 | +- Files/names: kebab-case files; PascalCase components; named exports only. |
| 62 | +- Types: explicit props interfaces; React 19 ref patterns; organize imports (Biome). |
| 63 | +- Forms: Zod schemas, proper messages, `fetcher.Form`, show `FormMessage` errors. |
| 64 | +- Tests: per-story decorators, semantic queries, three-phase play tests; run `yarn test`. |
| 65 | +- Monorepo: no cross-package relative imports; verify `exports`, TS `paths`, Turbo outputs. |
0 commit comments