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: css
magic-numbersreadabilitydocumentation
Document magic numbers with a named constant or comment
Explain where a hardcoded number comes from, ideally by extracting it into a well-named constant.
PR: hegnar-components · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codecss
| 1 | .dialog { max-height: calc(100% - 160px); } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codecss
| 1 | // 160 = 80px top + 80px bottom safe-area padding |
| 2 | $dialog-vertical-inset: 160px; |
| 3 | .dialog { max-height: calc(100% - #{$dialog-vertical-inset}); } |
Explanation (EN)
Objašnjenje (HR)