This project follows strict coding standards to ensure maintainability and consistency.
- Language: TypeScript (strict mode).
- Target: ESNext.
- Use Functional Components with Hooks.
- PascalCase for filenames and component names (e.g.,
ThreadCard.tsx). - One component per file (exceptions for tiny local sub-components).
// Good
export const MyComponent = () => {
return <div>Hello</div>;
};
// Bad
export default function myComponent() {} // Avoid default exports if possible- camelCase starting with
use(e.g.,useAuth).
- Slice names need to be descriptive (e.g.,
authSlice,uiSlice). - Action types should be namespaced (e.g.,
auth/login).
We use both Chakra UI and Tailwind. To avoid conflicts and mess:
- Layout: Use Tailwind classes (
flex,grid,w-full,p-4) or Chakra's Layout components (Box,Flex,Stack). Pick one for a specific component and stick to it. - Interactive Elements: Prefer Chakra UI components (
Button,Input) for accessibility. - Custom CSS: Avoid
index.cssglobal styles unless resetting. Use Chakra'ssxprop or Tailwind classes.
- Order classes logically: Layout -> Spacing -> Sizing -> Typography -> Visuals -> Misc.
- Use
classnameutil (likeclsxorclassnames) if conditional logic is needed.
- Variables:
camelCase - Constants:
UPPER_SNAKE_CASE(e.g.,MAX_THREAD_LENGTH) - Interfaces/Types:
PascalCase. Do not prefix withI(e.g.,UsernotIUser).
Run linting to check for issues:
npm run lintWe use ESLint with standard React/TypeScript configs.