|
| 1 | +# React Todo App - Copilot Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +This is a React-based Todo application that allows users to create, manage, and organize tasks with features like tags, task lists, and task filtering. The application is built using React, Framer Motion for animations, and Tailwind CSS for styling. It uses Vite as the build tool and Vitest for testing. |
| 5 | + |
| 6 | +## Code Standards |
| 7 | + |
| 8 | +### Required Before Commit |
| 9 | +- All tests must pass: `npm test` |
| 10 | +- Code must follow JSX and React best practices |
| 11 | +- Ensure proper component structure and separation of concerns |
| 12 | +- Verify that new components follow established patterns and include tests |
| 13 | +- Check for accessibility issues in UI components |
| 14 | + |
| 15 | +### React Patterns |
| 16 | +- Follow functional component patterns with React Hooks |
| 17 | +- Use context providers for state management (TaskContext, TagContext, ListContext) |
| 18 | +- Follow component composition principles |
| 19 | +- Use proper data-testid attributes for testability |
| 20 | +- Apply proper prop types validation when needed |
| 21 | +- Keep components focused on a single responsibility |
| 22 | +- Use descriptive variable and function names |
| 23 | + |
| 24 | +### CSS/Styling Standards |
| 25 | +- Use Tailwind CSS utility classes for styling |
| 26 | +- Follow the established color scheme defined in tailwind.config.js |
| 27 | +- Use consistent spacing and sizing patterns |
| 28 | +- Ensure responsive design works across different screen sizes |
| 29 | + |
| 30 | +## Development Flow |
| 31 | + |
| 32 | +- Install dependencies: `npm install` |
| 33 | +- Start development server: `npm start` |
| 34 | +- Run tests: `npm test` |
| 35 | +- Build for production: `npm run build` |
| 36 | + |
| 37 | +## Repository Structure |
| 38 | +- `/src`: Main application source code |
| 39 | + - `/context`: React context providers for state management |
| 40 | + - `/features`: Feature-based organization of components |
| 41 | + - `/lists`: List-related components |
| 42 | + - `/tags`: Tag management components |
| 43 | + - `/tasks`: Task-related components |
| 44 | + - `/common`: Common/shared components and utilities |
| 45 | +- `/public`: Static assets and HTML template |
| 46 | +- Configuration files: |
| 47 | + - `vite.config.js`: Vite configuration |
| 48 | + - `tailwind.config.js`: Tailwind CSS configuration |
| 49 | + - `vitest.config.js`: Vitest test runner configuration |
| 50 | + |
| 51 | +## Key Guidelines |
| 52 | + |
| 53 | +1. **Component Architecture**: |
| 54 | + - Components should be organized by feature in the features directory |
| 55 | + - Each component should have a single responsibility |
| 56 | + - Use composition over inheritance |
| 57 | + - Keep components reasonably sized and focused |
| 58 | + |
| 59 | +2. **State Management**: |
| 60 | + - Use the established context providers: |
| 61 | + - `TaskContext` for task-related state and operations |
| 62 | + - `TagContext` for tag management |
| 63 | + - `ListContext` for task list management |
| 64 | + - Follow the pattern of providing actions through context |
| 65 | + |
| 66 | +3. **UI/UX Standards**: |
| 67 | + - Use Framer Motion for animations to maintain consistency |
| 68 | + - Follow the established design patterns for components |
| 69 | + - Ensure proper accessibility attributes are included |
| 70 | + - Use the defined color palette from the Tailwind configuration |
| 71 | + |
| 72 | +4. **Testing**: |
| 73 | + - Write tests for all components using Vitest and React Testing Library |
| 74 | + - Mock dependencies appropriately in tests |
| 75 | + - Test both component rendering and user interactions |
| 76 | + - Use data-testid attributes for targeting elements in tests |
| 77 | + |
| 78 | +5. **Documentation**: |
| 79 | + - Include JSDoc comments for complex functions |
| 80 | + - Document props for components when they're not self-explanatory |
| 81 | + - Add meaningful comments for complex logic |
| 82 | + - Document context providers' purpose and available values/actions |
| 83 | + |
| 84 | +6. **Performance Considerations**: |
| 85 | + - Use React.memo for components that render frequently |
| 86 | + - Be mindful of unnecessary re-renders |
| 87 | + - Keep animations performant by using hardware-accelerated properties |
0 commit comments