docs(rules): update TypeScript and Angular rules for TS 7 and trim duplicates

TypeScript 7.0 ships the native compiler as tsc and drops options
deprecated in 6.0. Angular 22 still requires TypeScript >=6.0.0 <6.1.0,
so both rule sets now warn against moving Angular projects to TS 7, and
the Angular index asks to check the Angular version first.

TypeScript runtime safety adds error handling (Error objects only,
cause chaining, unknown in catch, one error model per layer, no
swallowed errors) plus exact decimals for money, ISO 8601 UTC dates, and
Intl formatting. Angular adds per-route SSR render modes, a global
ErrorHandler with provideBrowserGlobalErrorListeners, and translatable
text with locale-aware formatting.

Generic guidance that the TypeScript, refactoring, and UI/UX rules
already cover is removed from the Angular rules, which shrink by about
7.5 percent despite the additions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-18 10:08:25 +01:00
1 parent 368cf5ee4a
commit b6c33780c3
9 files changed
+43 -114

No files matched your search

@@ -6,23 +6,14 @@ Apply these rules when building Angular forms, validation, routes, guards, or re
* Follow the form approach the project uses. For non-trivial forms, use typed reactive forms (`FormGroup`, `FormControl`, `NonNullableFormBuilder`; `nonNullable` controls where reset should restore the initial value) and never `Untyped*` classes in new code.
* Signal forms (`@angular/forms/signals`) are stable since Angular 22. Use them for new forms only when the project is on 22+ and has adopted them; do not migrate existing forms unasked.
* Keep validation rules centralized and reusable where practical.
* Keep validation rules centralized and reusable, and keep form state separate from domain state when useful. The UI/UX forms rule covers error display and input preservation.
* Client-side validation is user experience; the server must validate every submission. Never treat client-side validation as a security boundary.
* Keep form state separate from domain state when useful.
* Avoid large components that combine layout, validation, persistence and business logic.
* Display validation errors consistently.
* Preserve user input when recoverable errors occur.
## Routing
* Keep route definitions explicit and predictable.
* Prefer lazy loading for larger feature areas with `loadComponent` or `loadChildren` pointing to standalone route arrays.
* Keep route definitions explicit, and lazy load larger feature areas with `loadComponent` or `loadChildren` pointing to standalone route arrays.
* Write new guards and resolvers as functions (`CanActivateFn`, `ResolveFn`); keep class-based guards where the project uses them, since they remain supported.
* Use `withComponentInputBinding()` to bind route parameters to component inputs where the project enables it.
* Avoid loading large feature bundles eagerly without need.
* Use route guards only for navigation behavior, not as a security boundary.
* Authorization must still be enforced on the backend.
* Keep resolvers focused.
* Avoid expensive work during navigation unless required.
* Use route guards only for navigation behavior, not as a security boundary; enforce authorization on the backend. Keep resolvers focused and navigation free of expensive work.
* Route and query parameters arrive as `string | null`. Parse and validate them before use and treat them as untrusted input.
* Do not rely on client-side routing state for sensitive authorization decisions.
* With SSR, set the render mode per route in `app.routes.server.ts` (`ServerRoute` with `RenderMode.Prerender` for static pages, `RenderMode.Server` for per-request content, `RenderMode.Client` for client-only pages), registered through `provideServerRendering(withRoutes(...))`.