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: universal
constantslocalityyagnimaintainability
Keep single-use constants local; promote to shared modules only when reused
Define a constant (translation string, config value) in the file that uses it, and move it to a shared module only once a second consumer actually needs it.
PR: hegnar-forum-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | // shared/translations.ts — only used by one component |
| 2 | export const SELECT_DATE = 'Velg dato'; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // inside the single component that uses it |
| 2 | const SELECT_DATE = 'Velg dato'; |
| 3 | // promote to shared module only when a 2nd file needs it |
Explanation (EN)
Objašnjenje (HR)