feat: detect :root scope component tokens in shadow DOM checker#187
feat: detect :root scope component tokens in shadow DOM checker#187
Conversation
Agents frequently hallucinate :root { --component-token: value; } which has
no effect through Shadow DOM. Now detected by check_shadow_dom_usage (rule
no-root-scope-token), with concrete fixes via suggest_fix and inline fix
pipelines in styling_preflight and css-file-validator.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis pull request adds a new Changes
Sequence DiagramsequenceDiagram
participant CSS as CSS Source
participant Checker as Shadow DOM<br/>Checker
participant Preflight as Styling<br/>Preflight
participant FileVal as CSS File<br/>Validator
participant FixGen as Suggest<br/>Fix
CSS->>Checker: Scan for :root blocks<br/>with component tokens
Checker-->>Checker: Extract tokens &<br/>compute line numbers
Checker->>Preflight: Emit no-root-scope-token<br/>error with message
Preflight->>Preflight: Detect :root in<br/>error message
Preflight-->>FileVal: Classify as<br/>root-scope-token type
FileVal->>FileVal: Map to<br/>root-scope-token fix
FileVal->>FixGen: Route root-scope-token<br/>issue for fixing
FixGen->>FixGen: Extract token name<br/>& value from CSS
FixGen-->>CSS: Suggest moving token<br/>to component host
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The dark mode checker tool was registered on the server but missing from the expected tool list in the integration test, causing CI failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
no-root-scope-tokenrule tocheck_shadow_dom_usage— detects component CSS custom properties set on:rootwhich have no effect through Shadow DOM boundariesroot-scope-tokenfix tosuggestFix— generates concrete fix moving the token from:rootto the component host element:rootdetection intostyling_preflightandcss-file-validatorinline fix pipelines viadetectShadowDomIssueTypeWhy
Agents frequently hallucinate
:root { --sl-button-color: blue; }expecting it to style Shadow DOM internals. This is a no-op — component tokens must be set on the host element. Now caught and auto-fixed across all validation surfaces.Test plan
:rootdetection, multi-token, non-component token exclusion, var() values, no-meta skip, multi-block)hx-carouselphantom events failure)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
:rootthat don't take effect with Shadow DOM-based components:root-scoped tokens to component host elements:root-scoped tokens don't cross Shadow DOM boundaries