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 ruleP2project specificStack: css
css-modulesencapsulationpropscoupling
Define CSS classes in the module of the component that uses them
Keep a style class in the stylesheet of the component that consumes it rather than passing class strings down from a parent, which lets the prop become a clean boolean.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codetypescript
| 1 | // parent passes a class string down |
| 2 | <ReplyRow shouldShowBottomBorderRadius={styles.bottomBorderRadius} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // class lives in ReplyRow.module.scss; prop is a boolean |
| 2 | <ReplyRow shouldShowBottomBorderRadius={isLast} /> |
Explanation (EN)
Objašnjenje (HR)