@htmlacademy/linthtml-rules-htmlacademy
v2.0.0
Published
LintHTML Rules for HTML Academy CODEGUIDE
Readme
LintHTML Rules for HTML Academy Codeguide
Custom LintHTML rules for HTML markup validation according to HTML Academy Codeguide.
Requirements
- Node.js >= 24
@linthtml/linthtml>= 0.10.0
Installation
npm install -D @linthtml/linthtml linthtml-rules-htmlacademyUsage
Add the plugin to your .linthtmlrc configuration file:
{
"plugins": ["linthtml-rules-htmlacademy"],
"rules": {
"htmlacademy/tag-name-lowercase": true,
"htmlacademy/replaced-elements-req-dimensions": true
}
}Most consumers should extend the curated linthtml-config-htmlacademy instead — it activates every rule from this package with sensible defaults.
Rules
| Rule | Description |
| --- | --- |
| htmlacademy/a-target-rel | Requires rel="noopener" on <a target="_blank"> |
| htmlacademy/aria-label-misuse | Requires aria-label usage on specific elements only |
| htmlacademy/attr-delimiter | Disallows spaces around = in attributes |
| htmlacademy/attr-order | Enforces an attribute order using configurable groups (default: class → src/href → data-* → others) |
| htmlacademy/attr-req-value | Disallows empty attribute values except those in ignore list |
| htmlacademy/attribute-allowed-values | Validates attribute values against allowed values |
| htmlacademy/ban-url-spaces | Disallows spaces in href and src URLs |
| htmlacademy/boolean-attr-no-value | Disallows assigning a value to HTML boolean attributes (disabled, checked, …) |
| htmlacademy/charset-position | Requires <meta charset="…"> as the first element of <head> |
| htmlacademy/class-first | Requires class to be the first attribute (subset of attr-order; prefer attr-order for full coverage) |
| htmlacademy/form-action-attribute | Requires action attribute on <form> |
| htmlacademy/head-meta-charset | Requires <meta charset="utf-8"> in <head> |
| htmlacademy/heading-level | Disallows heading-level skips (<h1> → <h3>); document must start with <h1> |
| htmlacademy/icon-button-aria-label | Requires an accessible name on icon-only <button> elements |
| htmlacademy/id-no-dup | Disallows duplicate id values on page |
| htmlacademy/input-name-unique | Requires <input> names to be unique inside a <form> (radio / checkbox groups exempt) |
| htmlacademy/input-req-label | Requires label for input fields, allows aria-label |
| htmlacademy/label-req-for | Requires <label> to be associated with a form control |
| htmlacademy/label-req-text | Requires <label> to contain visible text content (or aria-label) |
| htmlacademy/link-req-content | Requires text content in <a> elements |
| htmlacademy/no-blocking-script | Validates script placement in markup |
| htmlacademy/no-class-in-container | Validates class attribute on children inside specified container |
| htmlacademy/no-double-br | Disallows consecutive <br> elements |
| htmlacademy/no-px-size | Requires width and height on <img>, <svg>, <video>, <iframe> to be integers without units |
| htmlacademy/replaced-elements-req-dimensions | Requires width and height on <img>, <svg>, <video>, <iframe> |
| htmlacademy/req-charset-utf | Requires UTF-8 for <meta charset=""> |
| htmlacademy/req-head-styles | Disallows stylesheets outside <head> |
| htmlacademy/req-mailto | Requires mailto: for links with email text |
| htmlacademy/req-meta-viewport | Requires <meta name="viewport"> in <head> |
| htmlacademy/req-preload-font | Requires font preload in <head> |
| htmlacademy/req-single-styles | Allows only one <link rel="stylesheet"> in <head> |
| htmlacademy/req-source-width-height | Requires width and height on <source> inside <picture> |
| htmlacademy/req-stylesheet-link | Requires <link rel="stylesheet"> with non-empty href |
| htmlacademy/req-submit-button | Requires every <form> to contain a submit button |
| htmlacademy/req-tags-presence | Requires specified tags on page |
| htmlacademy/req-webp-in-picture | Requires webp or avif format in <picture> |
| htmlacademy/section-has-heading | Requires heading element in <section> |
| htmlacademy/space-between-comments | Validates spaces in comments <!-- Comment --> |
| htmlacademy/svg-role-img | Content <svg> must have role="img" and an accessible name; decorative <svg> must use aria-hidden="true" |
| htmlacademy/tag-forbid-attr | Disallows specified attributes (optionally restricted by value) on specified tags |
| htmlacademy/tag-name-lowercase | Requires lowercase tag names |
| htmlacademy/tag-req-attr | Requires specified attributes on specified tags |
| htmlacademy/tag-self-close | Disallows self-closing void elements (<br> not <br/>) |
