Coding Rules
March 3, 2026 ยท View on GitHub
Critical Rules (Always Check)
- Use
constfor constants withALL_CAPSnaming andletfor everything else - Use
cn()utility for dynamic classes, never template strings - Use function declarations
function foo()not arrow expressions - Named exports only, no default exports (except for must-use cases like Route components)
- No
useMemooruseCallback(React 19 compiler handles it)
File Organization
- Co-locate related files (component, styles, types, utils)
- No barrel exports (index.ts re-export files)
- Use kebab-case for filenames:
product-card.tsx
Naming
- Components: PascalCase (
ProductCard) - Files: kebab-case (
product-card.tsx) - Functions: camelCase (
getProduct) - Constants: UPPER_SNAKE_CASE (
REVIEWS_PER_PAGE) - Types: PascalCase (
Product,Cart)
Styling
- Use Tailwind CSS
- Use
cn()fromlib/cnfor conditional classes (No string templates) - Use
cvafor building component class variants, not objects or arrays