mirror of
https://github.com/bitwarden/browser
synced 2026-02-06 19:53:59 +00:00
Moved enums adr
This commit is contained in:
@@ -291,6 +291,22 @@ describe("MyComponent", () => {
|
||||
| Constants | SCREAMING_SNAKE_CASE | `MAX_RETRY_COUNT` |
|
||||
| Observables | camelCase with `$` suffix | `ciphers$` |
|
||||
|
||||
### 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,
|
||||
}
|
||||
```
|
||||
|
||||
## Anti-Patterns
|
||||
|
||||
### DO
|
||||
|
||||
@@ -24,22 +24,6 @@ constructor() {
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user