2.6 KiB
2.6 KiB
Repository Guidelines
Project Structure & Module Organization
src/apphosts the App Router; use(auth)and(main)route groups and keep route-only components inside their segment folders.src/componentsholds shared UI; keep primitives incomponents/uiand group feature widgets under clear folder names.src/lib,src/services, andsrc/utilshouse shared logic, API clients, and helpers; extend an existing module before adding a new directory.- Mock handlers live in
src/mocks, MSW’s worker sits inpublic/mockServiceWorker.js, localization bundles underpublic/locales, and generated docs go todocs/.
Build, Test, and Development Commands
npm run devstarts the Turbopack dev server with MSW auto-registration whenNEXT_PUBLIC_ENABLE_MOCK=true.npm run buildcompiles the production bundle; run after routing or configuration changes.npm run startserves the built app and mirrors production runtime.npm run lintapplies the Next.js ESLint preset; resolve warnings before review.npm run i18n:scan,npm run i18n:scan-custom, andnpm run i18n:convertrefresh translation keys and writedocs/copy-audit.xlsx.
Coding Style & Naming Conventions
- TypeScript is required; keep strict types at module boundaries and define payload interfaces explicitly.
- Follow the house formatting: two-space indentation, double quotes, no semicolons, and Tailwind classes composed with
cn. - Use PascalCase for React components, camelCase for utilities,
useprefix for hooks, and kebab-case file names in routes. - Reuse theme tokens and shared icons through design-system helpers; avoid ad-hoc color values or inline SVG copies.
Testing Guidelines
- There is no global Jest/Vitest runner; smoke tests such as
src/utils/textParser.test.tsexecute withnpx tsx <path>—mirror that pattern for quick unit checks. - Keep exploratory scripts or
.test.tsfiles beside the code they exercise and strip console noise before shipping. - Prioritize integration checks through the dev server plus MSW, and document manual test steps in the PR when automation is absent.
Commit & Pull Request Guidelines
- Commit subjects are present-tense, sentence-style summaries (see
git log); add rationale in the body when touching multiple areas. - Scope each branch to a vertical slice (
feature/,fix/, orchore/) and rebase onmainbefore review. - PRs need a concise summary, screenshots for UI updates, environment-variable callouts, and links to related issues or docs.
- Flag data, security, or localization assumptions so reviewers can validate configuration changes quickly.