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 ruleP1universalStack: css
cssscopingshared-componentsmaintainability
Scope shared component styles by their owning element to avoid bleed
When the same subcomponent is reused in multiple hosts, scope its styles to a distinguishing parent selector so one host's overrides don't silently affect another.
PR: hegnar-components · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codecss
| 1 | .dropdown { ... } /* same global rules for every host that renders it */ |
Explanation (EN)
Objašnjenje (HR)
Good example
New codecss
| 1 | hegnar-news .dropdown { ... } |
| 2 | hegnar-watchlist .dropdown { ... } /* scoped per owning element */ |
Explanation (EN)
Objašnjenje (HR)