@markuplint/rules 5.0.0-rc.2 → 5.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/CLAUDE.md +31 -2
- package/lib/{wai-aria-deprecated-role → aria-prop-requires-role}/index.d.ts +0 -1
- package/lib/{wai-aria-no-global-prop → aria-prop-requires-role}/index.js +0 -1
- package/lib/attr-check.d.ts +0 -48
- package/lib/attr-check.js +0 -36
- package/lib/attr-eligibility.d.ts +41 -0
- package/lib/attr-eligibility.js +60 -0
- package/lib/attr-value-quotes/index.d.ts +0 -7
- package/lib/attr-value-quotes/index.js +0 -7
- package/lib/attr-value-quotes/meta.d.ts +0 -1
- package/lib/attr-value-quotes/meta.js +0 -1
- package/lib/case-sensitive-attr-name/index.d.ts +0 -8
- package/lib/case-sensitive-attr-name/index.js +0 -8
- package/lib/case-sensitive-attr-name/meta.d.ts +0 -1
- package/lib/case-sensitive-attr-name/meta.js +0 -1
- package/lib/case-sensitive-tag-name/index.d.ts +0 -8
- package/lib/case-sensitive-tag-name/index.js +0 -8
- package/lib/case-sensitive-tag-name/meta.d.ts +0 -1
- package/lib/case-sensitive-tag-name/meta.js +0 -1
- package/lib/class-naming/index.d.ts +0 -8
- package/lib/class-naming/index.js +0 -8
- package/lib/class-naming/meta.d.ts +1 -2
- package/lib/class-naming/meta.js +1 -2
- package/lib/consistent-table-row-length/index.d.ts +14 -0
- package/lib/consistent-table-row-length/index.js +69 -0
- package/lib/consistent-table-row-length/meta.d.ts +4 -0
- package/lib/consistent-table-row-length/meta.js +3 -0
- package/lib/create-message.d.ts +2 -25
- package/lib/create-message.js +2 -53
- package/lib/debug.d.ts +1 -9
- package/lib/debug.js +1 -5
- package/lib/element-supports-aria-prop/index.d.ts +12 -0
- package/lib/element-supports-aria-prop/index.js +38 -0
- package/lib/form-attr-references-form/index.d.ts +12 -0
- package/lib/form-attr-references-form/index.js +64 -0
- package/lib/{correct-aspect-ratio → form-attr-references-form}/meta.d.ts +1 -1
- package/lib/form-attr-references-form/meta.js +3 -0
- package/lib/head-element-order/meta.d.ts +1 -1
- package/lib/head-element-order/meta.js +1 -1
- package/lib/helpers.d.ts +8 -138
- package/lib/helpers.js +24 -165
- package/lib/index.d.ts +135 -78
- package/lib/index.js +167 -82
- package/lib/input-list-references-datalist/index.d.ts +13 -0
- package/lib/input-list-references-datalist/index.js +46 -0
- package/lib/input-list-references-datalist/meta.d.ts +4 -0
- package/lib/input-list-references-datalist/meta.js +3 -0
- package/lib/itemprop-requires-itemscope/index.d.ts +21 -0
- package/lib/itemprop-requires-itemscope/index.js +53 -0
- package/lib/itemprop-requires-itemscope/meta.d.ts +4 -0
- package/lib/itemprop-requires-itemscope/meta.js +3 -0
- package/lib/label-for-references-labelable/index.d.ts +12 -0
- package/lib/label-for-references-labelable/index.js +68 -0
- package/lib/label-for-references-labelable/meta.d.ts +4 -0
- package/lib/label-for-references-labelable/meta.js +3 -0
- package/lib/label-has-control/index.d.ts +5 -5
- package/lib/label-has-control/index.js +5 -18
- package/lib/label-has-control/meta.d.ts +0 -1
- package/lib/label-has-control/meta.js +0 -1
- package/lib/label-no-multiple-controls/index.d.ts +31 -0
- package/lib/label-no-multiple-controls/index.js +104 -0
- package/lib/label-no-multiple-controls/meta.d.ts +4 -0
- package/lib/label-no-multiple-controls/meta.js +3 -0
- package/lib/landmark-roles/roles.d.ts +32 -0
- package/lib/landmark-roles/roles.js +73 -0
- package/lib/link-types/index.d.ts +0 -5
- package/lib/link-types/index.js +5 -6
- package/lib/link-types/meta.d.ts +1 -2
- package/lib/link-types/meta.js +1 -2
- package/lib/map-id-name-match/index.d.ts +10 -0
- package/lib/map-id-name-match/index.js +39 -0
- package/lib/map-id-name-match/meta.d.ts +4 -0
- package/lib/map-id-name-match/meta.js +3 -0
- package/lib/meta-charset-position/index.d.ts +15 -0
- package/lib/meta-charset-position/index.js +31 -0
- package/lib/meta-charset-position/meta.d.ts +4 -0
- package/lib/meta-charset-position/meta.js +3 -0
- package/lib/meter-value-bounds/index.d.ts +10 -0
- package/lib/meter-value-bounds/index.js +123 -0
- package/lib/meter-value-bounds/meta.d.ts +4 -0
- package/lib/meter-value-bounds/meta.js +3 -0
- package/lib/{wai-aria-required-props → no-abstract-role}/index.d.ts +0 -1
- package/lib/{wai-aria-abstract-role → no-abstract-role}/index.js +0 -1
- package/lib/no-always-matching-source/index.d.ts +13 -0
- package/lib/no-always-matching-source/index.js +100 -0
- package/lib/no-always-matching-source/meta.d.ts +4 -0
- package/lib/no-always-matching-source/meta.js +3 -0
- package/lib/no-ambiguous-navigable-target-names/index.d.ts +0 -8
- package/lib/no-ambiguous-navigable-target-names/index.js +0 -8
- package/lib/no-ambiguous-navigable-target-names/meta.d.ts +1 -2
- package/lib/no-ambiguous-navigable-target-names/meta.js +1 -2
- package/lib/{wai-aria-required-owned-elements → no-aria-on-presentational-children}/index.d.ts +0 -1
- package/lib/{wai-aria-presentational-children → no-aria-on-presentational-children}/index.js +0 -1
- package/lib/no-aria-on-unsupported-element/index.d.ts +11 -0
- package/lib/no-aria-on-unsupported-element/index.js +35 -0
- package/lib/no-aria-on-unsupported-element/meta.d.ts +9 -0
- package/lib/no-aria-on-unsupported-element/meta.js +8 -0
- package/lib/no-boolean-attr-value/index.d.ts +0 -7
- package/lib/no-boolean-attr-value/index.js +0 -7
- package/lib/no-boolean-attr-value/meta.d.ts +0 -1
- package/lib/no-boolean-attr-value/meta.js +0 -1
- package/lib/no-broken-fragment-link/index.d.ts +15 -0
- package/lib/no-broken-fragment-link/index.js +93 -0
- package/lib/no-broken-fragment-link/meta.d.ts +4 -0
- package/lib/no-broken-fragment-link/meta.js +3 -0
- package/lib/no-consecutive-br/index.d.ts +0 -8
- package/lib/no-consecutive-br/index.js +0 -8
- package/lib/no-consecutive-br/meta.d.ts +0 -1
- package/lib/no-consecutive-br/meta.js +0 -1
- package/lib/no-content-after-body/index.d.ts +25 -0
- package/lib/no-content-after-body/index.js +51 -0
- package/lib/no-content-after-body/meta.d.ts +4 -0
- package/lib/no-content-after-body/meta.js +3 -0
- package/lib/no-contradictory-aria-prop/index.d.ts +10 -0
- package/lib/no-contradictory-aria-prop/index.js +34 -0
- package/lib/{wai-aria-abstract-role → no-default-aria-value}/index.d.ts +0 -1
- package/lib/{wai-aria-default-value → no-default-aria-value}/index.js +0 -1
- package/lib/no-default-value/index.d.ts +0 -7
- package/lib/no-default-value/index.js +0 -7
- package/lib/no-default-value/meta.d.ts +0 -1
- package/lib/no-default-value/meta.js +0 -1
- package/lib/no-deprecated-aria-prop/index.d.ts +3 -0
- package/lib/{wai-aria-deprecated-props → no-deprecated-aria-prop}/index.js +0 -1
- package/lib/no-deprecated-attr/index.d.ts +2 -0
- package/lib/{deprecated-attr → no-deprecated-attr}/index.js +5 -9
- package/lib/no-deprecated-attr/meta.d.ts +4 -0
- package/lib/no-deprecated-attr/meta.js +3 -0
- package/lib/no-deprecated-element/index.d.ts +2 -0
- package/lib/no-deprecated-element/index.js +27 -0
- package/lib/no-deprecated-element/meta.d.ts +4 -0
- package/lib/no-deprecated-element/meta.js +3 -0
- package/lib/no-deprecated-role/index.d.ts +3 -0
- package/lib/{wai-aria-deprecated-role → no-deprecated-role}/index.js +0 -1
- package/lib/no-disallowed-ancestor/index.d.ts +2 -0
- package/lib/no-disallowed-ancestor/index.js +25 -0
- package/lib/no-disallowed-ancestor/meta.d.ts +4 -0
- package/lib/no-disallowed-ancestor/meta.js +3 -0
- package/lib/no-disallowed-attr/index.d.ts +28 -0
- package/lib/no-disallowed-attr/index.js +77 -0
- package/lib/no-disallowed-attr/meta.d.ts +4 -0
- package/lib/no-disallowed-attr/meta.js +3 -0
- package/lib/no-duplicate-attr/index.d.ts +2 -0
- package/lib/{attr-duplication → no-duplicate-attr}/index.js +0 -7
- package/lib/no-duplicate-attr/meta.d.ts +6 -0
- package/lib/no-duplicate-attr/meta.js +10 -0
- package/lib/no-duplicate-autofocus/index.d.ts +0 -5
- package/lib/no-duplicate-autofocus/index.js +20 -6
- package/lib/no-duplicate-autofocus/meta.d.ts +1 -1
- package/lib/no-duplicate-autofocus/meta.js +1 -1
- package/lib/no-duplicate-dt/index.d.ts +0 -6
- package/lib/no-duplicate-dt/index.js +1 -6
- package/lib/no-duplicate-dt/meta.d.ts +1 -2
- package/lib/no-duplicate-dt/meta.js +1 -2
- package/lib/no-duplicate-h1/index.d.ts +18 -0
- package/lib/no-duplicate-h1/index.js +41 -0
- package/lib/no-duplicate-h1/meta.d.ts +4 -0
- package/lib/no-duplicate-h1/meta.js +3 -0
- package/lib/no-duplicate-id/index.d.ts +2 -0
- package/lib/{id-duplication → no-duplicate-id}/index.js +0 -7
- package/lib/no-duplicate-id/meta.d.ts +4 -0
- package/lib/no-duplicate-id/meta.js +3 -0
- package/lib/no-duplicate-sibling-attr/index.d.ts +2 -0
- package/lib/no-duplicate-sibling-attr/index.js +35 -0
- package/lib/no-duplicate-sibling-attr/meta.d.ts +4 -0
- package/lib/no-duplicate-sibling-attr/meta.js +3 -0
- package/lib/no-duplicate-visible-main/index.d.ts +0 -1
- package/lib/no-duplicate-visible-main/index.js +0 -1
- package/lib/no-duplicate-visible-main/meta.d.ts +1 -1
- package/lib/no-duplicate-visible-main/meta.js +1 -1
- package/lib/no-empty-palpable-content/index.d.ts +0 -8
- package/lib/no-empty-palpable-content/index.js +0 -8
- package/lib/no-empty-palpable-content/meta.d.ts +1 -2
- package/lib/no-empty-palpable-content/meta.js +1 -2
- package/lib/no-empty-table-track/index.d.ts +12 -0
- package/lib/no-empty-table-track/index.js +42 -0
- package/lib/no-empty-table-track/meta.d.ts +4 -0
- package/lib/no-empty-table-track/meta.js +3 -0
- package/lib/no-event-handler-attr/index.d.ts +7 -0
- package/lib/{no-use-event-handler-attr → no-event-handler-attr}/index.js +0 -11
- package/lib/no-event-handler-attr/meta.d.ts +4 -0
- package/lib/no-event-handler-attr/meta.js +3 -0
- package/lib/no-experimental-features/index.d.ts +9 -0
- package/lib/no-experimental-features/index.js +53 -0
- package/lib/no-experimental-features/meta.d.ts +4 -0
- package/lib/no-experimental-features/meta.js +3 -0
- package/lib/no-extra-selected-options/index.d.ts +10 -0
- package/lib/no-extra-selected-options/index.js +37 -0
- package/lib/no-extra-selected-options/meta.d.ts +4 -0
- package/lib/no-extra-selected-options/meta.js +3 -0
- package/lib/no-focusable-in-aria-hidden/index.d.ts +3 -0
- package/lib/{wai-aria-interaction-in-hidden → no-focusable-in-aria-hidden}/index.js +0 -1
- package/lib/no-focusable-in-aria-hidden/meta.d.ts +4 -0
- package/lib/no-focusable-in-aria-hidden/meta.js +3 -0
- package/lib/no-hardcoded-id/index.d.ts +2 -0
- package/lib/{no-hard-code-id → no-hardcoded-id}/index.js +0 -8
- package/lib/no-hardcoded-id/meta.d.ts +4 -0
- package/lib/no-hardcoded-id/meta.js +3 -0
- package/lib/no-ineffective-attr/index.d.ts +2 -0
- package/lib/{ineffective-attr → no-ineffective-attr}/index.js +0 -7
- package/lib/no-ineffective-attr/meta.d.ts +5 -0
- package/lib/no-ineffective-attr/meta.js +4 -0
- package/lib/no-input-file-value/index.d.ts +10 -0
- package/lib/no-input-file-value/index.js +41 -0
- package/lib/no-input-file-value/meta.d.ts +4 -0
- package/lib/no-input-file-value/meta.js +3 -0
- package/lib/no-invalid-aria-prop-value/index.d.ts +3 -0
- package/lib/{wai-aria-value → no-invalid-aria-prop-value}/index.js +0 -1
- package/lib/no-invalid-aria-prop-value/meta.d.ts +4 -0
- package/lib/no-invalid-aria-prop-value/meta.js +3 -0
- package/lib/no-invalid-attr-value/index.d.ts +27 -0
- package/lib/no-invalid-attr-value/index.js +83 -0
- package/lib/no-invalid-attr-value/meta.d.ts +4 -0
- package/lib/no-invalid-attr-value/meta.js +3 -0
- package/lib/no-malformed-character-reference/index.d.ts +2 -0
- package/lib/no-malformed-character-reference/index.js +38 -0
- package/lib/no-malformed-character-reference/meta.d.ts +5 -0
- package/lib/no-malformed-character-reference/meta.js +20 -0
- package/lib/{correct-aspect-ratio → no-mismatched-aspect-ratio}/index.js +13 -3
- package/lib/no-mismatched-aspect-ratio/meta.d.ts +4 -0
- package/lib/no-mismatched-aspect-ratio/meta.js +3 -0
- package/lib/{correct-aspect-ratio → no-mismatched-aspect-ratio}/resolve-image-size.js +8 -2
- package/lib/no-mixed-srcset-descriptors/index.d.ts +12 -0
- package/lib/no-mixed-srcset-descriptors/index.js +47 -0
- package/lib/no-mixed-srcset-descriptors/meta.d.ts +4 -0
- package/lib/no-mixed-srcset-descriptors/meta.js +3 -0
- package/lib/no-nested-top-level-landmark/index.d.ts +10 -0
- package/lib/no-nested-top-level-landmark/index.js +52 -0
- package/lib/no-nested-top-level-landmark/meta.d.ts +4 -0
- package/lib/no-nested-top-level-landmark/meta.js +3 -0
- package/lib/no-nonstandard-features/index.d.ts +9 -0
- package/lib/no-nonstandard-features/index.js +53 -0
- package/lib/no-nonstandard-features/meta.d.ts +4 -0
- package/lib/no-nonstandard-features/meta.js +3 -0
- package/lib/no-obsolete-attr/index.d.ts +2 -0
- package/lib/no-obsolete-attr/index.js +27 -0
- package/lib/no-obsolete-attr/meta.d.ts +4 -0
- package/lib/no-obsolete-attr/meta.js +3 -0
- package/lib/no-obsolete-doctype/index.d.ts +2 -0
- package/lib/{doctype → no-obsolete-doctype}/index.js +9 -16
- package/lib/no-obsolete-doctype/meta.d.ts +4 -0
- package/lib/no-obsolete-doctype/meta.js +3 -0
- package/lib/no-obsolete-element/index.d.ts +2 -0
- package/lib/{deprecated-element → no-obsolete-element}/index.js +6 -10
- package/lib/no-obsolete-element/meta.d.ts +4 -0
- package/lib/no-obsolete-element/meta.js +3 -0
- package/lib/no-orphaned-end-tag/index.d.ts +0 -7
- package/lib/no-orphaned-end-tag/index.js +0 -7
- package/lib/no-orphaned-end-tag/meta.d.ts +2 -2
- package/lib/no-orphaned-end-tag/meta.js +5 -2
- package/lib/no-prohibited-naming/index.d.ts +8 -0
- package/lib/no-prohibited-naming/index.js +36 -0
- package/lib/no-prohibited-naming/meta.d.ts +4 -0
- package/lib/no-prohibited-naming/meta.js +3 -0
- package/lib/{use-list → no-pseudo-list}/index.d.ts +1 -8
- package/lib/{use-list → no-pseudo-list}/index.js +0 -7
- package/lib/no-pseudo-list/meta.d.ts +4 -0
- package/lib/no-pseudo-list/meta.js +3 -0
- package/lib/{redundant-accessible-name → no-redundant-accessible-name}/index.d.ts +0 -4
- package/lib/{redundant-accessible-name → no-redundant-accessible-name}/index.js +0 -4
- package/lib/no-redundant-accessible-name/meta.d.ts +4 -0
- package/lib/no-redundant-accessible-name/meta.js +3 -0
- package/lib/no-redundant-aria-prop/index.d.ts +10 -0
- package/lib/{wai-aria-implicit-props → no-redundant-aria-prop}/index.js +9 -3
- package/lib/no-redundant-aria-prop/meta.d.ts +4 -0
- package/lib/no-redundant-aria-prop/meta.js +3 -0
- package/lib/no-redundant-role/index.d.ts +3 -0
- package/lib/{wai-aria-implicit-role → no-redundant-role}/index.js +0 -1
- package/lib/no-redundant-role/meta.d.ts +4 -0
- package/lib/no-redundant-role/meta.js +3 -0
- package/lib/no-refer-to-non-existent-id/index.d.ts +0 -9
- package/lib/no-refer-to-non-existent-id/index.js +1 -62
- package/lib/no-refer-to-non-existent-id/meta.d.ts +1 -2
- package/lib/no-refer-to-non-existent-id/meta.js +1 -2
- package/lib/no-restricted-attr/index.d.ts +27 -0
- package/lib/no-restricted-attr/index.js +96 -0
- package/lib/no-restricted-attr/meta.d.ts +4 -0
- package/lib/no-restricted-attr/meta.js +3 -0
- package/lib/no-restricted-element/index.d.ts +2 -0
- package/lib/{disallowed-element → no-restricted-element}/index.js +7 -8
- package/lib/no-restricted-element/meta.d.ts +4 -0
- package/lib/no-restricted-element/meta.js +3 -0
- package/lib/no-skipped-heading-level/index.d.ts +13 -0
- package/lib/{heading-levels → no-skipped-heading-level}/index.js +10 -5
- package/lib/no-skipped-heading-level/meta.d.ts +4 -0
- package/lib/no-skipped-heading-level/meta.js +3 -0
- package/lib/no-stray-head-or-body-tag/index.d.ts +28 -0
- package/lib/no-stray-head-or-body-tag/index.js +61 -0
- package/lib/no-stray-head-or-body-tag/meta.d.ts +4 -0
- package/lib/no-stray-head-or-body-tag/meta.js +3 -0
- package/lib/no-table-cell-overlap/index.d.ts +12 -0
- package/lib/no-table-cell-overlap/index.js +30 -0
- package/lib/no-table-cell-overlap/meta.d.ts +4 -0
- package/lib/no-table-cell-overlap/meta.js +3 -0
- package/lib/no-table-span-overflow/index.d.ts +12 -0
- package/lib/no-table-span-overflow/index.js +37 -0
- package/lib/no-table-span-overflow/meta.d.ts +4 -0
- package/lib/no-table-span-overflow/meta.js +3 -0
- package/lib/no-unclosed-element-at-eof/index.d.ts +2 -0
- package/lib/no-unclosed-element-at-eof/index.js +86 -0
- package/lib/no-unclosed-element-at-eof/meta.d.ts +4 -0
- package/lib/no-unclosed-element-at-eof/meta.js +3 -0
- package/lib/no-unescaped-char/index.d.ts +14 -0
- package/lib/{character-reference → no-unescaped-char}/index.js +31 -20
- package/lib/no-unescaped-char/meta.d.ts +4 -0
- package/lib/no-unescaped-char/meta.js +3 -0
- package/lib/{invalid-attr → no-unknown-attr}/index.d.ts +4 -19
- package/lib/no-unknown-attr/index.js +91 -0
- package/lib/no-unknown-attr/meta.d.ts +4 -0
- package/lib/no-unknown-attr/meta.js +3 -0
- package/lib/no-unknown-role/index.d.ts +3 -0
- package/lib/{wai-aria-non-existent-role → no-unknown-role}/index.js +0 -1
- package/lib/no-unknown-role/meta.d.ts +4 -0
- package/lib/no-unknown-role/meta.js +3 -0
- package/lib/no-unpaired-srcset-sizes/index.d.ts +12 -0
- package/lib/no-unpaired-srcset-sizes/index.js +77 -0
- package/lib/no-unpaired-srcset-sizes/meta.d.ts +4 -0
- package/lib/no-unpaired-srcset-sizes/meta.js +3 -0
- package/lib/{no-unsupported-features → no-unsupported-browser-features}/index.d.ts +1 -10
- package/lib/no-unsupported-browser-features/index.js +81 -0
- package/lib/no-unsupported-browser-features/meta.d.ts +4 -0
- package/lib/no-unsupported-browser-features/meta.js +3 -0
- package/lib/permitted-contents/index.d.ts +0 -18
- package/lib/permitted-contents/index.js +0 -78
- package/lib/permitted-contents/meta.d.ts +1 -2
- package/lib/permitted-contents/meta.js +1 -2
- package/lib/permitted-contents/represent-transparent-nodes.js +15 -6
- package/lib/permitted-roles/index.d.ts +3 -0
- package/lib/{wai-aria-permitted-roles → permitted-roles}/index.js +0 -1
- package/lib/permitted-roles/meta.d.ts +4 -0
- package/lib/permitted-roles/meta.js +3 -0
- package/lib/placeholder-label-option/index.d.ts +10 -4
- package/lib/placeholder-label-option/index.js +30 -17
- package/lib/placeholder-label-option/meta.d.ts +1 -2
- package/lib/placeholder-label-option/meta.js +1 -2
- package/lib/progress-value-bounds/index.d.ts +10 -0
- package/lib/progress-value-bounds/index.js +59 -0
- package/lib/progress-value-bounds/meta.d.ts +4 -0
- package/lib/progress-value-bounds/meta.js +3 -0
- package/lib/require-accessible-name/index.d.ts +0 -7
- package/lib/require-accessible-name/index.js +0 -7
- package/lib/require-accessible-name/meta.d.ts +0 -1
- package/lib/require-accessible-name/meta.js +0 -1
- package/lib/require-adjacent-popover/index.d.ts +2 -0
- package/lib/{neighbor-popovers → require-adjacent-popover}/index.js +1 -8
- package/lib/require-adjacent-popover/meta.d.ts +4 -0
- package/lib/require-adjacent-popover/meta.js +3 -0
- package/lib/require-ancestor/index.d.ts +2 -0
- package/lib/require-ancestor/index.js +29 -0
- package/lib/require-ancestor/meta.d.ts +4 -0
- package/lib/require-ancestor/meta.js +3 -0
- package/lib/require-aria-prop/index.d.ts +3 -0
- package/lib/{wai-aria-required-props → require-aria-prop}/index.js +0 -1
- package/lib/require-aria-prop/meta.d.ts +4 -0
- package/lib/require-aria-prop/meta.js +3 -0
- package/lib/{required-attr → require-attr}/index.d.ts +2 -9
- package/lib/{required-attr → require-attr}/index.js +0 -7
- package/lib/require-attr/meta.d.ts +4 -0
- package/lib/require-attr/meta.js +3 -0
- package/lib/require-datetime/index.d.ts +0 -8
- package/lib/require-datetime/index.js +0 -8
- package/lib/require-datetime/meta.d.ts +1 -2
- package/lib/require-datetime/meta.js +1 -2
- package/lib/require-dialog-autofocus/index.d.ts +0 -10
- package/lib/require-dialog-autofocus/index.js +0 -10
- package/lib/require-dialog-autofocus/meta.d.ts +0 -1
- package/lib/require-dialog-autofocus/meta.js +0 -1
- package/lib/require-doctype/index.d.ts +2 -0
- package/lib/require-doctype/index.js +19 -0
- package/lib/require-doctype/meta.d.ts +5 -0
- package/lib/require-doctype/meta.js +10 -0
- package/lib/{required-element → require-element}/index.d.ts +1 -9
- package/lib/{required-element → require-element}/index.js +0 -8
- package/lib/require-element/meta.d.ts +4 -0
- package/lib/require-element/meta.js +3 -0
- package/lib/require-end-tag/index.d.ts +2 -0
- package/lib/{end-tag → require-end-tag}/index.js +0 -7
- package/lib/require-end-tag/meta.d.ts +4 -0
- package/lib/require-end-tag/meta.js +3 -0
- package/lib/require-h1/index.d.ts +17 -0
- package/lib/{required-h1 → require-h1}/index.js +6 -14
- package/lib/require-h1/meta.d.ts +4 -0
- package/lib/require-h1/meta.js +3 -0
- package/lib/require-landmark-label/index.d.ts +11 -0
- package/lib/require-landmark-label/index.js +55 -0
- package/lib/require-landmark-label/meta.d.ts +4 -0
- package/lib/require-landmark-label/meta.js +3 -0
- package/lib/require-owned-elements/index.d.ts +3 -0
- package/lib/{wai-aria-required-owned-elements → require-owned-elements}/index.js +0 -2
- package/lib/require-owned-elements/meta.d.ts +4 -0
- package/lib/require-owned-elements/meta.js +3 -0
- package/lib/require-parent-role/index.d.ts +3 -0
- package/lib/{wai-aria-required-parent-role → require-parent-role}/index.js +0 -1
- package/lib/require-parent-role/meta.d.ts +4 -0
- package/lib/require-parent-role/meta.js +3 -0
- package/lib/role-supports-aria-prop/index.d.ts +8 -0
- package/lib/{wai-aria-disallowed-props → role-supports-aria-prop}/index.js +11 -10
- package/lib/role-supports-aria-prop/meta.d.ts +4 -0
- package/lib/role-supports-aria-prop/meta.js +3 -0
- package/lib/rule-aliases.d.ts +2 -0
- package/lib/rule-aliases.js +325 -0
- package/lib/sizes-auto-requires-lazy-loading/index.d.ts +14 -0
- package/lib/sizes-auto-requires-lazy-loading/index.js +68 -0
- package/lib/sizes-auto-requires-lazy-loading/meta.d.ts +4 -0
- package/lib/sizes-auto-requires-lazy-loading/meta.js +3 -0
- package/lib/srcset-sizes-constraint/parse-srcset.d.ts +6 -0
- package/lib/srcset-sizes-constraint/parse-srcset.js +6 -0
- package/lib/srcset-sizes-constraint/sibling-helpers.d.ts +21 -0
- package/lib/srcset-sizes-constraint/sibling-helpers.js +37 -0
- package/lib/tab-requires-tabpanel/index.d.ts +3 -0
- package/lib/tab-requires-tabpanel/index.js +21 -0
- package/lib/tab-requires-tabpanel/meta.d.ts +4 -0
- package/lib/tab-requires-tabpanel/meta.js +3 -0
- package/lib/table-row-column-alignment/grid.d.ts +108 -52
- package/lib/table-row-column-alignment/grid.js +276 -203
- package/lib/table-row-column-alignment/types.d.ts +6 -8
- package/lib/usemap-references-map/index.d.ts +14 -0
- package/lib/usemap-references-map/index.js +46 -0
- package/lib/usemap-references-map/meta.d.ts +4 -0
- package/lib/usemap-references-map/meta.js +3 -0
- package/lib/valid-importmap/index.d.ts +2 -0
- package/lib/valid-importmap/index.js +176 -0
- package/lib/valid-importmap/meta.d.ts +4 -0
- package/lib/valid-importmap/meta.js +3 -0
- package/lib/valid-speculation-rules/index.d.ts +2 -0
- package/lib/valid-speculation-rules/index.js +292 -0
- package/lib/valid-speculation-rules/meta.d.ts +4 -0
- package/lib/valid-speculation-rules/meta.js +3 -0
- package/lib/wai-aria/checkings/contradictory-aria-prop.d.ts +23 -0
- package/lib/wai-aria/checkings/{implicit-props.js → contradictory-aria-prop.js} +22 -14
- package/lib/wai-aria/checkings/element-supports-aria-prop.d.ts +20 -0
- package/lib/wai-aria/checkings/element-supports-aria-prop.js +83 -0
- package/lib/wai-aria/checkings/prohibited-naming.d.ts +35 -0
- package/lib/wai-aria/checkings/prohibited-naming.js +64 -0
- package/lib/wai-aria/checkings/redundant-aria-prop.d.ts +23 -0
- package/lib/wai-aria/checkings/redundant-aria-prop.js +53 -0
- package/lib/wai-aria/checkings/required-prop.d.ts +4 -0
- package/lib/wai-aria/checkings/required-prop.js +16 -3
- package/lib/wai-aria/checkings/role-supports-aria-prop.d.ts +20 -0
- package/lib/wai-aria/checkings/role-supports-aria-prop.js +30 -0
- package/lib/wai-aria/checkings/tab-requires-tabpanel.d.ts +19 -0
- package/lib/wai-aria/checkings/tab-requires-tabpanel.js +56 -0
- package/lib/wai-aria/default-options.js +1 -0
- package/lib/wai-aria/types.d.ts +2 -0
- package/package.json +11 -10
- package/schema.json +275 -59
- package/SKILL.md +0 -77
- package/lib/attr-duplication/index.d.ts +0 -9
- package/lib/attr-duplication/meta.d.ts +0 -6
- package/lib/attr-duplication/meta.js +0 -5
- package/lib/character-reference/index.d.ts +0 -12
- package/lib/character-reference/meta.d.ts +0 -5
- package/lib/character-reference/meta.js +0 -4
- package/lib/correct-aspect-ratio/meta.js +0 -3
- package/lib/deprecated-attr/index.d.ts +0 -8
- package/lib/deprecated-attr/meta.d.ts +0 -5
- package/lib/deprecated-attr/meta.js +0 -4
- package/lib/deprecated-element/index.d.ts +0 -8
- package/lib/deprecated-element/meta.d.ts +0 -5
- package/lib/deprecated-element/meta.js +0 -4
- package/lib/disallowed-element/index.d.ts +0 -9
- package/lib/disallowed-element/meta.d.ts +0 -5
- package/lib/disallowed-element/meta.js +0 -4
- package/lib/doctype/index.d.ts +0 -15
- package/lib/doctype/meta.d.ts +0 -5
- package/lib/doctype/meta.js +0 -4
- package/lib/end-tag/index.d.ts +0 -9
- package/lib/end-tag/meta.d.ts +0 -5
- package/lib/end-tag/meta.js +0 -4
- package/lib/heading-levels/index.d.ts +0 -8
- package/lib/heading-levels/meta.d.ts +0 -5
- package/lib/heading-levels/meta.js +0 -4
- package/lib/id-duplication/index.d.ts +0 -9
- package/lib/id-duplication/meta.d.ts +0 -5
- package/lib/id-duplication/meta.js +0 -4
- package/lib/ineffective-attr/index.d.ts +0 -9
- package/lib/ineffective-attr/meta.d.ts +0 -6
- package/lib/ineffective-attr/meta.js +0 -5
- package/lib/invalid-attr/index.js +0 -207
- package/lib/invalid-attr/meta.d.ts +0 -5
- package/lib/invalid-attr/meta.js +0 -4
- package/lib/landmark-roles/index.d.ts +0 -22
- package/lib/landmark-roles/index.js +0 -142
- package/lib/landmark-roles/meta.d.ts +0 -5
- package/lib/landmark-roles/meta.js +0 -4
- package/lib/neighbor-popovers/index.d.ts +0 -10
- package/lib/neighbor-popovers/meta.d.ts +0 -5
- package/lib/neighbor-popovers/meta.js +0 -4
- package/lib/no-hard-code-id/index.d.ts +0 -10
- package/lib/no-hard-code-id/meta.d.ts +0 -5
- package/lib/no-hard-code-id/meta.js +0 -4
- package/lib/no-unsupported-features/index.js +0 -139
- package/lib/no-unsupported-features/meta.d.ts +0 -5
- package/lib/no-unsupported-features/meta.js +0 -4
- package/lib/no-use-event-handler-attr/index.d.ts +0 -18
- package/lib/no-use-event-handler-attr/meta.d.ts +0 -5
- package/lib/no-use-event-handler-attr/meta.js +0 -4
- package/lib/redundant-accessible-name/meta.d.ts +0 -5
- package/lib/redundant-accessible-name/meta.js +0 -4
- package/lib/required-attr/meta.d.ts +0 -5
- package/lib/required-attr/meta.js +0 -4
- package/lib/required-element/meta.d.ts +0 -5
- package/lib/required-element/meta.js +0 -4
- package/lib/required-h1/index.d.ts +0 -18
- package/lib/required-h1/meta.d.ts +0 -5
- package/lib/required-h1/meta.js +0 -4
- package/lib/srcset-sizes-constraint/index.d.ts +0 -6
- package/lib/srcset-sizes-constraint/index.js +0 -108
- package/lib/srcset-sizes-constraint/meta.d.ts +0 -5
- package/lib/srcset-sizes-constraint/meta.js +0 -4
- package/lib/table-row-column-alignment/index.d.ts +0 -10
- package/lib/table-row-column-alignment/index.js +0 -97
- package/lib/table-row-column-alignment/meta.d.ts +0 -5
- package/lib/table-row-column-alignment/meta.js +0 -4
- package/lib/use-list/meta.d.ts +0 -5
- package/lib/use-list/meta.js +0 -4
- package/lib/wai-aria/checkings/disallowed-prop.d.ts +0 -23
- package/lib/wai-aria/checkings/disallowed-prop.js +0 -84
- package/lib/wai-aria/checkings/implicit-props.d.ts +0 -20
- package/lib/wai-aria/index.d.ts +0 -13
- package/lib/wai-aria/index.js +0 -115
- package/lib/wai-aria/meta.d.ts +0 -5
- package/lib/wai-aria/meta.js +0 -4
- package/lib/wai-aria-default-value/index.d.ts +0 -4
- package/lib/wai-aria-default-value/meta.d.ts +0 -5
- package/lib/wai-aria-default-value/meta.js +0 -4
- package/lib/wai-aria-deprecated-props/index.d.ts +0 -4
- package/lib/wai-aria-deprecated-props/meta.d.ts +0 -5
- package/lib/wai-aria-deprecated-props/meta.js +0 -4
- package/lib/wai-aria-disallowed-props/index.d.ts +0 -4
- package/lib/wai-aria-disallowed-props/meta.d.ts +0 -5
- package/lib/wai-aria-disallowed-props/meta.js +0 -4
- package/lib/wai-aria-implicit-props/index.d.ts +0 -4
- package/lib/wai-aria-implicit-props/meta.d.ts +0 -5
- package/lib/wai-aria-implicit-props/meta.js +0 -4
- package/lib/wai-aria-implicit-role/index.d.ts +0 -4
- package/lib/wai-aria-interaction-in-hidden/index.d.ts +0 -4
- package/lib/wai-aria-interaction-in-hidden/meta.d.ts +0 -5
- package/lib/wai-aria-interaction-in-hidden/meta.js +0 -4
- package/lib/wai-aria-no-global-prop/index.d.ts +0 -4
- package/lib/wai-aria-no-global-prop/meta.d.ts +0 -5
- package/lib/wai-aria-no-global-prop/meta.js +0 -4
- package/lib/wai-aria-non-existent-role/index.d.ts +0 -4
- package/lib/wai-aria-permitted-roles/index.d.ts +0 -4
- package/lib/wai-aria-presentational-children/index.d.ts +0 -4
- package/lib/wai-aria-presentational-children/meta.d.ts +0 -5
- package/lib/wai-aria-presentational-children/meta.js +0 -4
- package/lib/wai-aria-required-parent-role/index.d.ts +0 -4
- package/lib/wai-aria-value/index.d.ts +0 -4
- package/lib/wai-aria-value/meta.d.ts +0 -5
- package/lib/wai-aria-value/meta.js +0 -4
- /package/lib/{wai-aria-abstract-role → aria-prop-requires-role}/meta.d.ts +0 -0
- /package/lib/{wai-aria-abstract-role → aria-prop-requires-role}/meta.js +0 -0
- /package/lib/{wai-aria-deprecated-role → element-supports-aria-prop}/meta.d.ts +0 -0
- /package/lib/{wai-aria-deprecated-role → element-supports-aria-prop}/meta.js +0 -0
- /package/lib/{wai-aria-implicit-role → no-abstract-role}/meta.d.ts +0 -0
- /package/lib/{wai-aria-implicit-role → no-abstract-role}/meta.js +0 -0
- /package/lib/{wai-aria-non-existent-role → no-aria-on-presentational-children}/meta.d.ts +0 -0
- /package/lib/{wai-aria-non-existent-role → no-aria-on-presentational-children}/meta.js +0 -0
- /package/lib/{wai-aria-permitted-roles → no-contradictory-aria-prop}/meta.d.ts +0 -0
- /package/lib/{wai-aria-permitted-roles → no-contradictory-aria-prop}/meta.js +0 -0
- /package/lib/{wai-aria-required-owned-elements → no-default-aria-value}/meta.d.ts +0 -0
- /package/lib/{wai-aria-required-owned-elements → no-default-aria-value}/meta.js +0 -0
- /package/lib/{wai-aria-required-parent-role → no-deprecated-aria-prop}/meta.d.ts +0 -0
- /package/lib/{wai-aria-required-parent-role → no-deprecated-aria-prop}/meta.js +0 -0
- /package/lib/{wai-aria-required-props → no-deprecated-role}/meta.d.ts +0 -0
- /package/lib/{wai-aria-required-props → no-deprecated-role}/meta.js +0 -0
- /package/lib/{correct-aspect-ratio → no-mismatched-aspect-ratio}/index.d.ts +0 -0
- /package/lib/{correct-aspect-ratio → no-mismatched-aspect-ratio}/resolve-image-size.d.ts +0 -0
- /package/lib/{no-unsupported-features → no-unsupported-browser-features}/compat-data.d.ts +0 -0
- /package/lib/{no-unsupported-features → no-unsupported-browser-features}/compat-data.js +0 -0
- /package/lib/{no-unsupported-features → no-unsupported-browser-features}/resolve-browsers.d.ts +0 -0
- /package/lib/{no-unsupported-features → no-unsupported-browser-features}/resolve-browsers.js +0 -0
package/lib/index.js
CHANGED
|
@@ -6,138 +6,223 @@
|
|
|
6
6
|
* Each rule implements the {@link AnyRuleSeed} interface and covers
|
|
7
7
|
* areas such as accessibility, HTML validity, naming conventions, and coding style.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
export { ruleAliasTable } from './rule-aliases.js';
|
|
10
|
+
import AriaPropRequiresRole from './aria-prop-requires-role/index.js';
|
|
10
11
|
import AttrOrder from './attr-order/index.js';
|
|
11
12
|
import AttrValueQuotes from './attr-value-quotes/index.js';
|
|
12
13
|
import CaseSensitiveAttrName from './case-sensitive-attr-name/index.js';
|
|
13
14
|
import CaseSensitiveTagName from './case-sensitive-tag-name/index.js';
|
|
14
|
-
import CharacterReference from './character-reference/index.js';
|
|
15
|
-
import CorrectAspectRatio from './correct-aspect-ratio/index.js';
|
|
16
15
|
import ClassNaming from './class-naming/index.js';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import Doctype from './doctype/index.js';
|
|
21
|
-
import EndTag from './end-tag/index.js';
|
|
16
|
+
import ConsistentTableRowLength from './consistent-table-row-length/index.js';
|
|
17
|
+
import ElementSupportsAriaProp from './element-supports-aria-prop/index.js';
|
|
18
|
+
import FormAttrReferencesForm from './form-attr-references-form/index.js';
|
|
22
19
|
import HeadElementOrder from './head-element-order/index.js';
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import InvalidAttr from './invalid-attr/index.js';
|
|
20
|
+
import InputListReferencesDatalist from './input-list-references-datalist/index.js';
|
|
21
|
+
import ItempropRequiresItemscope from './itemprop-requires-itemscope/index.js';
|
|
22
|
+
import LabelForReferencesLabelable from './label-for-references-labelable/index.js';
|
|
27
23
|
import LabelHasControl from './label-has-control/index.js';
|
|
28
|
-
import
|
|
24
|
+
import LabelNoMultipleControls from './label-no-multiple-controls/index.js';
|
|
29
25
|
import LinkTypes from './link-types/index.js';
|
|
30
|
-
import
|
|
26
|
+
import MapIdNameMatch from './map-id-name-match/index.js';
|
|
27
|
+
import MetaCharsetPosition from './meta-charset-position/index.js';
|
|
28
|
+
import MeterValueBounds from './meter-value-bounds/index.js';
|
|
29
|
+
import NoAbstractRole from './no-abstract-role/index.js';
|
|
30
|
+
import NoAlwaysMatchingSource from './no-always-matching-source/index.js';
|
|
31
31
|
import NoAmbiguousNavigableTargetNames from './no-ambiguous-navigable-target-names/index.js';
|
|
32
|
+
import NoAriaOnPresentationalChildren from './no-aria-on-presentational-children/index.js';
|
|
33
|
+
import NoAriaOnUnsupportedElement from './no-aria-on-unsupported-element/index.js';
|
|
32
34
|
import NoBooleanAttrValue from './no-boolean-attr-value/index.js';
|
|
35
|
+
import NoBrokenFragmentLink from './no-broken-fragment-link/index.js';
|
|
33
36
|
import NoConsecutiveBr from './no-consecutive-br/index.js';
|
|
37
|
+
import NoContentAfterBody from './no-content-after-body/index.js';
|
|
38
|
+
import NoContradictoryAriaProp from './no-contradictory-aria-prop/index.js';
|
|
39
|
+
import NoDefaultAriaValue from './no-default-aria-value/index.js';
|
|
34
40
|
import NoDefaultValue from './no-default-value/index.js';
|
|
41
|
+
import NoDeprecatedAriaProp from './no-deprecated-aria-prop/index.js';
|
|
42
|
+
import NoDeprecatedAttr from './no-deprecated-attr/index.js';
|
|
43
|
+
import NoDeprecatedElement from './no-deprecated-element/index.js';
|
|
44
|
+
import NoDeprecatedRole from './no-deprecated-role/index.js';
|
|
45
|
+
import NoDisallowedAncestor from './no-disallowed-ancestor/index.js';
|
|
46
|
+
import NoDisallowedAttr from './no-disallowed-attr/index.js';
|
|
47
|
+
import NoDuplicateAttr from './no-duplicate-attr/index.js';
|
|
35
48
|
import NoDuplicateAutofocus from './no-duplicate-autofocus/index.js';
|
|
36
49
|
import NoDuplicateDt from './no-duplicate-dt/index.js';
|
|
50
|
+
import NoDuplicateH1 from './no-duplicate-h1/index.js';
|
|
51
|
+
import NoDuplicateId from './no-duplicate-id/index.js';
|
|
52
|
+
import NoDuplicateSiblingAttr from './no-duplicate-sibling-attr/index.js';
|
|
37
53
|
import NoDuplicateVisibleMain from './no-duplicate-visible-main/index.js';
|
|
38
54
|
import NoEmptyPalpableContent from './no-empty-palpable-content/index.js';
|
|
39
|
-
import
|
|
55
|
+
import NoEmptyTableTrack from './no-empty-table-track/index.js';
|
|
56
|
+
import NoEventHandlerAttr from './no-event-handler-attr/index.js';
|
|
57
|
+
import NoExperimentalFeatures from './no-experimental-features/index.js';
|
|
58
|
+
import NoExtraSelectedOptions from './no-extra-selected-options/index.js';
|
|
59
|
+
import NoFocusableInAriaHidden from './no-focusable-in-aria-hidden/index.js';
|
|
60
|
+
import NoHardcodedId from './no-hardcoded-id/index.js';
|
|
61
|
+
import NoIneffectiveAttr from './no-ineffective-attr/index.js';
|
|
62
|
+
import NoInputFileValue from './no-input-file-value/index.js';
|
|
63
|
+
import NoInvalidAriaPropValue from './no-invalid-aria-prop-value/index.js';
|
|
64
|
+
import NoInvalidAttrValue from './no-invalid-attr-value/index.js';
|
|
65
|
+
import NoMalformedCharacterReference from './no-malformed-character-reference/index.js';
|
|
66
|
+
import NoMismatchedAspectRatio from './no-mismatched-aspect-ratio/index.js';
|
|
67
|
+
import NoMixedSrcsetDescriptors from './no-mixed-srcset-descriptors/index.js';
|
|
68
|
+
import NoNestedTopLevelLandmark from './no-nested-top-level-landmark/index.js';
|
|
69
|
+
import NoNonstandardFeatures from './no-nonstandard-features/index.js';
|
|
70
|
+
import NoObsoleteAttr from './no-obsolete-attr/index.js';
|
|
71
|
+
import NoObsoleteDoctype from './no-obsolete-doctype/index.js';
|
|
72
|
+
import NoObsoleteElement from './no-obsolete-element/index.js';
|
|
40
73
|
import NoOrphanedEndTag from './no-orphaned-end-tag/index.js';
|
|
74
|
+
import NoProhibitedNaming from './no-prohibited-naming/index.js';
|
|
75
|
+
import NoPseudoList from './no-pseudo-list/index.js';
|
|
76
|
+
import NoRedundantAccessibleName from './no-redundant-accessible-name/index.js';
|
|
77
|
+
import NoRedundantAriaProp from './no-redundant-aria-prop/index.js';
|
|
78
|
+
import NoRedundantRole from './no-redundant-role/index.js';
|
|
41
79
|
import NoReferToNonExistentId from './no-refer-to-non-existent-id/index.js';
|
|
42
|
-
import
|
|
43
|
-
import
|
|
80
|
+
import NoRestrictedAttr from './no-restricted-attr/index.js';
|
|
81
|
+
import NoRestrictedElement from './no-restricted-element/index.js';
|
|
82
|
+
import NoSkippedHeadingLevel from './no-skipped-heading-level/index.js';
|
|
83
|
+
import NoStrayHeadOrBodyTag from './no-stray-head-or-body-tag/index.js';
|
|
84
|
+
import NoTableCellOverlap from './no-table-cell-overlap/index.js';
|
|
85
|
+
import NoTableSpanOverflow from './no-table-span-overflow/index.js';
|
|
86
|
+
import NoUnclosedElementAtEof from './no-unclosed-element-at-eof/index.js';
|
|
87
|
+
import NoUnescapedChar from './no-unescaped-char/index.js';
|
|
88
|
+
import NoUnknownAttr from './no-unknown-attr/index.js';
|
|
89
|
+
import NoUnknownRole from './no-unknown-role/index.js';
|
|
90
|
+
import NoUnpairedSrcsetSizes from './no-unpaired-srcset-sizes/index.js';
|
|
91
|
+
import NoUnsupportedBrowserFeatures from './no-unsupported-browser-features/index.js';
|
|
44
92
|
import PermittedContents from './permitted-contents/index.js';
|
|
93
|
+
import PermittedRoles from './permitted-roles/index.js';
|
|
45
94
|
import PlaceholderLabelOption from './placeholder-label-option/index.js';
|
|
46
|
-
import
|
|
95
|
+
import ProgressValueBounds from './progress-value-bounds/index.js';
|
|
47
96
|
import RequireAccessibleName from './require-accessible-name/index.js';
|
|
97
|
+
import RequireAdjacentPopover from './require-adjacent-popover/index.js';
|
|
98
|
+
import RequireAncestor from './require-ancestor/index.js';
|
|
99
|
+
import RequireAriaProp from './require-aria-prop/index.js';
|
|
100
|
+
import RequireAttr from './require-attr/index.js';
|
|
48
101
|
import RequireDatetime from './require-datetime/index.js';
|
|
49
102
|
import RequireDialogAutofocus from './require-dialog-autofocus/index.js';
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
import WaiAriaImplicitRole from './wai-aria-implicit-role/index.js';
|
|
64
|
-
import WaiAriaInteractionInHidden from './wai-aria-interaction-in-hidden/index.js';
|
|
65
|
-
import WaiAriaNoGlobalProp from './wai-aria-no-global-prop/index.js';
|
|
66
|
-
import WaiAriaNonExistentRole from './wai-aria-non-existent-role/index.js';
|
|
67
|
-
import WaiAriaPermittedRoles from './wai-aria-permitted-roles/index.js';
|
|
68
|
-
import WaiAriaPresentationalChildren from './wai-aria-presentational-children/index.js';
|
|
69
|
-
import WaiAriaRequiredOwnedElements from './wai-aria-required-owned-elements/index.js';
|
|
70
|
-
import WaiAriaRequiredParentRole from './wai-aria-required-parent-role/index.js';
|
|
71
|
-
import WaiAriaRequiredProps from './wai-aria-required-props/index.js';
|
|
72
|
-
import WaiAriaValue from './wai-aria-value/index.js';
|
|
103
|
+
import RequireDoctype from './require-doctype/index.js';
|
|
104
|
+
import RequireElement from './require-element/index.js';
|
|
105
|
+
import RequireEndTag from './require-end-tag/index.js';
|
|
106
|
+
import RequireH1 from './require-h1/index.js';
|
|
107
|
+
import RequireLandmarkLabel from './require-landmark-label/index.js';
|
|
108
|
+
import RequireOwnedElements from './require-owned-elements/index.js';
|
|
109
|
+
import RequireParentRole from './require-parent-role/index.js';
|
|
110
|
+
import RoleSupportsAriaProp from './role-supports-aria-prop/index.js';
|
|
111
|
+
import SizesAutoRequiresLazyLoading from './sizes-auto-requires-lazy-loading/index.js';
|
|
112
|
+
import TabRequiresTabpanel from './tab-requires-tabpanel/index.js';
|
|
113
|
+
import UsemapReferencesMap from './usemap-references-map/index.js';
|
|
114
|
+
import ValidImportmap from './valid-importmap/index.js';
|
|
115
|
+
import ValidSpeculationRules from './valid-speculation-rules/index.js';
|
|
73
116
|
/**
|
|
74
117
|
* Registry of all built-in markuplint rules, mapping rule names to their seed definitions.
|
|
75
118
|
* Used by the markuplint core to initialize rule instances during linting.
|
|
76
119
|
*/
|
|
77
120
|
const rules = {
|
|
78
|
-
'
|
|
121
|
+
'aria-prop-requires-role': AriaPropRequiresRole,
|
|
79
122
|
'attr-order': AttrOrder,
|
|
80
123
|
'attr-value-quotes': AttrValueQuotes,
|
|
81
124
|
'case-sensitive-attr-name': CaseSensitiveAttrName,
|
|
82
125
|
'case-sensitive-tag-name': CaseSensitiveTagName,
|
|
83
|
-
'character-reference': CharacterReference,
|
|
84
126
|
'class-naming': ClassNaming,
|
|
85
|
-
'
|
|
86
|
-
'
|
|
87
|
-
'
|
|
88
|
-
'disallowed-element': DisallowedElement,
|
|
89
|
-
doctype: Doctype,
|
|
90
|
-
'end-tag': EndTag,
|
|
127
|
+
'consistent-table-row-length': ConsistentTableRowLength,
|
|
128
|
+
'element-supports-aria-prop': ElementSupportsAriaProp,
|
|
129
|
+
'form-attr-references-form': FormAttrReferencesForm,
|
|
91
130
|
'head-element-order': HeadElementOrder,
|
|
92
|
-
'
|
|
93
|
-
'
|
|
94
|
-
'
|
|
95
|
-
'invalid-attr': InvalidAttr,
|
|
131
|
+
'input-list-references-datalist': InputListReferencesDatalist,
|
|
132
|
+
'itemprop-requires-itemscope': ItempropRequiresItemscope,
|
|
133
|
+
'label-for-references-labelable': LabelForReferencesLabelable,
|
|
96
134
|
'label-has-control': LabelHasControl,
|
|
97
|
-
'
|
|
135
|
+
'label-no-multiple-controls': LabelNoMultipleControls,
|
|
98
136
|
'link-types': LinkTypes,
|
|
99
|
-
'
|
|
137
|
+
'map-id-name-match': MapIdNameMatch,
|
|
138
|
+
'meta-charset-position': MetaCharsetPosition,
|
|
139
|
+
'meter-value-bounds': MeterValueBounds,
|
|
140
|
+
'no-abstract-role': NoAbstractRole,
|
|
141
|
+
'no-always-matching-source': NoAlwaysMatchingSource,
|
|
100
142
|
'no-ambiguous-navigable-target-names': NoAmbiguousNavigableTargetNames,
|
|
143
|
+
'no-aria-on-presentational-children': NoAriaOnPresentationalChildren,
|
|
144
|
+
'no-aria-on-unsupported-element': NoAriaOnUnsupportedElement,
|
|
101
145
|
'no-boolean-attr-value': NoBooleanAttrValue,
|
|
146
|
+
'no-broken-fragment-link': NoBrokenFragmentLink,
|
|
102
147
|
'no-consecutive-br': NoConsecutiveBr,
|
|
148
|
+
'no-content-after-body': NoContentAfterBody,
|
|
149
|
+
'no-contradictory-aria-prop': NoContradictoryAriaProp,
|
|
150
|
+
'no-default-aria-value': NoDefaultAriaValue,
|
|
103
151
|
'no-default-value': NoDefaultValue,
|
|
152
|
+
'no-deprecated-aria-prop': NoDeprecatedAriaProp,
|
|
153
|
+
'no-deprecated-attr': NoDeprecatedAttr,
|
|
154
|
+
'no-deprecated-element': NoDeprecatedElement,
|
|
155
|
+
'no-deprecated-role': NoDeprecatedRole,
|
|
156
|
+
'no-disallowed-ancestor': NoDisallowedAncestor,
|
|
157
|
+
'no-disallowed-attr': NoDisallowedAttr,
|
|
158
|
+
'no-duplicate-attr': NoDuplicateAttr,
|
|
104
159
|
'no-duplicate-autofocus': NoDuplicateAutofocus,
|
|
105
160
|
'no-duplicate-dt': NoDuplicateDt,
|
|
161
|
+
'no-duplicate-h1': NoDuplicateH1,
|
|
162
|
+
'no-duplicate-id': NoDuplicateId,
|
|
163
|
+
'no-duplicate-sibling-attr': NoDuplicateSiblingAttr,
|
|
106
164
|
'no-duplicate-visible-main': NoDuplicateVisibleMain,
|
|
107
165
|
'no-empty-palpable-content': NoEmptyPalpableContent,
|
|
108
|
-
'no-
|
|
166
|
+
'no-empty-table-track': NoEmptyTableTrack,
|
|
167
|
+
'no-event-handler-attr': NoEventHandlerAttr,
|
|
168
|
+
'no-experimental-features': NoExperimentalFeatures,
|
|
169
|
+
'no-extra-selected-options': NoExtraSelectedOptions,
|
|
170
|
+
'no-focusable-in-aria-hidden': NoFocusableInAriaHidden,
|
|
171
|
+
'no-hardcoded-id': NoHardcodedId,
|
|
172
|
+
'no-ineffective-attr': NoIneffectiveAttr,
|
|
173
|
+
'no-input-file-value': NoInputFileValue,
|
|
174
|
+
'no-invalid-aria-prop-value': NoInvalidAriaPropValue,
|
|
175
|
+
'no-invalid-attr-value': NoInvalidAttrValue,
|
|
176
|
+
'no-malformed-character-reference': NoMalformedCharacterReference,
|
|
177
|
+
'no-mismatched-aspect-ratio': NoMismatchedAspectRatio,
|
|
178
|
+
'no-mixed-srcset-descriptors': NoMixedSrcsetDescriptors,
|
|
179
|
+
'no-nested-top-level-landmark': NoNestedTopLevelLandmark,
|
|
180
|
+
'no-nonstandard-features': NoNonstandardFeatures,
|
|
181
|
+
'no-obsolete-attr': NoObsoleteAttr,
|
|
182
|
+
'no-obsolete-doctype': NoObsoleteDoctype,
|
|
183
|
+
'no-obsolete-element': NoObsoleteElement,
|
|
109
184
|
'no-orphaned-end-tag': NoOrphanedEndTag,
|
|
185
|
+
'no-prohibited-naming': NoProhibitedNaming,
|
|
186
|
+
'no-pseudo-list': NoPseudoList,
|
|
187
|
+
'no-redundant-accessible-name': NoRedundantAccessibleName,
|
|
188
|
+
'no-redundant-aria-prop': NoRedundantAriaProp,
|
|
189
|
+
'no-redundant-role': NoRedundantRole,
|
|
110
190
|
'no-refer-to-non-existent-id': NoReferToNonExistentId,
|
|
111
|
-
'no-
|
|
112
|
-
'no-
|
|
191
|
+
'no-restricted-attr': NoRestrictedAttr,
|
|
192
|
+
'no-restricted-element': NoRestrictedElement,
|
|
193
|
+
'no-skipped-heading-level': NoSkippedHeadingLevel,
|
|
194
|
+
'no-stray-head-or-body-tag': NoStrayHeadOrBodyTag,
|
|
195
|
+
'no-table-cell-overlap': NoTableCellOverlap,
|
|
196
|
+
'no-table-span-overflow': NoTableSpanOverflow,
|
|
197
|
+
'no-unclosed-element-at-eof': NoUnclosedElementAtEof,
|
|
198
|
+
'no-unescaped-char': NoUnescapedChar,
|
|
199
|
+
'no-unknown-attr': NoUnknownAttr,
|
|
200
|
+
'no-unknown-role': NoUnknownRole,
|
|
201
|
+
'no-unpaired-srcset-sizes': NoUnpairedSrcsetSizes,
|
|
202
|
+
'no-unsupported-browser-features': NoUnsupportedBrowserFeatures,
|
|
113
203
|
'permitted-contents': PermittedContents,
|
|
204
|
+
'permitted-roles': PermittedRoles,
|
|
114
205
|
'placeholder-label-option': PlaceholderLabelOption,
|
|
115
|
-
'
|
|
206
|
+
'progress-value-bounds': ProgressValueBounds,
|
|
116
207
|
'require-accessible-name': RequireAccessibleName,
|
|
208
|
+
'require-adjacent-popover': RequireAdjacentPopover,
|
|
209
|
+
'require-ancestor': RequireAncestor,
|
|
210
|
+
'require-aria-prop': RequireAriaProp,
|
|
211
|
+
'require-attr': RequireAttr,
|
|
117
212
|
'require-datetime': RequireDatetime,
|
|
118
213
|
'require-dialog-autofocus': RequireDialogAutofocus,
|
|
119
|
-
'
|
|
120
|
-
'
|
|
121
|
-
'
|
|
122
|
-
'
|
|
123
|
-
'
|
|
124
|
-
'
|
|
125
|
-
'
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
'wai-aria-implicit-role': WaiAriaImplicitRole,
|
|
133
|
-
'wai-aria-interaction-in-hidden': WaiAriaInteractionInHidden,
|
|
134
|
-
'wai-aria-no-global-prop': WaiAriaNoGlobalProp,
|
|
135
|
-
'wai-aria-non-existent-role': WaiAriaNonExistentRole,
|
|
136
|
-
'wai-aria-permitted-roles': WaiAriaPermittedRoles,
|
|
137
|
-
'wai-aria-presentational-children': WaiAriaPresentationalChildren,
|
|
138
|
-
'wai-aria-required-owned-elements': WaiAriaRequiredOwnedElements,
|
|
139
|
-
'wai-aria-required-parent-role': WaiAriaRequiredParentRole,
|
|
140
|
-
'wai-aria-required-props': WaiAriaRequiredProps,
|
|
141
|
-
'wai-aria-value': WaiAriaValue,
|
|
214
|
+
'require-doctype': RequireDoctype,
|
|
215
|
+
'require-element': RequireElement,
|
|
216
|
+
'require-end-tag': RequireEndTag,
|
|
217
|
+
'require-h1': RequireH1,
|
|
218
|
+
'require-landmark-label': RequireLandmarkLabel,
|
|
219
|
+
'require-owned-elements': RequireOwnedElements,
|
|
220
|
+
'require-parent-role': RequireParentRole,
|
|
221
|
+
'role-supports-aria-prop': RoleSupportsAriaProp,
|
|
222
|
+
'sizes-auto-requires-lazy-loading': SizesAutoRequiresLazyLoading,
|
|
223
|
+
'tab-requires-tabpanel': TabRequiresTabpanel,
|
|
224
|
+
'usemap-references-map': UsemapReferencesMap,
|
|
225
|
+
'valid-importmap': ValidImportmap,
|
|
226
|
+
'valid-speculation-rules': ValidSpeculationRules,
|
|
142
227
|
};
|
|
143
228
|
export default rules;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Require the `list` attribute on an `<input>` element to reference an
|
|
3
|
+
* actual `<datalist>` element by ID. Per HTML LS §4.10.5.2: "The `list`
|
|
4
|
+
* content attribute is used to identify an element that lists predefined
|
|
5
|
+
* options to suggest to the user. If present, its value must be the ID of
|
|
6
|
+
* a `datalist` element in the same tree." Existence of the ID itself is
|
|
7
|
+
* the responsibility of `no-refer-to-non-existent-id`; this rule only
|
|
8
|
+
* checks the element type when the ID resolves.
|
|
9
|
+
*
|
|
10
|
+
* @see https://html.spec.whatwg.org/multipage/input.html#the-list-attribute
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, null>>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import meta from './meta.js';
|
|
3
|
+
/**
|
|
4
|
+
* Require the `list` attribute on an `<input>` element to reference an
|
|
5
|
+
* actual `<datalist>` element by ID. Per HTML LS §4.10.5.2: "The `list`
|
|
6
|
+
* content attribute is used to identify an element that lists predefined
|
|
7
|
+
* options to suggest to the user. If present, its value must be the ID of
|
|
8
|
+
* a `datalist` element in the same tree." Existence of the ID itself is
|
|
9
|
+
* the responsibility of `no-refer-to-non-existent-id`; this rule only
|
|
10
|
+
* checks the element type when the ID resolves.
|
|
11
|
+
*
|
|
12
|
+
* @see https://html.spec.whatwg.org/multipage/input.html#the-list-attribute
|
|
13
|
+
*/
|
|
14
|
+
export default createRule({
|
|
15
|
+
meta: meta,
|
|
16
|
+
defaultValue: true,
|
|
17
|
+
defaultOptions: null,
|
|
18
|
+
async verify({ document, report, t }) {
|
|
19
|
+
await document.walkOn('Element', el => {
|
|
20
|
+
if (el.localName !== 'input')
|
|
21
|
+
return;
|
|
22
|
+
if (el.pretenderContext?.type === 'pretender' && !el.hasAttribute('as'))
|
|
23
|
+
return;
|
|
24
|
+
const listAttr = el.getAttributeNode('list');
|
|
25
|
+
if (!listAttr)
|
|
26
|
+
return;
|
|
27
|
+
if (listAttr.isDynamicValue)
|
|
28
|
+
return;
|
|
29
|
+
const targetId = listAttr.value;
|
|
30
|
+
const target = [...document.querySelectorAll('[id]')].find(candidate => candidate.getAttribute('id') === targetId);
|
|
31
|
+
// Existence is checked by `no-refer-to-non-existent-id`. If the ID does not resolve
|
|
32
|
+
// here, leave that diagnostic to the dedicated rule and stay silent.
|
|
33
|
+
if (!target)
|
|
34
|
+
return;
|
|
35
|
+
if (target.localName !== 'datalist') {
|
|
36
|
+
report({
|
|
37
|
+
scope: listAttr,
|
|
38
|
+
line: listAttr.valueNode?.startLine,
|
|
39
|
+
col: listAttr.valueNode?.startCol,
|
|
40
|
+
raw: listAttr.valueNode?.raw,
|
|
41
|
+
message: t('The "{0}" attribute of the "{1}" element must reference a "{2}" element', 'list', 'input', 'datalist'),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule that requires every `itemprop` to belong to an item.
|
|
3
|
+
*
|
|
4
|
+
* The `itemprop` attribute is defined in HTML LS §5.2.3 ("Names: the
|
|
5
|
+
* itemprop attribute"). The conformance constraint behind this rule sits
|
|
6
|
+
* under §5.2.5: a document must not contain an `itemprop` element that
|
|
7
|
+
* would not be found to be a property of any of its items. Practically,
|
|
8
|
+
* an element with `itemprop` belongs to an item when one of the following
|
|
9
|
+
* is true:
|
|
10
|
+
*
|
|
11
|
+
* - it has an ancestor element with an `itemscope` attribute, or
|
|
12
|
+
* - its `id` is referenced by some `itemscope` element's `itemref` token list.
|
|
13
|
+
*
|
|
14
|
+
* Either path makes the element part of an item; without either, the
|
|
15
|
+
* `itemprop` is orphaned and contributes no property to any item.
|
|
16
|
+
*
|
|
17
|
+
* @see https://html.spec.whatwg.org/multipage/microdata.html#names:-the-itemprop-attribute
|
|
18
|
+
* @see https://html.spec.whatwg.org/multipage/microdata.html#associating-names-with-items
|
|
19
|
+
*/
|
|
20
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, null>>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import meta from './meta.js';
|
|
3
|
+
/**
|
|
4
|
+
* Rule that requires every `itemprop` to belong to an item.
|
|
5
|
+
*
|
|
6
|
+
* The `itemprop` attribute is defined in HTML LS §5.2.3 ("Names: the
|
|
7
|
+
* itemprop attribute"). The conformance constraint behind this rule sits
|
|
8
|
+
* under §5.2.5: a document must not contain an `itemprop` element that
|
|
9
|
+
* would not be found to be a property of any of its items. Practically,
|
|
10
|
+
* an element with `itemprop` belongs to an item when one of the following
|
|
11
|
+
* is true:
|
|
12
|
+
*
|
|
13
|
+
* - it has an ancestor element with an `itemscope` attribute, or
|
|
14
|
+
* - its `id` is referenced by some `itemscope` element's `itemref` token list.
|
|
15
|
+
*
|
|
16
|
+
* Either path makes the element part of an item; without either, the
|
|
17
|
+
* `itemprop` is orphaned and contributes no property to any item.
|
|
18
|
+
*
|
|
19
|
+
* @see https://html.spec.whatwg.org/multipage/microdata.html#names:-the-itemprop-attribute
|
|
20
|
+
* @see https://html.spec.whatwg.org/multipage/microdata.html#associating-names-with-items
|
|
21
|
+
*/
|
|
22
|
+
export default createRule({
|
|
23
|
+
meta,
|
|
24
|
+
verify({ document, report, t }) {
|
|
25
|
+
// Build the set of element ids referenced by some `[itemscope] [itemref]`.
|
|
26
|
+
// HTML LS does not require `itemref` to point to a descendant — any
|
|
27
|
+
// element in the same tree may be claimed via id, so we collect ids
|
|
28
|
+
// once and then check each `[itemprop]` against the union set.
|
|
29
|
+
// `itemref=" "` (whitespace-only) yields zero tokens and contributes
|
|
30
|
+
// no entries to the set; orphans referencing such a host stay orphans.
|
|
31
|
+
const itemrefIds = new Set();
|
|
32
|
+
const itemrefHosts = document.querySelectorAll('[itemscope][itemref]');
|
|
33
|
+
for (const host of itemrefHosts) {
|
|
34
|
+
const value = host.getAttribute('itemref') ?? '';
|
|
35
|
+
for (const token of value.split(/\s+/)) {
|
|
36
|
+
if (token)
|
|
37
|
+
itemrefIds.add(token);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const itempropEls = document.querySelectorAll('[itemprop]');
|
|
41
|
+
for (const el of itempropEls) {
|
|
42
|
+
const hasAncestorScope = el.closest('[itemscope]') != null;
|
|
43
|
+
const id = el.getAttribute('id');
|
|
44
|
+
const isItemrefTarget = id != null && id !== '' && itemrefIds.has(id);
|
|
45
|
+
if (!hasAncestorScope && !isItemrefTarget) {
|
|
46
|
+
report({
|
|
47
|
+
scope: el,
|
|
48
|
+
message: t('{0} must {1}', t('the {0}', 'element'), 'belong to an item via an ancestor `itemscope` or be referenced by an `itemref`'),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Require the `for` attribute on a `<label>` element to reference an
|
|
3
|
+
* actual labelable element by ID. Per HTML LS §4.10.4: "If the attribute
|
|
4
|
+
* is specified, the attribute's value must be the ID of a labelable
|
|
5
|
+
* element in the same tree as the label element." Existence of the ID
|
|
6
|
+
* itself is the responsibility of `no-refer-to-non-existent-id`; this
|
|
7
|
+
* rule only checks the element type when the ID resolves.
|
|
8
|
+
*
|
|
9
|
+
* @see https://html.spec.whatwg.org/multipage/forms.html#attr-label-for
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, null>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import meta from './meta.js';
|
|
3
|
+
/**
|
|
4
|
+
* Labelable elements per HTML LS §4.10.2 *Categories: Labelable elements*.
|
|
5
|
+
* `<input>` is labelable except when its `type` is in the Hidden state; the
|
|
6
|
+
* `:not([type="hidden" i])` clause matches the spec exclusion ASCII
|
|
7
|
+
* case-insensitively.
|
|
8
|
+
*
|
|
9
|
+
* Known limitation: form-associated custom elements (HTML LS §4.13.5.9) are
|
|
10
|
+
* also labelable, but detecting this requires runtime `ElementInternals`
|
|
11
|
+
* inspection which is unavailable at parse time. This selector treats
|
|
12
|
+
* custom elements as non-labelable — same as `form-attr-references-form`
|
|
13
|
+
* and `input-list-references-datalist`.
|
|
14
|
+
*
|
|
15
|
+
* @see https://html.spec.whatwg.org/multipage/forms.html#category-label
|
|
16
|
+
*/
|
|
17
|
+
const LABELABLE_SELECTOR = [
|
|
18
|
+
'button',
|
|
19
|
+
'input:not([type="hidden" i])',
|
|
20
|
+
'meter',
|
|
21
|
+
'output',
|
|
22
|
+
'progress',
|
|
23
|
+
'select',
|
|
24
|
+
'textarea',
|
|
25
|
+
].join(',');
|
|
26
|
+
/**
|
|
27
|
+
* Require the `for` attribute on a `<label>` element to reference an
|
|
28
|
+
* actual labelable element by ID. Per HTML LS §4.10.4: "If the attribute
|
|
29
|
+
* is specified, the attribute's value must be the ID of a labelable
|
|
30
|
+
* element in the same tree as the label element." Existence of the ID
|
|
31
|
+
* itself is the responsibility of `no-refer-to-non-existent-id`; this
|
|
32
|
+
* rule only checks the element type when the ID resolves.
|
|
33
|
+
*
|
|
34
|
+
* @see https://html.spec.whatwg.org/multipage/forms.html#attr-label-for
|
|
35
|
+
*/
|
|
36
|
+
export default createRule({
|
|
37
|
+
meta: meta,
|
|
38
|
+
defaultValue: true,
|
|
39
|
+
defaultOptions: null,
|
|
40
|
+
async verify({ document, report, t }) {
|
|
41
|
+
await document.walkOn('Element', el => {
|
|
42
|
+
if (el.localName !== 'label')
|
|
43
|
+
return;
|
|
44
|
+
if (el.pretenderContext?.type === 'pretender' && !el.hasAttribute('as'))
|
|
45
|
+
return;
|
|
46
|
+
const forAttr = el.getAttributeNode('for');
|
|
47
|
+
if (!forAttr)
|
|
48
|
+
return;
|
|
49
|
+
if (forAttr.isDynamicValue)
|
|
50
|
+
return;
|
|
51
|
+
const targetId = forAttr.value;
|
|
52
|
+
const target = [...document.querySelectorAll('[id]')].find(candidate => candidate.getAttribute('id') === targetId);
|
|
53
|
+
// Existence is checked by `no-refer-to-non-existent-id`. If the ID does not resolve
|
|
54
|
+
// here, leave that diagnostic to the dedicated rule and stay silent.
|
|
55
|
+
if (!target)
|
|
56
|
+
return;
|
|
57
|
+
if (!target.matches(LABELABLE_SELECTOR)) {
|
|
58
|
+
report({
|
|
59
|
+
scope: forAttr,
|
|
60
|
+
line: forAttr.valueNode?.startLine,
|
|
61
|
+
col: forAttr.valueNode?.startCol,
|
|
62
|
+
raw: forAttr.valueNode?.raw,
|
|
63
|
+
message: t('The "{0}" attribute of the "{1}" element must reference a labelable element', 'for', 'label'),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Detects a `<label>` that is not associated with any control: it has no
|
|
3
|
+
* descendant elements at all and no `for` attribute. This is the only check
|
|
4
|
+
* this rule performs — a `<label>` with an excess of descendant controls is
|
|
5
|
+
* `label-no-multiple-controls`'s responsibility, which also accounts for the
|
|
6
|
+
* `for`-references-an-external-control case that this rule does not see.
|
|
7
7
|
*/
|
|
8
8
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
|
|
9
9
|
export default _default;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { createRule } from '@markuplint/ml-core';
|
|
2
2
|
import meta from './meta.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Rule that validates `<label>` elements are properly associated with form controls.
|
|
10
|
-
*
|
|
11
|
-
* Checks that each label either wraps a control or has a `for` attribute,
|
|
12
|
-
* and warns when a label contains more than one form control (only the first
|
|
13
|
-
* is associated per the HTML spec).
|
|
4
|
+
* Detects a `<label>` that is not associated with any control: it has no
|
|
5
|
+
* descendant elements at all and no `for` attribute. This is the only check
|
|
6
|
+
* this rule performs — a `<label>` with an excess of descendant controls is
|
|
7
|
+
* `label-no-multiple-controls`'s responsibility, which also accounts for the
|
|
8
|
+
* `for`-references-an-external-control case that this rule does not see.
|
|
14
9
|
*/
|
|
15
10
|
export default createRule({
|
|
16
11
|
meta: meta,
|
|
@@ -32,14 +27,6 @@ export default createRule({
|
|
|
32
27
|
message: t('{0} should associate with {1}', t('The "{0*}" {1}', 'label', 'element'), t('a {0}', 'control')),
|
|
33
28
|
});
|
|
34
29
|
}
|
|
35
|
-
const controls = el.querySelectorAll(controlSelector);
|
|
36
|
-
const secondControl = controls[1];
|
|
37
|
-
if (secondControl) {
|
|
38
|
-
report({
|
|
39
|
-
scope: secondControl,
|
|
40
|
-
message: t('{0} associates only {1}', t('The "{0*}" {1}', 'label', 'element'), t('first {0}', 'control')),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
30
|
});
|
|
44
31
|
},
|
|
45
32
|
});
|