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 ruleP1universalStack: TypeScript
modelingapi-designenumsclarity
Do not overload a single field to mean two different concepts
Conflating distinct concepts (e.g. article source vs article type) into one parameter breeds confusion; model them as separate fields/enums.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | // 'borsmeldinger' means both a source and a sub-type depending on context |
| 2 | filterBy(type: 'borsmeldinger' | 'press' | 'fa') |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | enum ArticleSource { Fa, Tdn, Millistream } |
| 2 | enum MillistreamType { Press, Stock } |
| 3 | filterBy({ source, millistreamType }) |
Explanation (EN)
Objašnjenje (HR)