TypeScript configuration
The project uses TypeScript with specific compiler options:Import paths
Use the@/ alias for imports from the src/ directory:
Type annotations
WhilenoImplicitAny is disabled, you should still add type annotations for clarity:
ESLint configuration
The project uses ESLint with these rules:Running linting
React and hooks conventions
Component structure
Organize your components in this order:React hooks rules
Follow the Rules of Hooks:- Call hooks at the top level (not inside loops or conditions)
- Only call hooks from React functions
- Use ESLint plugin to catch violations
useCallback and useMemo
UseuseCallback for event handlers and useMemo for expensive calculations:
Custom hooks
Use provided custom hooks for common functionality:Naming conventions
Files and directories
- Components - PascalCase:
Base64Converter.tsx,HashGenerator.tsx - Utilities - camelCase:
utils.ts,lazyUtils.ts - Types - PascalCase:
types.ts(export PascalCase types) - Hooks - camelCase with
useprefix:useToast.ts
Variables and functions
Interfaces and types
Component styling
Tailwind CSS
Use Tailwind utility classes for styling:Design tokens
Use semantic color tokens:text-foreground- Primary text colortext-muted-foreground- Secondary text colorbg-muted- Muted backgroundborder-border- Border colortext-dev-primary- Brand primary colorbg-dev-primary- Brand primary backgroundtext-destructive- Error text
Spacing and layout
Error handling
Try-catch blocks
Handle errors gracefully and provide user-friendly messages:Error display
Toast for user feedback
Code comments
When to comment
JSX comments
Performance considerations
Lazy loading
Always register utilities inlazyUtils.ts for code splitting:
Dynamic imports
Load heavy libraries only when needed:Debouncing
Debounce expensive operations:Testing
Pre-commit checklist
Before committing, run:Manual testing
Test your utility:- ✅ Works with valid input
- ✅ Handles invalid input gracefully
- ✅ Error messages are clear
- ✅ Keyboard shortcuts work
- ✅ Copy buttons work
- ✅ Responsive on mobile devices
- ✅ Toast notifications appear
- ✅ Loading states display correctly
Git conventions
Commit messages
Write clear, descriptive commit messages:Branch names
Use descriptive branch names:Accessibility
Labels and ARIA attributes
Keyboard navigation
- Ensure all interactive elements are keyboard accessible
- Implement standard keyboard shortcuts
- Use semantic HTML (
<button>,<input>, etc.) - Maintain logical tab order
Color contrast
Use semantic color tokens to maintain proper contrast ratios:Documentation
Code documentation
- Add JSDoc comments for exported functions
- Document complex interfaces
- Explain non-obvious behavior
- Include usage examples for utilities
Component props documentation
Summary checklist
Before submitting your contribution:- ✅ Code follows TypeScript and React conventions
- ✅ Uses
@/import alias - ✅ Implements proper error handling
- ✅ Follows naming conventions
- ✅ Uses Tailwind CSS utility classes
- ✅ Includes proper TypeScript types
- ✅ Passes
npm run lint - ✅ Passes
npm run check - ✅ Passes
npm run test - ✅ Tested manually in browser
- ✅ Keyboard shortcuts implemented
- ✅ Accessible to keyboard users
- ✅ Responsive on mobile devices
- ✅ Clear commit messages
Adding utilities
Ready to build? Learn how to create and register new utilities