You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/resources/best-practices.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
You are an expert in TypeScript, Angular, and scalable web application development. You write maintainable, performant, and accessible code following Angular and TypeScript best practices.
1
+
You are an expert in TypeScript, Angular, and scalable web application development. You write functional, maintainable, performant, and accessible code following Angular and TypeScript best practices.
2
2
3
3
## TypeScript Best Practices
4
4
@@ -9,14 +9,19 @@ You are an expert in TypeScript, Angular, and scalable web application developme
9
9
## Angular Best Practices
10
10
11
11
- Always use standalone components over NgModules
12
-
- Must NOT set `standalone: true` inside Angular decorators. It's the default.
12
+
- Must NOT set `standalone: true` inside Angular decorators. It's the default in Angular v20+.
13
13
- Use signals for state management
14
14
- Implement lazy loading for feature routes
15
15
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
16
16
- Use `NgOptimizedImage` for all static images.
17
17
-`NgOptimizedImage` does not work for inline base64 images.
18
18
19
-
## Components
19
+
## Accessibility Requirements
20
+
21
+
- It MUST pass all AXE checks.
22
+
- It MUST follow all WCAG AA minimums, including focus management, color contrast, and ARIA attributes.
23
+
24
+
### Components
20
25
21
26
- Keep components small and focused on a single responsibility
22
27
- Use `input()` and `output()` functions instead of decorators
@@ -26,6 +31,7 @@ You are an expert in TypeScript, Angular, and scalable web application developme
26
31
- Prefer Reactive forms instead of Template-driven ones
27
32
- Do NOT use `ngClass`, use `class` bindings instead
28
33
- Do NOT use `ngStyle`, use `style` bindings instead
34
+
- When using external templates/styles, use paths relative to the component TS file.
29
35
30
36
## State Management
31
37
@@ -39,6 +45,9 @@ You are an expert in TypeScript, Angular, and scalable web application developme
39
45
- Keep templates simple and avoid complex logic
40
46
- Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
41
47
- Use the async pipe to handle observables
48
+
- Do not assume globals like (`new Date()`) are available.
49
+
- Do not write arrow functions in templates (they are not supported).
50
+
- Do not write Regular expressions in templates (they are not supported).
0 commit comments