Skip to main content

Module rules

Module rules 

Source
Expand description

Rule engine — the Rule trait and the built-in registry.

To add a new rule, see .agents/rules/rule-engine-patterns.md. The short version:

  1. Add a module under src/rules/ with a type implementing Rule.
  2. Register it in register_builtin.
  3. Add a golden snapshot test under tests/.
  4. Document it at docs/src/rules/<rule-id>.md.

Modules§

a11y
Accessibility rules.
baseline
Baseline-rhythm rules.
color
Color rules.
edge
Edge-alignment rules.
opacity
Opacity rules.
radius
Border-radius rules.
shadow
Box-shadow rules.
sibling
Sibling-relationship rules.
spacing
Spacing rules.
type_
Type-scale rules.
z
Z-index rules.

Structs§

RuleMetadata
Static metadata needed by output formats and rule listings.

Traits§

Rule
A rule — the fundamental unit of work in the engine.

Functions§

builtin_rule_metadata
Return metadata for every built-in rule, sorted by rule id.
register_builtin
Return every built-in rule in registration order. Registration order is not part of the public contract — the engine sorts the resulting violations by (rule_id, viewport, selector, dom_order) before return.