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
correctnessidentifierscomparison
Compare against stable identifiers, not display names
Branch on a stable id/key rather than a human-readable name, which can change or be localized and is fragile to match on.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | const shouldShowMarketNews = category?.name !== 'Fra admin' && hasNews; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const shouldShowMarketNews = category?.id !== ADMIN_CATEGORY_ID && hasNews; |
Explanation (EN)
Objašnjenje (HR)