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: any
testingreadabilitycode-organizationdeveloper-experience
Keep conditional code near its test fixtures for easy toggling
Place code that you flip on/off during testing right below the commented-out test data so a reviewer can switch states by editing one block.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codejavascript
| 1 | if (window.Header.user.accessLevel === 'anonymous') { appendRecaptchaScript(); } |
| 2 | // ... far below ... |
| 3 | // const testData = { ... }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | // const testData = { user: { accessLevel: 'anonymous' } }; |
| 2 | if (window.Header.user.accessLevel === 'anonymous') { appendRecaptchaScript(); } |
Explanation (EN)
Objašnjenje (HR)