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
readabilitydestructuringorganization
Group a long destructured list by purpose for readability
When pulling many values out of a context or object, group them (state vs setters, or by feature) instead of one undifferentiated wall of names.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codets
| 1 | const { |
| 2 | activeTab, activeFilter, threads, count, page, backendPageNumber, hasMore, |
| 3 | isError, isLoading, isFilterChanged, setBackendPageNumber, setThreads, |
| 4 | setDiscussions, setPage, fetchPostData, |
| 5 | } = useFrontpage(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const { |
| 2 | // data |
| 3 | threads, count, discussions, |
| 4 | // pagination |
| 5 | page, backendPageNumber, hasMore, |
| 6 | // app state |
| 7 | isError, isLoading, isFilterChanged, |
| 8 | // actions |
| 9 | setThreads, setDiscussions, setPage, setBackendPageNumber, fetchPostData, |
| 10 | } = useFrontpage(); |
Explanation (EN)
Objašnjenje (HR)