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).
frontend ruleP2universalStack: javascript
localstorageconstantsnamingmaintainability
Define storage keys centrally with unique names
Keep localStorage keys in one constants module with descriptive, collision-proof names rather than scattering string literals.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | localStorage.setItem('hide', '1'); // generic key, defined inline |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // config/localStorage.ts |
| 2 | export const HIDE_RSS_DISCLAIMER_PROMPT = 'hideRssDisclaimerPrompt'; |
Explanation (EN)
Objašnjenje (HR)