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 ruleP1universalStack: react
reactconditionalscorrectnessui
Gate decorative UI behind the specific condition it belongs to
Show a layout-specific decoration (e.g. a play icon) only when both the position AND the relevant type match, not for every variant.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | <div className={`${styles.content} ${isFirst && styles.first}`}> {/* .first adds a play icon for all types */} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const showPlayIcon = isFirst && layout === 'youtube'; |
| 2 | <div className={`${styles.content} ${showPlayIcon ? styles.first : ''}`}> |
Explanation (EN)
Objašnjenje (HR)