Skip to content

feat: enhance styling_preflight to run all 7 CSS validators#170

Merged
himerus merged 3 commits intodevfrom
feat/preflight-full-validation
Mar 21, 2026
Merged

feat: enhance styling_preflight to run all 7 CSS validators#170
himerus merged 3 commits intodevfrom
feat/preflight-full-validation

Conversation

@himerus
Copy link
Contributor

@himerus himerus commented Mar 21, 2026

Summary

  • styling_preflight was only running 2 of 7 CSS validators — agents calling it thought they were fully validated but were missing token fallbacks, scope, shorthand, color contrast, and specificity checks
  • Now runs all 7 CSS validators in a single call, catching the full range of styling anti-patterns
  • Refactors checkTokenFallbacks and checkCssScope to expose *FromMeta variants that accept ComponentMetadata directly, avoiding redundant CEM re-parsing

New validators added to preflight:

Validator What it catches
Token fallbacks var() without fallback values
Scope Component tokens on :root instead of host
Shorthand Risky shorthand + var() combinations
Color contrast Low-contrast color pairs
Specificity !important, ID selectors, deep nesting

Test plan

  • 22 preflight tests pass (6 new for added validators)
  • 23 scope-checker tests pass (existing, no regression)
  • 15 token-fallback-checker tests pass (existing, no regression)
  • 1790/1791 full suite passes (1 pre-existing cem-source-fidelity failure)

🤖 Generated with Claude Code

Previously styling_preflight only ran shadow DOM and theme
compatibility checks. Agents calling it thought they were fully
validated but were missing 5 critical checkers.

Now runs all CSS validators in a single call:
- Shadow DOM anti-patterns (existing)
- Theme compatibility (existing)
- Token fallbacks (NEW) — var() without fallbacks
- Scope validation (NEW) — tokens on :root not host
- Shorthand + var() (NEW) — risky combinations
- Color contrast (NEW) — low-contrast pairs
- CSS specificity (NEW) — !important, ID selectors

Also refactors token-fallback-checker and scope-checker to
expose *FromMeta variants that accept ComponentMetadata
directly, avoiding redundant CEM re-parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Warning

Rate limit exceeded

@himerus has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9a5eb6bd-52da-41b8-9d4c-fdc3e54311e5

📥 Commits

Reviewing files that changed from the base of the PR and between 65084c8 and a68fdf2.

📒 Files selected for processing (6)
  • .changeset/preflight-full-validation.md
  • custom-elements.json
  • packages/core/src/handlers/scope-checker.ts
  • packages/core/src/handlers/styling-preflight.ts
  • packages/core/src/handlers/token-fallback-checker.ts
  • tests/handlers/styling-preflight.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/preflight-full-validation

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@himerus himerus merged commit 4c100c0 into dev Mar 21, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant