HTML Collector
Detect HTML, CSS, SCSS, and LESS files, run HTMLHint and Stylelint for code quality analysis. Categorize frontend markup projects and surface lint issues for policy enforcement.
html to your lunar-config.yml:uses: github://earthly/lunar-lib/collectors/html@v1.0.5
What This Integration Collects
This integration includes 3 collectors that gather metadata from your systems.
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.
How Collectors Fit into Lunar
Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.
Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.
Learn How Lunar Works →Example Collected Data
This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:
{
"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" }
}
}
}
Documentation
View on GitHubHTML Collector
Detects and lints HTML, CSS, SCSS, and LESS files.
Overview
Scans repositories for HTML and CSS-family files, runs HTMLHint and Stylelint for code quality analysis. Writes file counts per type and lint results so policies can enforce markup quality standards. Runs in a custom html-main image with Node.js, HTMLHint, and Stylelint pre-installed.
Collected Data
This collector writes to the following Component JSON paths:
| Path | Type | Description |
|---|---|---|
.lang.html |
object | Present only if .html files found |
.lang.html.file_count |
number | Number of .html files in the repository |
.lang.html.lint |
object | Normalized HTMLHint lint warnings |
.lang.html.native.htmlhint |
object | Raw HTMLHint output and status |
.lang.css |
object | Present only if .css files found |
.lang.css.file_count |
number | Number of .css files |
.lang.css.lint |
object | Normalized Stylelint lint warnings (covers CSS/SCSS/LESS) |
.lang.css.native.stylelint |
object | Raw Stylelint output and status |
.lang.scss |
object | Present only if .scss files found |
.lang.scss.file_count |
number | Number of .scss files |
.lang.less |
object | Present only if .less files found |
.lang.less.file_count |
number | Number of .less files |
Collectors
This integration provides the following collectors (use include to select a subset):
| Collector | Hook Type | Description |
|---|---|---|
project |
code | Detects HTML/CSS/SCSS/LESS files, writes counts to .lang.html, .lang.css, .lang.scss, .lang.less |
htmlhint |
code | Runs HTMLHint on .html files, writes lint results to .lang.html.lint |
stylelint |
code | Runs Stylelint on CSS/SCSS/LESS files, writes lint results to .lang.css.lint |
Installation
Add to your lunar-config.yml:
collectors:
- uses: github://earthly/lunar-lib/collectors/html@v1.0.0
on: ["domain:your-domain"]
# include: [project, htmlhint] # Only include specific subcollectors
Open Source
This collector is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.
Common Use Cases
Explore guardrails that use data from HTML Collector.
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.