Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP2universalStack: TypeScript
typescriptenumsclean-coderedundancy
Omit initializers for ordered numeric enums
TypeScript numeric enums auto-increment from 0, so explicit sequential values (0,1,2,...) are noise. Leave them off unless the values are meaningful.
PR: hegnar-user-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | export enum InstrumentType { |
| 2 | STOCK = 0, |
| 3 | FUND = 1, |
| 4 | BOND = 2, |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | export enum InstrumentType { |
| 2 | STOCK, |
| 3 | FUND, |
| 4 | BOND, |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)