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
scssduplicationstylingprops
Don't set a style in CSS that you already pass via a component prop
If a value (e.g. color) is supplied through a component prop, don't also hardcode it in the CSS module — the duplicate can drift.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codescss
| 1 | // JSX |
| 2 | <Typography color={colors.blue500} className={styles.text} /> |
| 3 | // CSS |
| 4 | .text { color: #1d4ed8; } /* duplicate of the prop */ |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | // JSX sets the color |
| 2 | <Typography color={colors.blue500} className={styles.text} /> |
| 3 | // CSS only handles layout, not color |
| 4 | .text { font-weight: 500; } |
Explanation (EN)
Objašnjenje (HR)