From 65df9ac9aef225fb3fbf0b6c4bcdb4ac1e5a3efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Thu, 15 Jan 2026 13:01:34 +0100 Subject: [PATCH] Add the referenced angular.md file --- .claude/ANGULAR.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .claude/ANGULAR.md diff --git a/.claude/ANGULAR.md b/.claude/ANGULAR.md new file mode 100644 index 00000000000..7836e86838a --- /dev/null +++ b/.claude/ANGULAR.md @@ -0,0 +1,45 @@ +# Angular patterns + +## Observable Data Services (ADR-0003): + +```typescript +// Service exposes Observable streams +private _data$ = new BehaviorSubject([]); +readonly data$ = this._data$.asObservable(); + +// Component uses async pipe +data$ = this.dataService.data$; +// Template:
+``` + +## Subscription cleanup (required for explicit subscriptions) + +```typescript +constructor() { + this.observable$.pipe(takeUntilDestroyed()).subscribe(...); +} +``` + +## Signals + +Use Angular Signals only in components and presentational services. Use RxJS for cross-client services and complex reactive workflows. + +## No TypeScript Enums (ADR-0025): + +```typescript +// ✅ Correct +export const CipherType = Object.freeze({ + Login: 1, + SecureNote: 2, +} as const); +export type CipherType = (typeof CipherType)[keyof typeof CipherType]; + +// ❌ Wrong - don't add new enums +enum CipherType { + Login = 1, +} +``` + +## Component Change Detection + +Use `OnPush` change detection strategy for all components.