Releases: htmlacademy/linthtml-config-htmlacademy
Releases · htmlacademy/linthtml-config-htmlacademy
v2.0.0
Breaking
- Migrated to ESM. Configuration file renamed
index.js→linthtml.config.js. Consumers extending the config by package name ("extends": "linthtml-config-htmlacademy"in.linthtmlrc) keep working throughpackage.json#exports. Programmatic consumers (require('linthtml-config-htmlacademy')) must switch toimport. - Renamed
htmlacademy/img-svg-req-dimensions→htmlacademy/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>withouttype,<input type="submit">, or an external submitter linked via theformattribute). New rule, see linthtml-rules-htmlacademy#40. - Activated
htmlacademy/label-req-for— every<label>must be associated with a labelable form control, either throughfor/idor 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 viaaria-label,aria-labelledby, ortitle. Addresses linthtml-rules-htmlacademy#80. - Activated
htmlacademy/tag-forbid-attrwith the redundant-typerule:<link type="text/css">and<script type="text/javascript">are flagged (these defaults have not been required since HTML5). - Activated
htmlacademy/attr-orderwith the codeguide defaultclass → src/href → data-* → others. Disabledhtmlacademy/class-firstin the same config to avoid duplicate reports —attr-orderalready enforcesclassas 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 existinglabel-req-forallowed). 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 declarerel="noreferrer"(which per the HTML spec impliesnoopener). Brings the explicit codeguide policy into the preset; modern browsers already addnoopenerautomatically, but the rule keeps the source self-documenting and blocks referrer leak in one keyword. - Expanded
attr-name-ignore-regexto cover camelCase SVG attributes (viewBox,preserveAspectRatio,xlink:href,gradientTransform,patternUnits,markerWidth,attributeName,stdDeviation,baseFrequency, …). Without this, the dash-caseattr-name-stylerule reports valid SVG markup. Closes #19. - Expanded
htmlacademy/tag-name-lowercaseignorelist to all SVG filter primitives (feBlend,feColorMatrix,feGaussianBlur, …) and other camelCase SVG tags (foreignObject,animateTransform,animateMotion). Part of #19. tag-req-attr.form: requires themethodattribute on<form>.tag-self-close: explicitly[true, 'never'].node:test-based test suite undertest/invalid/for the most important policy decisions (label association, submit button, duplicate ids, boolean attribute values, icon-button accessibility, forbiddentypeattributes); fixtures intest/valid/(catalog page, index page, forms page) must lint clean.
Changed
htmlacademy/attribute-allowed-values.input.typewhitelist 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 requiresrel="noreferrer"(which per the HTML spec impliesnoopener). 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-labelon<svg role="img">no longer flagged — content SVG legitimately uses this pattern. See linthtml-rules-htmlacademy#79.- Disabled base
button-req-content— replaced byhtmlacademy/icon-button-aria-label, which is broader (recognisesaria-label,aria-labelledby, andtitle, not just text oraria-label). Removes the duplicate report on empty/icon-only buttons. - Fixture
test/valid/*.htmlupdated to follow the newattr-order(hrefbeforerel,srcbeforetype) and the newsvg-role-img(decorative<svg>now carriesaria-hidden="true").
Known limitations
- Base linthtml
id-no-duprule is disabled because of an upstream bug (linthtml/linthtml#469, open since 2022). The plugin rulehtmlacademy/id-no-dupis enabled as a working replacement, so duplicate ids are still caught.
Migration notes
- Replace any usage of
htmlacademy/img-svg-req-dimensionswithhtmlacademy/replaced-elements-req-dimensionsin project-level overrides. - If your
.linthtmlrcpoints atnode_modules/linthtml-config-htmlacademy/index.jsdirectly, switch to"extends": "linthtml-config-htmlacademy"or to the newlinthtml.config.jspath.
1.0.25
Fixes req-webp-in-picture to not check <picture> if all <source> have attribute type="image/svg+xml".
1.0.24
- Adds a
req-tags-presencerule that requires the specified tags on the page. - Adds a
req-preload-fontrule that requires thepreloadvalue for the font. - Adds a
req-webp-in-picturerule that requireswebpin<picture> - Adds a
no-class-in-containerrule that checks theclassattribute 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
Update dependencies. Adds a tag-forbid-attr rule that disallows the use of specified attributes on the specified tag.
1.0.22
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
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
1.0.20
Updates the @linthtml/linthtml to the latest version
v1.0.19
1.0.19
Added a new rule htmlacademy/req-mailto, which requires mailto: for email-text links.
{
"htmlacademy/req-mailto": true
}v1.0.18
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
1.0.17
- Excludes the
<input type="submit">check from the input-req-label rule. - Adds
ignoreoption for tag-req-attr
'input': [
{
name: 'name',
ignore: {
'type': 'submit'
}
},
],