Skip to content

Feature: Verifier catches silent css declaration mistakes before render#2

Merged
jeffdlange merged 3 commits into
mainfrom
verifier
Jun 4, 2026
Merged

Feature: Verifier catches silent css declaration mistakes before render#2
jeffdlange merged 3 commits into
mainfrom
verifier

Conversation

@jeffdlange

Copy link
Copy Markdown
Collaborator

Summary

Adds ViewComponentCssDsl::Verifier, a fast static checker for component css declarations.

The DSL's failure modes are silent. The verifier catches them statically — fast enough to run on every edit, with no rendering required.

Details

  • Hallucinated classes: a typo'd or made-up Tailwind class produces no CSS at all under JIT; the CompiledCssOracle flags any declared class missing from the compiled build, which contains exactly the valid ones.
  • Render-time errors, moved to edit time: rules referencing undefined methods, axes nothing sets, self-conflicting declarations, and templates missing the html_attrs splat (sidecar, inline erb_template, and hand-written #call all covered) — plus a bare-instance smoke run of every axis-value combination.
  • One DSL touch: base css strings are now recorded as written, so self-conflicts are checkable before inheritance merging makes them invisible.

The six checks and usage are documented in the README. The verifier is an opt-in require; nothing loads at runtime by default.

The DSL's worst failures are silent — a hallucinated Tailwind class produces no
CSS at all under JIT. The verifier catches those at edit time, before render.

Added: ViewComponentCssDsl::Verifier — six static checks for component declarations: Tailwind class validity (via a compiled-CSS oracle), self-conflicting declarations, method-rule resolution, axis settability, variant-matrix smoke, and template html_attrs splat coverage
@jeffdlange jeffdlange marked this pull request as ready for review June 4, 2026 21:31
The library alone relies on devs remembering to run it; the README now ships
copy-pasteable enforcement: a CI-failing spec, a bin script, and a Claude Code hook.
@jeffdlange jeffdlange merged commit 0fd2b3d into main Jun 4, 2026
5 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