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: React / CSS
drycomponentsstylesreuse
Put shared styles inside the reusable component, not at each call site
If two usages of a component repeat the same classes, move those common styles into the component itself so call sites only specify what differs.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <Tooltip className="rounded bg-gray-900 px-2 py-1 text-white" /> |
| 2 | <Tooltip className="rounded bg-gray-900 px-2 py-1 text-white" /> // repeated everywhere |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // styles live in Tooltip; call sites pass only differences |
| 2 | <Tooltip /> |
Explanation (EN)
Objašnjenje (HR)