Conversation
Member
Author
|
@nikolai-shabalin ну гулять дк гулять |
| 'rules': { | ||
| 'htmlacademy/space-between-comments': [true, 'space'], | ||
| 'htmlacademy/a-target-rel': true, | ||
| 'htmlacademy/a-target-rel': false, // browsers add rel="noopener" automatically since 2020 |
| "linthtml" | ||
| ], | ||
| "license": "MIT", | ||
| "author": { |
Contributor
There was a problem hiding this comment.
Авторов можно указать несколько в массиве через запятую
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-rules-htmlacademy#115 and codeguide#75. This is the config side of the joint 2.0.0 release — what the default preset now expects from HTML.
The package has been migrated to ESM (
type: "module", configuration file renamedindex.js→linthtml.config.js). Node.js requirement is now>=24. Everything below describes how the default preset has changed.Newly activated rules
Ten plugin rules joined the preset, expanding its coverage of forms, accessibility, and modern HTML:
htmlacademy/a-target-rel—<a target="_blank">must declarerel="noreferrer". Per the HTML spec,noreferrerimplicitly enablesnoopener, so one keyword covers both privacy (noRefererheader) and security (nowindow.opener).htmlacademy/attr-order— enforces the codeguide attribute order `class → src/href → data-* → others`.htmlacademy/boolean-attr-no-value— boolean attributes (disabled,checked,required,autofocus,hidden,open,async,defer,autoplay,controls,loop,muted, …) must be written without a value.<input disabled>— yes,<input disabled="disabled">— no.htmlacademy/heading-level— heading levels must not skip (<h1>→<h3>is flagged) and the document must start with<h1>.htmlacademy/icon-button-aria-label—<button>without visible text must declare an accessible name viaaria-label,aria-labelledby, ortitle.htmlacademy/input-name-unique— duplicate<input name>within the same<form>is flagged; radio and checkbox groups are exempt.htmlacademy/label-req-for— every<label>must be associated with a form control either throughfor/idor through a nested control.htmlacademy/label-req-text—<label>must contain visible text content (oraria-label). Closes the<label for="x"><input id="x"></label>no-text loophole.htmlacademy/req-submit-button— every<form>must contain a submit button.htmlacademy/svg-role-img— inline<svg>must declare itself either as content (role="img"+aria-label/aria-labelledby) or as decorative (aria-hidden="true").htmlacademy/tag-forbid-attractivated with the redundant-typerule:<link type="text/css">and<script type="text/javascript">are flagged (these HTML4 defaults have not been required since HTML5).Replaced / removed
htmlacademy/img-svg-req-dimensions→htmlacademy/replaced-elements-req-dimensions— the renamed rule now covers<img>,<svg>,<video>, and<iframe>.htmlacademy/class-firstremoved from the preset — fully subsumed byhtmlacademy/attr-order(which checks the full attribute order, not only the position ofclass).button-req-content(base linthtml rule) removed from the preset — replaced byhtmlacademy/icon-button-aria-label, which is broader: it recognisesaria-label,aria-labelledby, andtitle, not just text content oraria-label. Eliminates the duplicate report on empty/icon-only buttons.Configuration adjustments to existing rules
htmlacademy/attribute-allowed-values.input.type— whitelist expanded from 11 to 22 entries, covering every HTML5<input type>value. The previous list was effectively a no-op because the rule itself was broken in the previous release (see linthtml-rules-htmlacademy#115); now that the rule actually executes, the policy is to allow every spec value and rely on other rules for narrower constraints.htmlacademy/tag-req-attr.form— added requirement for themethodattribute on<form>. Forms must now declaremethod="get"ormethod="post".htmlacademy/tag-self-close— set to[true, 'never']. In the previous release the rule was activated astrue(no option), which left it silent due to a missing-option early return in the rule body. The preset now actually flags<br/>,<img/>, and similar void self-closers.htmlacademy/no-px-size— extended to<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 because of inverted logic.htmlacademy/aria-label-misuse—aria-labelon<svg role="img">is no longer flagged. Content SVG legitimately uses this pattern.attr-name-ignore-regex(top-level option) — expanded to cover 42 camelCase SVG attributes (viewBox,preserveAspectRatio,xlink:href,gradientTransform,patternUnits,markerWidth,attributeName,stdDeviation,baseFrequency, …). Without this, theattr-name-style: dashrule reports valid SVG markup. Closes Актуализировать список атрибутов исключений SVG #19.htmlacademy/tag-name-lowercase.ignore— expanded to all SVG filter primitives (feBlend,feColorMatrix,feGaussianBlur, …) and other camelCase SVG tags (foreignObject,animateTransform,animateMotion).Behavioural summary
What used to pass on
mainbut no longer passes:What used to fail on
mainbut now passes:Cleanup
linthtml.config.jswas rewritten as a clean default preset. Dead*: falseentries for base rules that simply are not listed (linthtml ignores unlisted rules), redundant top-level options (id-class-ignore-regex,line-max-len-ignore-regex, strayspec-char-escape), and explanatory comments were removed. SVG tag/attribute lists and the input-type whitelist were extracted into named constants. Rules are sorted alphabetically inside each block. The file went from 180 to 116 lines.Closes