|
| 1 | +--- |
| 2 | +description: This rule provides a comprehensive set of instructions tailored for Angular 13 development. It encourages the use of existing patterns in the codebase and provides best practices for development. |
| 3 | +globs: ["**/*.{ts,html,scss,css}"] |
| 4 | +alwaysApply: true |
| 5 | +--- |
| 6 | +# Angular 13 EasyCLA Contributor Console |
| 7 | + |
| 8 | +## General Guidelines |
| 9 | +- Follow Angular style guide and best practices for Angular 13 |
| 10 | +- Use TypeScript strict mode patterns |
| 11 | +- Maintain consistent code formatting and structure |
| 12 | +- Follow the existing architectural patterns in the codebase |
| 13 | + |
| 14 | +## File Organization & Naming |
| 15 | +- Use kebab-case for file names (e.g., `add-company-modal.component.ts`) |
| 16 | +- Follow Angular naming conventions: |
| 17 | + - Components: `*.component.ts` |
| 18 | + - Services: `*.service.ts` |
| 19 | + - Models: `*.ts` (in models folder) |
| 20 | + - Pipes: `*.pipe.ts` |
| 21 | + - Validators: `*.validator.ts` |
| 22 | +- Group related files in feature modules with container/component structure |
| 23 | +- Place shared utilities in the `shared/` module |
| 24 | + |
| 25 | +## Component Patterns |
| 26 | +- Use the Container/Component (Smart/Dumb) pattern: |
| 27 | + - Containers handle business logic and state management |
| 28 | + - Components are presentational and receive data via @Input() |
| 29 | +- Implement OnInit lifecycle hook for initialization logic |
| 30 | +- Use ViewChild for DOM element references |
| 31 | +- Prefer reactive forms over template-driven forms |
| 32 | +- Use proper TypeScript typing for all properties and methods |
| 33 | + |
| 34 | +## Service Patterns |
| 35 | +- Use singleton services with `providedIn: 'root'` |
| 36 | +- Implement proper error handling in all service methods |
| 37 | +- Use RxJS operators for data transformation |
| 38 | +- Follow the existing API versioning pattern (getV1Endpoint, getV2Endpoint, etc.) |
| 39 | +- Use Subject/Observable pattern for cross-component communication |
| 40 | + |
| 41 | +## Angular Module Structure |
| 42 | +- Follow the existing modular architecture: |
| 43 | + - Feature modules (dashboard, individual-contributor, corporate-contributor) |
| 44 | + - Shared module for common components |
| 45 | + - Lazy loading where appropriate |
| 46 | +- Import only necessary modules in each feature module |
| 47 | +- Export components that need to be used outside the module |
| 48 | + |
| 49 | +## Styling Guidelines |
| 50 | +- Use SCSS for styling |
| 51 | +- Follow the existing Bootstrap 4 integration patterns |
| 52 | +- Use component-scoped styles |
| 53 | +- Maintain consistent spacing and layout patterns |
| 54 | +- Follow the existing responsive design patterns |
| 55 | + |
| 56 | +## RxJS Patterns |
| 57 | +- Use proper operator chaining with pipe() |
| 58 | +- Implement proper subscription management (unsubscribe in ngOnDestroy) |
| 59 | +- Use async pipe in templates where possible |
| 60 | +- Follow the existing observable patterns in services |
0 commit comments