Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
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.
Bad example
| 1 | .dialog { max-height: calc(100% - 160px); } |
Explanation (EN)
An unexplained subtraction hides which layout requirement must remain true.
Objašnjenje (HR)
Good example
| 1 | $dialog-vertical-inset: 160px; // 80px visual spacing above and below |
| 2 | .dialog { max-height: calc(100% - #{$dialog-vertical-inset}); } |
Explanation (EN)
The name and short rationale describe the actual layout spacing rather than implying device safe-area behavior.
Objašnjenje (HR)
Notes (EN)
When a layout literal encodes a non-obvious relationship, use a meaningful existing token or a short explanation of that relationship.
Exceptions / Tradeoffs (EN)
Do not describe ordinary visual spacing as an OS safe area unless it actually uses the device inset contract. Obvious local constants need no narrative comment.