Angular / TypeScript Naming Conventions
Classes, Interfaces, Types, Enums: PascalCase (e.g.,
UserProfileComponent,AuthService,OrderStatusEnum).Variables and function/method names: camelCase (e.g.,
currentUser,calculateDiscount()).Constants: UPPER_SNAKE_CASE (e.g.,
API_URL,MAX_UPLOAD_SIZE). For local constants that are not exported, camelCase is acceptable.Private fields in classes: camelCase with a leading underscore (e.g.,
_subscription), or simply camelCase without underscore—choose one and enforce consistently. Recommendation: use underscore for private fields to distinguish from public properties.Observable variables: suffix with
$to indicate asynchronous streams (e.g.,user$,data$).Component selectors: kebab-case, prefixed with the project/team prefix (e.g.,
app-user-list,company-header). Nong-prefix.Directive selectors: camelCase (e.g.,
[appHighlight]).Enum values: PascalCase (e.g.,
OrderStatus.Shipped).
Examples: