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
ab-testreadabilityseparation-of-concernscss
Keep AB-test variants separate instead of merging flags
Don't fold variants into a combined flag like isVarDE; keep distinct isVarD/isVarE states and let CSS group identical styling, for clearer logic.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | className={`${styles.card} ${isVarDE ? styles.isVarDE : ''}`} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | className={`${styles.card} ${isVarD ? styles.isVarD : ''} ${isVarE ? styles.isVarE : ''}`} |
| 2 | // scss: &.isVarD, &.isVarE { ...shared... } |
Explanation (EN)
Objašnjenje (HR)