|
| 1 | +# Code Style Guidelines |
| 2 | + |
| 3 | +## 1. Naming Conventions |
| 4 | +- Use PascalCase for component names |
| 5 | +- Use camelCase for variables and functions |
| 6 | +- Use consistent naming conventions across the project |
| 7 | + |
| 8 | +## 2. Code Structure |
| 9 | +- Use TypeScript for type safety and improved developer experience |
| 10 | +- Use JSX syntax for React components |
| 11 | +- Prefer functional components with hooks over class components |
| 12 | +- Implement a modular file structure, grouping related components and exports in specific folders |
| 13 | +- Use arrow functions for component definitions |
| 14 | +- Organize imports at the top of files |
| 15 | +- Use optional chaining (?.) for potentially undefined properties |
| 16 | +- Prefer const over let for variable declarations |
| 17 | +- Use default parameter values and optional parameters where appropriate |
| 18 | +- Use interface or type aliases for complex object structures |
| 19 | +- Use explicit return types for functions and components |
| 20 | + |
| 21 | +## 3. Documentation |
| 22 | +- Use JSDoc-style comments for function and component documentation |
| 23 | +- Provide detailed component descriptions, including parameter descriptions and example usage |
| 24 | +- Use markdown formatting for documentation, including proper syntax for code blocks |
| 25 | +- Use descriptive and concise titles for documentation sections |
| 26 | +- Use consistent formatting for component documentation |
| 27 | + |
| 28 | +## 4. Error Handling |
| 29 | +- Implement proper error handling and type checking |
| 30 | +- Use async/await for asynchronous operations |
| 31 | + |
| 32 | +## 5. Performance |
| 33 | +- Optimize component rendering using React performance optimization techniques |
| 34 | +- Follow a modular approach by breaking down functionality into smaller, reusable components |
| 35 | + |
| 36 | +## 6. Security |
| 37 | +- Use crypto.timingSafeEqual for secure string comparison |
| 38 | +- Avoid using dangerouslySetInnerHTML to prevent XSS vulnerabilities |
| 39 | +- Avoid using eval for security reasons |
| 40 | +- Use hardcoded string literals when calling require to prevent potential vulnerabilities |
| 41 | +- Use safe alternatives to manipulate DOM elements instead of innerHTML |
| 42 | + |
| 43 | +## 7. Best Practices |
| 44 | +- Use proper indentation and spacing for improved readability |
| 45 | +- Provide descriptive comments for functions and components |
| 46 | +- Utilize TypeScript's type annotations |
0 commit comments