General workflow rules
Quality gates for the SHOPin storefront accelerator: keep types, tests, lint, and format green locally so CI and production stay predictable.
Pre-commit checks
These checks should pass before you commit. Husky runs them when you create a commit; CI should run the same tasks.
TypeScript (Type Safety)
Types carry contracts between UI and BFF; keep them strict at boundaries.
- Rule: Anything that crosses package or layer boundaries should be fully typed. If you skip typing, add a short comment why.
- Rule: Use
core/contractsas the source of truth for shared interfaces and types.
Unit Tests
Write comprehensive unit tests for all new or modified business logic and complex functions.
- Rule: Ensure existing tests pass and your new tests confirm the expected functionality of the features you developed or changed.
Linter (ESLint)
- Rule: Fix ESLint errors and warnings before you commit (or suppress only with an agreed pattern and comment).
Formatter (Prettier)
- Rule: Format committed files with Prettier so style stays consistent across the monorepo.
Cross-environment validation
Validate meaningful changes in the storefront, Storybook, and BFF so types and behaviour stay aligned.
Browser (Next.js storefront)
Exercise the flows your change touches in apps/presentation.
- Rule: No new unexpected console errors or warnings from your change.
- Rule: Cover the relevant user paths, including obvious edge cases.
Storybook
For new or changed UI, check stories in apps/storybook where they exist.
- Rule: Relevant states (loading, error, disabled, etc.) should be visible and behave as expected.
BFF
Confirm apps/bff routes and payloads match what the storefront expects.
- Rule: Request/response shapes align with
core/contracts(or the agreed contract for that feature). - Rule: Do not ship breaking contract changes without exercising the consuming UI paths.