Conversation
Member
Author
|
@nikolai-shabalin ку-ку |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Synchronised with linthtml-config-htmlacademy#28 and codeguide#75. This is the rules side of the joint 2.0.0 release.
The package has been migrated to ESM (
type: "module", top-levelawait,importeverywhere). Node.js requirement is now>=24. Everything below describes changes to the rules themselves.New rules
Nine new rules cover gaps in form accessibility and SVG semantics:
htmlacademy/req-submit-button— every<form>must contain a submit button (<button type="submit">, default-type<button>,<input type="submit">, or an external submitter linked viaform="<id>"). Closes Правило: req-submit-button #40.htmlacademy/input-name-unique—<input>elements within the same<form>must have uniquenameattributes; radio and checkbox groups are exempt because they legitimately share a name. Closes Правило: input-name-unique #46.htmlacademy/heading-level— disallows skipping heading levels (<h1>→<h3>is flagged) and requires the document to start with<h1>. Returning to a higher level (<h3>→<h2>) is allowed. Closes Правило: heading-level #41.htmlacademy/label-req-for— every<label>must be associated with a labelable control either through afor/idreference or by containing the control inline. Emptyfor=""is explicitly allowed.htmlacademy/label-req-text—<label>must contain visible text content (or carry anaria-label);<label><input></label>without any text is flagged. Closes Правило: label-req-text #67.htmlacademy/icon-button-aria-label— a<button>without visible text content must declare an accessible name viaaria-label,aria-labelledby, ortitle. Covers icon-only buttons that would otherwise be invisible to screen readers. Addresses Проблема: button-req-content не видит aria-labelledby #80 (the upstreambutton-req-contentdoes not recognisearia-labelledby).htmlacademy/svg-role-img— inline<svg>must opt in either as content (role="img"+aria-label/aria-labelledby) or as decorative (aria-hidden="true"). Bare<svg>with content is flagged. Closes Правило: svg-role-img #53.htmlacademy/boolean-attr-no-value— disallows assigning a value to HTML boolean attributes (disabled,required,checked,readonly,multiple,selected,autofocus,hidden,open,async,defer,autoplay,controls,loop,muted,inert, …). Usesis_boolean_attributefrom@linthtml/dom-utilsso the list stays accurate.htmlacademy/attr-order— enforces attribute order via configurable groups. The default order matches the codeguide policy `class → src/href → data-* → others` and supports glob patterns like `data-`, `aria-`, and the catch-all `*`. Order inside a group is free.Renamed
htmlacademy/img-svg-req-dimensions→htmlacademy/replaced-elements-req-dimensions— the renamed rule now covers<img>,<svg>,<video>, and<iframe>(was<img>and<svg>only).Behaviour changes in existing rules
htmlacademy/a-target-rel— now requires onlyrel="noreferrer". Per the HTML spec,noreferrerimplicitly enablesnoopenerbehaviour, so a single keyword covers both the privacy concern (no `Referer` header) and the security concern (no `window.opener`). Previously the rule required `rel="noopener noreferrer"`.htmlacademy/req-webp-in-picture— now acceptsimage/avifas a modern alternative toimage/webpinside<picture>.htmlacademy/tag-forbid-attr— each forbidden entry now supports an optionalvalue(string orRegExp). Attributes can now be forbidden only when their value matches a specific pattern (e.g. disallowtype="text/css"on<link>while allowing othertypevalues).htmlacademy/no-px-size— extended to cover<video>and<iframe>in addition to<img>and<svg>. The error message now includes the offending tag name.htmlacademy/aria-label-misuse—aria-labelon<svg role="img">(orrole="image") is no longer flagged. Content SVG legitimately uses this pattern to expose its accessible name. Closes Проблема: aria-label-misuse не учитывает роли у svg #79.Bug fixes in existing rules
The following rules existed in the previous release but were effectively non-functional. They were activated in the published config yet never reported anything — fixed in this release:
htmlacademy/attribute-allowed-values— the body accessednode.name.charswhilenode.nameis a plain string. The conditionnode.name.chars in rule_configwas alwaysfalse, so the rule never executed. Now usesnode.name.htmlacademy/charset-position— the predicate!hasMeta && !hasUtf && !hasCharsetreported only when all three flags werefalse, which meant<meta name="viewport">(or any non-charset<meta>) was silently accepted as the first child of<head>. The rule now correctly requires the first element to be<meta>with acharsetattribute.htmlacademy/attr-req-value— crashed with aTypeErrorwhen activated without theignoreoption. Empty ignore list is now assumed.htmlacademy/input-req-label— issues reported viaend()used the bare nameinput-req-labelinstead of the namespacedhtmlacademy/input-req-label. Both code paths now use the namespaced name consistently.Closes