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
readabilityfile-organizationorderingclean-code
Define functions and methods before they are used in a file
Order declarations so a function appears before the code that calls it; reading top-to-bottom is easier than jumping around for definitions.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | run(); |
| 2 | function run() { helper(); } |
| 3 | function helper() {} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | function helper() {} |
| 2 | function run() { helper(); } |
| 3 | run(); |
Explanation (EN)
Objašnjenje (HR)