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 ruleP2stack specificStack: css
tailwindcssclsxreadability
Prefer plain class joining over tailwind-merge for conditional classes
Use a simple class-joining helper (clsx) and make responsive/conditional classes explicit instead of relying on tailwind-merge to silently resolve mutually exclusive utilities, which makes intent unclear and emits dead classes.
PR: hegnar-bellsheep-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | className={cn('block', isHidden && 'hidden')} // tailwind-merge picks a winner; intent hidden |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | className={clsx(!isHidden && 'block')} // intention is explicit, no useless class emitted |
Explanation (EN)
Objašnjenje (HR)