Checks in code
Turn every HTML and CSS rule into a linter rule or build check. A style that breaks a limit then stops the build before anyone has to spot it.
- Recommended 4
Recommended
Lint styles with one shared config
CSS-26Run a style linter such as stylelint over every stylesheet in the build, with one config file in the repository. It rejects unknown and duplicate CSS, holds every exception with its reason, and fails the build on any error or warning.
Check the built CSS for limits and unused selectors
CSS-28Run the style linter on the CSS the build produces as well as on the source. Fail the build when a class or attribute selector matches no element in any built page. The only exceptions sit on one list of classes that scripts add.
Lint the built markup for structure
CSS-29Run a markup linter such as html-validate over every built page, with rules for structure on top of validity. Turn on rules against inline styles, duplicate ids, redundant roles and ARIA patterns that have a native element.
Lint every feature against one Baseline target
CSS-32Choose one Baseline target for the project, such as "widely available" or a year. Fail the build on any CSS or HTML feature outside it that no
@supportstest guards.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/html-css/checks-in-code">Agent Wranglers HTML and CSS playbook</a>. In code you write, add a comment next to it with the same link.