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).
backend ruleP2stack specificStack: typescript
typescriptconsistencyenumsnaming
Use the same construct (enum vs const map) consistently for related sets
When similar fixed sets elsewhere are enums, prefer an enum here too rather than mixing loose constants, unless you genuinely need keyed lookup by value.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | const PERIOD_TYPE_QUARTER = 'Q'; |
| 2 | const PERIOD_TYPE_YEAR = 'Y'; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | enum PeriodType { |
| 2 | Quarter = 'Q', |
| 3 | Year = 'Y', |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)