Skip to content

Releases: htmlacademy/linthtml-config-htmlacademy

v2.0.0

20 May 17:28
Immutable release. Only release title and notes can be modified.
v2.0.0

Choose a tag to compare

Breaking

  • Migrated to ESM. Configuration file renamed index.jslinthtml.config.js. Consumers extending the config by package name ("extends": "linthtml-config-htmlacademy" in .linthtmlrc) keep working through package.json#exports. Programmatic consumers (require('linthtml-config-htmlacademy')) must switch to import.
  • Renamed htmlacademy/img-svg-req-dimensionshtmlacademy/replaced-elements-req-dimensions (now covers <img>, <svg>, <video>, <iframe> — all replaced elements that benefit from explicit dimensions).
  • Node.js requirement bumped to >= 24.

Added

  • Activated htmlacademy/req-submit-button — every <form> must contain a submit button (<button type="submit">, <button> without type, <input type="submit">, or an external submitter linked via the form attribute). New rule, see linthtml-rules-htmlacademy#40.
  • Activated htmlacademy/label-req-for — every <label> must be associated with a labelable form control, either through for/id or through an inline descendant.
  • Activated htmlacademy/boolean-attr-no-value — boolean attributes (disabled, checked, required, autofocus, …) must be written without a value.
  • Activated htmlacademy/icon-button-aria-label — icon-only <button> elements (no visible text) must declare an accessible name via aria-label, aria-labelledby, or title. Addresses linthtml-rules-htmlacademy#80.
  • Activated htmlacademy/tag-forbid-attr with the redundant-type rule: <link type="text/css"> and <script type="text/javascript"> are flagged (these defaults have not been required since HTML5).
  • Activated htmlacademy/attr-order with the codeguide default class → src/href → data-* → others. Disabled htmlacademy/class-first in the same config to avoid duplicate reports — attr-order already enforces class as the first group.
  • Activated htmlacademy/input-name-unique — duplicate <input name> inside a single form is flagged (radio / checkbox groups exempt). New rule, see linthtml-rules-htmlacademy#46.
  • Activated htmlacademy/heading-level — heading-level skips and headings starting with anything other than <h1> are flagged. New rule, see linthtml-rules-htmlacademy#41.
  • Activated htmlacademy/label-req-text<label> without visible text content is flagged (covers the <label for="x"><input id="x"></label> anti-pattern that the existing label-req-for allowed). New rule, see linthtml-rules-htmlacademy#67.
  • Activated htmlacademy/svg-role-img — inline <svg> must opt in as content (role="img" + aria-label) or as decorative (aria-hidden="true"). New rule, see linthtml-rules-htmlacademy#53.
  • Activated htmlacademy/a-target-rel<a target="_blank"> must declare rel="noreferrer" (which per the HTML spec implies noopener). Brings the explicit codeguide policy into the preset; modern browsers already add noopener automatically, but the rule keeps the source self-documenting and blocks referrer leak in one keyword.
  • Expanded attr-name-ignore-regex to cover camelCase SVG attributes (viewBox, preserveAspectRatio, xlink:href, gradientTransform, patternUnits, markerWidth, attributeName, stdDeviation, baseFrequency, …). Without this, the dash-case attr-name-style rule reports valid SVG markup. Closes #19.
  • Expanded htmlacademy/tag-name-lowercase ignore list to all SVG filter primitives (feBlend, feColorMatrix, feGaussianBlur, …) and other camelCase SVG tags (foreignObject, animateTransform, animateMotion). Part of #19.
  • tag-req-attr.form: requires the method attribute on <form>.
  • tag-self-close: explicitly [true, 'never'].
  • node:test-based test suite under test/invalid/ for the most important policy decisions (label association, submit button, duplicate ids, boolean attribute values, icon-button accessibility, forbidden type attributes); fixtures in test/valid/ (catalog page, index page, forms page) must lint clean.

Changed

  • htmlacademy/attribute-allowed-values.input.type whitelist expanded to the full set of HTML5 <input type> values (was 11 entries, now 22). The previous list was effectively a no-op because the rule itself was broken upstream; now that the rule works, the policy is to allow every valid HTML5 input type and rely on other rules for narrower constraints.
  • htmlacademy/a-target-rel: the plugin rule now requires rel="noreferrer" (which per the HTML spec implies noopener). Enabled in this preset (see Added).
  • htmlacademy/no-px-size: now also covers <video> and <iframe> (was <img> and <svg> only).
  • htmlacademy/charset-position: fixed so it actually requires the first <head> child to be <meta charset>; previously any first <meta> (e.g. <meta name="viewport">) passed silently.
  • htmlacademy/aria-label-misuse: aria-label on <svg role="img"> no longer flagged — content SVG legitimately uses this pattern. See linthtml-rules-htmlacademy#79.
  • Disabled base button-req-content — replaced by htmlacademy/icon-button-aria-label, which is broader (recognises aria-label, aria-labelledby, and title, not just text or aria-label). Removes the duplicate report on empty/icon-only buttons.
  • Fixture test/valid/*.html updated to follow the new attr-order (href before rel, src before type) and the new svg-role-img (decorative <svg> now carries aria-hidden="true").

Known limitations

  • Base linthtml id-no-dup rule is disabled because of an upstream bug (linthtml/linthtml#469, open since 2022). The plugin rule htmlacademy/id-no-dup is enabled as a working replacement, so duplicate ids are still caught.

Migration notes

  • Replace any usage of htmlacademy/img-svg-req-dimensions with htmlacademy/replaced-elements-req-dimensions in project-level overrides.
  • If your .linthtmlrc points at node_modules/linthtml-config-htmlacademy/index.js directly, switch to "extends": "linthtml-config-htmlacademy" or to the new linthtml.config.js path.

1.0.25

28 May 08:25

Choose a tag to compare

Fixes req-webp-in-picture to not check <picture> if all <source> have attribute type="image/svg+xml".

1.0.24

23 May 20:25

Choose a tag to compare

  • Adds a req-tags-presence rule that requires the specified tags on the page.
  • Adds a req-preload-font rule that requires the preload value for the font.
  • Adds a req-webp-in-picture rule that requires webp in <picture>
  • Adds a no-class-in-container rule that checks the class attribute for child elements inside the specified container.
{
  "htmlacademy/req-tags-presence": [ true, ["header", "nav", "main", "section", "h1", "footer"]],
  "htmlacademy/req-preload-font": true,
  "htmlacademy/req-webp-in-picture": true,
  "htmlacademy/no-class-in-container": [true, {
    "containers": ["content"],
    "ignore": {
      "tags": ["h1", "p"],
      "classes": ["content__title"]
    }
  }]
}

1.0.23

19 May 08:10

Choose a tag to compare

Update dependencies. Adds a tag-forbid-attr rule that disallows the use of specified attributes on the specified tag.

1.0.22

17 May 08:00

Choose a tag to compare

Added a new rule htmlacademy/req-source-width-height that requires the width and height attributes of <source>, inside <picture>.

<picture>
  <source srcset="images/image-tablet.jpg" width="768" height="480" media="(min-width: 768px)">
  <img src="images/image-mobile.jpg" width="320" height="148" alt="">
</picture>

1.0.21

17 May 07:59

Choose a tag to compare

Clarifies the no-blocking-script rule for the <script> tag. You can now add modules to <head>.

<html lang="ru">
<head>
  <script src="app.js" type="module"></script>
</head>
<body></body>
</html>

v1.0.20

02 Apr 13:43

Choose a tag to compare

1.0.20

Updates the @linthtml/linthtml to the latest version

v1.0.19

23 Feb 10:35

Choose a tag to compare

1.0.19

Added a new rule htmlacademy/req-mailto, which requires mailto: for email-text links.

{
  "htmlacademy/req-mailto": true
}

v1.0.18

22 Feb 17:26

Choose a tag to compare

1.0.18

Added a new rule htmlacademy/req-stylesheet-link that checks for a link tag with the rel="stylesheet" attribute inside the head tag.

{
  "htmlacademy/req-stylesheet-link": true
}
<head>
  <link rel="stylesheet" href="styles/style.css">
</head> 

v1.0.17

21 Feb 18:58

Choose a tag to compare

1.0.17

'input': [
  {
    name: 'name',
    ignore: {
      'type': 'submit'
    }
  },
],