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
namingreadabilitystorageside-effects
Name storage helpers after where they read from or write to
Name persistence helpers explicitly for their target (e.g. setSessionInStorage, getSessionFromStorage) so the side effect is obvious and not confused with in-memory state.
PR: hegnar-forum-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | const setStoredSession = (s) => sessionStorage.setItem('s', s); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const setSessionInStorage = (s) => sessionStorage.setItem('s', s); |
| 2 | const getSessionFromStorage = () => sessionStorage.getItem('s'); |
Explanation (EN)
Objašnjenje (HR)