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: language-agnostic
configdata-modelingclean-codeyagni
Don't add a per-item config flag for a single special case
If only one item needs a flag, identify it by a stable property (name/id) instead of attaching a flag to every item in config; add the flag per-item only when many items use it and it changes often.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | categories.map(c => ({ ...c, isAdminOnly: c.name === 'Fra admin' })); |
| 2 | // flag added to every category for one case |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const isAdminCategory = (c: Category) => c.name === 'Fra admin'; |
| 2 | // identify the single special case by its stable property |
Explanation (EN)
Objašnjenje (HR)