Htmlhint Clean + HTML Collector
Enforce Htmlhint Clean using data collected by HTML Collector. Automatically check devex build and ci standards on every PR.
How HTML Collector Powers This Guardrail
The HTML Collector gathers metadata from your languages systems. This data flows into Lunar's Component JSON, where the Htmlhint Clean guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the HTML Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/html@v1.0.5
# with: ...
# Step 2: Enable the HTML/CSS Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/html@v1.0.5
include: [htmlhint-clean]
# with: ...
What HTML Collector Collects
This collector gathers the following data that the Htmlhint Clean guardrail evaluates.
project
Scans the repository for HTML and CSS-family files (.html, .css, .scss,
.less). Counts files of each type and writes a separate .lang.
htmlhint
Runs HTMLHint on all .html files to catch common issues: unclosed tags, missing attributes, accessibility problems. Writes normalized warnings to .lang.html.lint and raw output to .lang.html.native.htmlhint.
stylelint
Runs Stylelint on CSS, SCSS, and LESS files to catch invalid properties, formatting issues, and common mistakes. Writes normalized warnings to .lang.css.lint and raw output to .lang.css.native.stylelint.
Example Data Flow
Here's an example of the data that HTML Collector writes to the Component JSON, which Htmlhint Clean then evaluates.
{
"lang": {
"html": {
"file_count": 12,
"source": { "tool": "html", "integration": "code" },
"lint": {
"warnings": [
{
"file": "index.html",
"line": 15,
"severity": "warning",
"message": "Tag must be paired, missing: </div>",
"rule": "tag-pair"
}
],
"tool": "htmlhint",
"source": { "tool": "htmlhint", "integration": "code" }
},
"native": {
"htmlhint": {
"passed": false,
"error_count": 0,
"warning_count": 1,
"source": { "tool": "htmlhint", "integration": "code" }
}
}
},
"css": {
"file_count": 8,
"source": { "tool": "html", "integration": "code" },
"lint": {
"warnings": [
{
"file": "styles/main.css",
"line": 42,
"severity": "error",
"message": "Unexpected unknown property \"colr\"",
"rule": "property-no-unknown"
}
],
"tool": "stylelint",
"source": { "tool": "stylelint", "integration": "code" }
},
"native": {
"stylelint": {
"passed": false,
"error_count": 1,
"warning_count": 0,
"source": { "tool": "stylelint", "integration": "code" }
}
}
},
"scss": {
"file_count": 3,
"source": { "tool": "html", "integration": "code" }
},
"less": {
"file_count": 2,
"source": { "tool": "html", "integration": "code" }
}
}
}
Configuration Options
HTML/CSS Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
max_htmlhint_warnings |
Optional |
0
|
Maximum allowed HTMLHint warnings (0 = must be clean) |
max_stylelint_warnings |
Optional |
0
|
Maximum allowed Stylelint warnings (0 = must be clean) |
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.