@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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { followingElementSiblings } from '../srcset-sizes-constraint/sibling-helpers.js';
|
|
3
|
+
import meta from './meta.js';
|
|
4
|
+
/** Violation message for an always-matching `<source>`. */
|
|
5
|
+
const ALWAYS_MATCHING_SOURCE_MESSAGE = 'The "source" element must have a "media" or "type" attribute when it has a following sibling "source" or "img" element with a "srcset" attribute';
|
|
6
|
+
/**
|
|
7
|
+
* HTML LS § the source element: when a `<source>` has a following sibling
|
|
8
|
+
* `<source>` or `<img>` element with a `srcset` attribute specified, it must
|
|
9
|
+
* have a usable `media` and/or `type` attribute, otherwise it "always
|
|
10
|
+
* matches" and shadows the following candidates. Split out of the former
|
|
11
|
+
* `srcset-sizes-constraint` rule's Check 6.
|
|
12
|
+
*
|
|
13
|
+
* Whether the current `<source>` itself has a `srcset` is irrelevant — the
|
|
14
|
+
* requirement is about distinguishing it from what follows, not about its
|
|
15
|
+
* own candidates.
|
|
16
|
+
*/
|
|
17
|
+
export default createRule({
|
|
18
|
+
meta,
|
|
19
|
+
async verify({ document, report }) {
|
|
20
|
+
await document.walkOn('Element', el => {
|
|
21
|
+
if (el.localName !== 'source') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// source is only relevant inside <picture>
|
|
25
|
+
if (el.parentElement?.localName !== 'picture') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Skip if element has spread attributes (dynamic props)
|
|
29
|
+
if (el.hasSpreadAttr) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (isAlwaysMatchingSource(el)) {
|
|
33
|
+
report({ scope: el, message: ALWAYS_MATCHING_SOURCE_MESSAGE });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Whether a `media` attribute value is "always matching" per HTML LS, i.e. it
|
|
40
|
+
* does not distinguish the `<source>` from its siblings.
|
|
41
|
+
*
|
|
42
|
+
* A value is always-matching when, after stripping leading and trailing ASCII
|
|
43
|
+
* whitespace, it is the empty string or an ASCII case-insensitive match for the
|
|
44
|
+
* string `"all"`.
|
|
45
|
+
*
|
|
46
|
+
* ASCII whitespace (TAB, LF, FF, CR, SPACE) is stripped explicitly rather than
|
|
47
|
+
* via `String.prototype.trim`, which would also strip non-ASCII whitespace such
|
|
48
|
+
* as NBSP. A media value padded with NBSP around "all" is NOT
|
|
49
|
+
* always-matching per the spec and must keep its distinguishing media query.
|
|
50
|
+
*
|
|
51
|
+
* @param value - The raw `media` attribute value
|
|
52
|
+
* @returns `true` if the value is empty or `"all"` (case-insensitive)
|
|
53
|
+
*/
|
|
54
|
+
function isAlwaysMatchingMedia(value) {
|
|
55
|
+
const normalized = value.replaceAll(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g, '').toLowerCase();
|
|
56
|
+
return normalized === '' || normalized === 'all';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether a `<source>` "always matches" and so shadows the following
|
|
60
|
+
* candidates: it lacks a usable `media`/`type` attribute yet has a following
|
|
61
|
+
* sibling `<source>`/`<img>` with a `srcset` attribute. See HTML LS § the
|
|
62
|
+
* source element.
|
|
63
|
+
*
|
|
64
|
+
* A `type` attribute (any value, including dynamic) satisfies the requirement.
|
|
65
|
+
* A `media` attribute satisfies it only when its value is a non-always-matching
|
|
66
|
+
* media query; a dynamic value is unknown at lint time, so assume it qualifies
|
|
67
|
+
* to avoid false positives.
|
|
68
|
+
*
|
|
69
|
+
* @param el - The `<source>` element to test
|
|
70
|
+
* @returns `true` if the source must be reported as always-matching
|
|
71
|
+
*/
|
|
72
|
+
function isAlwaysMatchingSource(
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
74
|
+
el) {
|
|
75
|
+
const typeAttr = el.getAttributeNode('type');
|
|
76
|
+
const mediaAttr = el.getAttributeNode('media');
|
|
77
|
+
const hasUsableType = typeAttr != null;
|
|
78
|
+
const hasUsableMedia = mediaAttr != null && (mediaAttr.isDynamicValue || !isAlwaysMatchingMedia(mediaAttr.value));
|
|
79
|
+
return !hasUsableType && !hasUsableMedia && hasFollowingSrcsetSibling(el);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Whether the element has a following sibling `<source>` or `<img>` element
|
|
83
|
+
* with a `srcset` attribute specified.
|
|
84
|
+
*
|
|
85
|
+
* Per the spec the sibling does not have to be the immediately next sibling.
|
|
86
|
+
*
|
|
87
|
+
* @param el - The starting element to search from
|
|
88
|
+
* @returns `true` if such a following sibling exists
|
|
89
|
+
*/
|
|
90
|
+
function hasFollowingSrcsetSibling(
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
92
|
+
el) {
|
|
93
|
+
for (const sibling of followingElementSiblings(el)) {
|
|
94
|
+
if ((sibling.localName === 'source' || sibling.localName === 'img') &&
|
|
95
|
+
sibling.getAttributeNode('srcset') != null) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule that warns against ambiguous navigable target names.
|
|
3
|
-
*
|
|
4
|
-
* Detects attribute values (e.g., `target`) that look like browsing context
|
|
5
|
-
* keywords (such as `_blank`, `_self`) but are missing the leading underscore,
|
|
6
|
-
* which would make them navigable target names instead of keywords. Suggests
|
|
7
|
-
* adding the underscore prefix when applicable.
|
|
8
|
-
*/
|
|
9
1
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
10
2
|
export default _default;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { createRule, getAttrSpecs } from '@markuplint/ml-core';
|
|
2
2
|
import { valueCheck } from '../attr-check.js';
|
|
3
3
|
import meta from './meta.js';
|
|
4
|
-
/**
|
|
5
|
-
* Rule that warns against ambiguous navigable target names.
|
|
6
|
-
*
|
|
7
|
-
* Detects attribute values (e.g., `target`) that look like browsing context
|
|
8
|
-
* keywords (such as `_blank`, `_self`) but are missing the leading underscore,
|
|
9
|
-
* which would make them navigable target names instead of keywords. Suggests
|
|
10
|
-
* adding the underscore prefix when applicable.
|
|
11
|
-
*/
|
|
12
4
|
export default createRule({
|
|
13
5
|
meta: meta,
|
|
14
6
|
defaultSeverity: 'warning',
|
package/lib/{wai-aria-presentational-children → no-aria-on-presentational-children}/index.js
RENAMED
|
@@ -2,7 +2,6 @@ import { createRule, getSpec } from '@markuplint/ml-core';
|
|
|
2
2
|
import { checkingPresentationalChildren } from '../wai-aria/checkings/presentational-children.js';
|
|
3
3
|
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
4
4
|
import meta from './meta.js';
|
|
5
|
-
/** Warns when ARIA attributes are set on descendants of roles with presentational children. */
|
|
6
5
|
export default createRule({
|
|
7
6
|
meta,
|
|
8
7
|
defaultSeverity: 'warning',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracted from the former `wai-aria` umbrella rule (#3989), which always
|
|
3
|
+
* performed this check first, unconditionally, before any of its other
|
|
4
|
+
* (now independently-split) checks. No element in the bundled HTML / SVG /
|
|
5
|
+
* MathML spec data currently sets `globalAttrs['#ARIAAttrs']` to `false` —
|
|
6
|
+
* every element that declares the flag at all sets it `true` — so this rule
|
|
7
|
+
* has no reachable positive case against the current spec data; it exists
|
|
8
|
+
* to remain correct if a future spec update marks some element this way.
|
|
9
|
+
*/
|
|
10
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRule, getSpec } from '@markuplint/ml-core';
|
|
2
|
+
import { Collection } from '../helpers.js';
|
|
3
|
+
import meta from './meta.js';
|
|
4
|
+
/**
|
|
5
|
+
* Extracted from the former `wai-aria` umbrella rule (#3989), which always
|
|
6
|
+
* performed this check first, unconditionally, before any of its other
|
|
7
|
+
* (now independently-split) checks. No element in the bundled HTML / SVG /
|
|
8
|
+
* MathML spec data currently sets `globalAttrs['#ARIAAttrs']` to `false` —
|
|
9
|
+
* every element that declares the flag at all sets it `true` — so this rule
|
|
10
|
+
* has no reachable positive case against the current spec data; it exists
|
|
11
|
+
* to remain correct if a future spec update marks some element this way.
|
|
12
|
+
*/
|
|
13
|
+
export default createRule({
|
|
14
|
+
meta: meta,
|
|
15
|
+
async verify({ document, report, t }) {
|
|
16
|
+
await document.walkOn('Element', el => {
|
|
17
|
+
const elSpec = getSpec(el, document.specs.specs);
|
|
18
|
+
if (!elSpec) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (elSpec.globalAttrs['#ARIAAttrs']) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const roleAttr = el.getAttributeNode('role');
|
|
25
|
+
const propAttrs = el.attributes.filter(attr => /^aria-/i.test(attr.name));
|
|
26
|
+
const ariaAttrs = new Collection(roleAttr, ...propAttrs);
|
|
27
|
+
for (const ariaAttr of ariaAttrs) {
|
|
28
|
+
report({
|
|
29
|
+
scope: ariaAttr,
|
|
30
|
+
message: t('{0} is {1:c}', t('the "{0*}" {1}', ariaAttr.name, 'attribute'), 'disallowed'),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly category: "a11y";
|
|
3
|
+
readonly specConformance: {
|
|
4
|
+
readonly sources: readonly ["aria-in-html"];
|
|
5
|
+
readonly level: "must";
|
|
6
|
+
readonly cites: readonly ["https://w3c.github.io/html-aria/#docconformance"];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule that disallows explicit values on boolean attributes.
|
|
3
|
-
*
|
|
4
|
-
* Checks each attribute against the HTML spec and reports when a boolean
|
|
5
|
-
* attribute (e.g., `disabled`, `checked`) is written with an explicit value
|
|
6
|
-
* such as `disabled="disabled"` instead of the bare attribute name.
|
|
7
|
-
*/
|
|
8
1
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
|
|
9
2
|
export default _default;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { createRule, getAttrSpecs } from '@markuplint/ml-core';
|
|
2
2
|
import { removeAttrValue } from '../helpers.js';
|
|
3
3
|
import meta from './meta.js';
|
|
4
|
-
/**
|
|
5
|
-
* Rule that disallows explicit values on boolean attributes.
|
|
6
|
-
*
|
|
7
|
-
* Checks each attribute against the HTML spec and reports when a boolean
|
|
8
|
-
* attribute (e.g., `disabled`, `checked`) is written with an explicit value
|
|
9
|
-
* such as `disabled="disabled"` instead of the bare attribute name.
|
|
10
|
-
*/
|
|
11
4
|
export default createRule({
|
|
12
5
|
meta: meta,
|
|
13
6
|
defaultSeverity: 'warning',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split out of the former `no-refer-to-non-existent-id` rule. Unlike the
|
|
3
|
+
* `DOMID`-typed attributes and ARIA ID references that rule covers, HTML LS
|
|
4
|
+
* does not treat a broken hyperlink fragment as a conformance violation —
|
|
5
|
+
* scrolling to a fragment simply does nothing when its target is absent
|
|
6
|
+
* (§ Scrolling to a fragment). Reporting it is still useful (almost always
|
|
7
|
+
* an author mistake), which is why the default severity stays `warning`
|
|
8
|
+
* rather than `no-refer-to-non-existent-id`'s `error`.
|
|
9
|
+
*
|
|
10
|
+
* @see https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
|
|
13
|
+
fragmentRefersNameAttr: boolean;
|
|
14
|
+
}>>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { decodeEntities, decodeHref } from '@markuplint/shared';
|
|
3
|
+
import meta from './meta.js';
|
|
4
|
+
/** CSS selector matching hyperlink elements that have an `href` attribute. */
|
|
5
|
+
const HYPERLINK_SELECTOR = 'a[href], area[href]';
|
|
6
|
+
/**
|
|
7
|
+
* Split out of the former `no-refer-to-non-existent-id` rule. Unlike the
|
|
8
|
+
* `DOMID`-typed attributes and ARIA ID references that rule covers, HTML LS
|
|
9
|
+
* does not treat a broken hyperlink fragment as a conformance violation —
|
|
10
|
+
* scrolling to a fragment simply does nothing when its target is absent
|
|
11
|
+
* (§ Scrolling to a fragment). Reporting it is still useful (almost always
|
|
12
|
+
* an author mistake), which is why the default severity stays `warning`
|
|
13
|
+
* rather than `no-refer-to-non-existent-id`'s `error`.
|
|
14
|
+
*
|
|
15
|
+
* @see https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
16
|
+
*/
|
|
17
|
+
export default createRule({
|
|
18
|
+
meta: meta,
|
|
19
|
+
defaultSeverity: 'warning',
|
|
20
|
+
defaultOptions: {
|
|
21
|
+
fragmentRefersNameAttr: false,
|
|
22
|
+
},
|
|
23
|
+
async verify({ document, report, t }) {
|
|
24
|
+
const idList = new Set();
|
|
25
|
+
const nameList = new Set();
|
|
26
|
+
let hasDynamicId = false;
|
|
27
|
+
let hasDynamicName = false;
|
|
28
|
+
const isMutable = document.nodeList.some(node => node.is(node.MARKUPLINT_PREPROCESSOR_BLOCK));
|
|
29
|
+
if (isMutable) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const el of document.querySelectorAll('[id]')) {
|
|
33
|
+
const attr = el.getAttributeNode('id');
|
|
34
|
+
if (!attr) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (attr.isDynamicValue) {
|
|
38
|
+
hasDynamicId = true;
|
|
39
|
+
}
|
|
40
|
+
if (attr.valueType !== 'code') {
|
|
41
|
+
idList.add(decodeEntities(attr.value));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (hasDynamicId) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
for (const el of document.querySelectorAll('[name]')) {
|
|
48
|
+
const attr = el.getAttributeNode('name');
|
|
49
|
+
if (!attr) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (attr.isDynamicValue) {
|
|
53
|
+
hasDynamicName = true;
|
|
54
|
+
}
|
|
55
|
+
if (attr.valueType !== 'code') {
|
|
56
|
+
nameList.add(decodeEntities(attr.value));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
await document.walkOn('Element', el => {
|
|
60
|
+
if (el.rule.options.fragmentRefersNameAttr && hasDynamicName) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!el.matches(HYPERLINK_SELECTOR)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const href = el.getAttributeNode('href');
|
|
67
|
+
if (!href) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const rawFragment = href.value.match(/^#(.+)/)?.[1];
|
|
71
|
+
if (rawFragment == null) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const decodedFragment = decodeHref(rawFragment);
|
|
75
|
+
// > 2. If fragment is the empty string, then return the special value top of the document.
|
|
76
|
+
// >
|
|
77
|
+
// > 9. If decodedFragment is an ASCII case-insensitive match for the string top, then return the top of the document.
|
|
78
|
+
if (decodedFragment === '' || /^top$/i.test(decodedFragment)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!idList.has(decodedFragment) &&
|
|
82
|
+
(el.rule.options.fragmentRefersNameAttr ? !nameList.has(decodedFragment) : true)) {
|
|
83
|
+
report({
|
|
84
|
+
scope: href,
|
|
85
|
+
line: href.valueNode?.startLine,
|
|
86
|
+
col: href.valueNode?.startCol,
|
|
87
|
+
raw: href.valueNode?.raw,
|
|
88
|
+
message: t('Missing {0}', t('"{0*}" ID', decodedFragment)),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
});
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule that disallows consecutive `<br>` elements.
|
|
3
|
-
*
|
|
4
|
-
* Queries all `<br>` elements in the document and checks whether the next
|
|
5
|
-
* non-whitespace sibling is another `<br>`. Consecutive line breaks are
|
|
6
|
-
* typically a sign that a more semantic element (e.g., `<p>`) should be
|
|
7
|
-
* used instead, which is important for accessibility.
|
|
8
|
-
*/
|
|
9
1
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
|
|
10
2
|
export default _default;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { createRule } from '@markuplint/ml-core';
|
|
2
2
|
import meta from './meta.js';
|
|
3
|
-
/**
|
|
4
|
-
* Rule that disallows consecutive `<br>` elements.
|
|
5
|
-
*
|
|
6
|
-
* Queries all `<br>` elements in the document and checks whether the next
|
|
7
|
-
* non-whitespace sibling is another `<br>`. Consecutive line breaks are
|
|
8
|
-
* typically a sign that a more semantic element (e.g., `<p>`) should be
|
|
9
|
-
* used instead, which is important for accessibility.
|
|
10
|
-
*/
|
|
11
3
|
export default createRule({
|
|
12
4
|
meta: meta,
|
|
13
5
|
defaultSeverity: 'warning',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML LS "after body" insertion mode:
|
|
3
|
+
*
|
|
4
|
+
* > An end-of-file token: Stop parsing.
|
|
5
|
+
* >
|
|
6
|
+
* > Anything else: Parse error. Switch the insertion mode to "in body" and
|
|
7
|
+
* > reprocess the token.
|
|
8
|
+
*
|
|
9
|
+
* Whitespace characters (U+0009/000A/000C/000D/0020) have their own case one
|
|
10
|
+
* step above ("process using the rules for the 'in body' insertion mode"
|
|
11
|
+
* without the parse error), so a trailing newline after `</body>` is normal
|
|
12
|
+
* and out of scope here — only a start tag or non-whitespace text reaching
|
|
13
|
+
* this insertion mode is the "Anything else" parse error. Because the
|
|
14
|
+
* reprocessing switches back to "in body", the offending content still ends
|
|
15
|
+
* up nested inside `<body>` in the resulting tree even though, in the
|
|
16
|
+
* source, it appears after `<body>`'s own end tag.
|
|
17
|
+
*
|
|
18
|
+
* Scoped to `<body>`'s direct children: anything deeper (e.g. text inside a
|
|
19
|
+
* later `<script>`) is that descendant's own content, not a stray token that
|
|
20
|
+
* arrived after the body boundary closed.
|
|
21
|
+
*
|
|
22
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-afterbody
|
|
23
|
+
*/
|
|
24
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import meta from './meta.js';
|
|
3
|
+
/**
|
|
4
|
+
* HTML LS "after body" insertion mode:
|
|
5
|
+
*
|
|
6
|
+
* > An end-of-file token: Stop parsing.
|
|
7
|
+
* >
|
|
8
|
+
* > Anything else: Parse error. Switch the insertion mode to "in body" and
|
|
9
|
+
* > reprocess the token.
|
|
10
|
+
*
|
|
11
|
+
* Whitespace characters (U+0009/000A/000C/000D/0020) have their own case one
|
|
12
|
+
* step above ("process using the rules for the 'in body' insertion mode"
|
|
13
|
+
* without the parse error), so a trailing newline after `</body>` is normal
|
|
14
|
+
* and out of scope here — only a start tag or non-whitespace text reaching
|
|
15
|
+
* this insertion mode is the "Anything else" parse error. Because the
|
|
16
|
+
* reprocessing switches back to "in body", the offending content still ends
|
|
17
|
+
* up nested inside `<body>` in the resulting tree even though, in the
|
|
18
|
+
* source, it appears after `<body>`'s own end tag.
|
|
19
|
+
*
|
|
20
|
+
* Scoped to `<body>`'s direct children: anything deeper (e.g. text inside a
|
|
21
|
+
* later `<script>`) is that descendant's own content, not a stray token that
|
|
22
|
+
* arrived after the body boundary closed.
|
|
23
|
+
*
|
|
24
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-afterbody
|
|
25
|
+
*/
|
|
26
|
+
export default createRule({
|
|
27
|
+
meta: meta,
|
|
28
|
+
verify({ document, report, t }) {
|
|
29
|
+
const body = document.querySelector('body');
|
|
30
|
+
if (!body?.closeTag)
|
|
31
|
+
return;
|
|
32
|
+
const bodyCloseEnd = body.closeTag.startOffset + body.closeTag.raw.length;
|
|
33
|
+
for (const child of body.childNodes) {
|
|
34
|
+
if (child.startOffset < bodyCloseEnd)
|
|
35
|
+
continue;
|
|
36
|
+
if (child.is(child.ELEMENT_NODE)) {
|
|
37
|
+
report({
|
|
38
|
+
scope: child,
|
|
39
|
+
message: t('Content after the end tag of the "{0}" element is not allowed', 'body'),
|
|
40
|
+
});
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (child.is(child.TEXT_NODE) && child.raw.trim() !== '') {
|
|
44
|
+
report({
|
|
45
|
+
scope: child,
|
|
46
|
+
message: t('Content after the end tag of the "{0}" element is not allowed', 'body'),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Options } from '../wai-aria/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Split from the former `wai-aria-implicit-props` rule (#3989): the
|
|
4
|
+
* "contradictory" half. See `checkingContradictoryAriaProp`'s JSDoc for the
|
|
5
|
+
* full spec citation. Must-level (ARIA in HTML §6 conformance), so this rule
|
|
6
|
+
* uses the default `error` severity — contrast `no-redundant-aria-prop`'s
|
|
7
|
+
* should-level `warning`, which the former combined rule used uniformly.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRule, ariaSpecs, getAttrSpecs, getSpec } from '@markuplint/ml-core';
|
|
2
|
+
import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
3
|
+
import { checkingContradictoryAriaProp } from '../wai-aria/checkings/contradictory-aria-prop.js';
|
|
4
|
+
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
5
|
+
import meta from './meta.js';
|
|
6
|
+
/**
|
|
7
|
+
* Split from the former `wai-aria-implicit-props` rule (#3989): the
|
|
8
|
+
* "contradictory" half. See `checkingContradictoryAriaProp`'s JSDoc for the
|
|
9
|
+
* full spec citation. Must-level (ARIA in HTML §6 conformance), so this rule
|
|
10
|
+
* uses the default `error` severity — contrast `no-redundant-aria-prop`'s
|
|
11
|
+
* should-level `warning`, which the former combined rule used uniformly.
|
|
12
|
+
*/
|
|
13
|
+
export default createRule({
|
|
14
|
+
meta,
|
|
15
|
+
defaultOptions,
|
|
16
|
+
async verify({ document, report }) {
|
|
17
|
+
await document.walkOn('Element', el => {
|
|
18
|
+
const elSpec = getSpec(el, document.specs.specs);
|
|
19
|
+
if (!elSpec)
|
|
20
|
+
return;
|
|
21
|
+
if (!elSpec.globalAttrs['#ARIAAttrs'])
|
|
22
|
+
return;
|
|
23
|
+
const propAttrs = el.attributes.filter(attr => /^aria-/i.test(attr.name));
|
|
24
|
+
if (propAttrs.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
|
|
27
|
+
const { props: propSpecs } = ariaSpecs(document.specs, ariaVersion);
|
|
28
|
+
const attrSpecs = getAttrSpecs(el, document.specs);
|
|
29
|
+
for (const attr of propAttrs) {
|
|
30
|
+
report(checkingContradictoryAriaProp({ attr, propSpecs, attrSpecs }));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -3,7 +3,6 @@ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
|
3
3
|
import { checkingDefaultValue } from '../wai-aria/checkings/default-value.js';
|
|
4
4
|
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
5
5
|
import meta from './meta.js';
|
|
6
|
-
/** Warns when an ARIA property is explicitly set to its spec-defined default value. */
|
|
7
6
|
export default createRule({
|
|
8
7
|
meta,
|
|
9
8
|
defaultSeverity: 'warning',
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule that disallows explicitly setting an attribute to its default value.
|
|
3
|
-
*
|
|
4
|
-
* Looks up each attribute's default value from the spec and reports when
|
|
5
|
-
* the authored value matches the default, since the attribute can be
|
|
6
|
-
* omitted entirely for the same effect.
|
|
7
|
-
*/
|
|
8
1
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
|
|
9
2
|
export default _default;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { createRule, getAttrSpecs } from '@markuplint/ml-core';
|
|
2
2
|
import { removeAttr, toNormalizedValue } from '../helpers.js';
|
|
3
3
|
import meta from './meta.js';
|
|
4
|
-
/**
|
|
5
|
-
* Rule that disallows explicitly setting an attribute to its default value.
|
|
6
|
-
*
|
|
7
|
-
* Looks up each attribute's default value from the spec and reports when
|
|
8
|
-
* the authored value matches the default, since the attribute can be
|
|
9
|
-
* omitted entirely for the same effect.
|
|
10
|
-
*/
|
|
11
4
|
export default createRule({
|
|
12
5
|
meta: meta,
|
|
13
6
|
defaultSeverity: 'warning',
|
|
@@ -3,7 +3,6 @@ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
|
3
3
|
import { checkingDeprecatedProps } from '../wai-aria/checkings/deprecated-props.js';
|
|
4
4
|
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
5
5
|
import meta from './meta.js';
|
|
6
|
-
/** Warns when a deprecated ARIA property or state is used on a role. */
|
|
7
6
|
export default createRule({
|
|
8
7
|
meta,
|
|
9
8
|
defaultSeverity: 'warning',
|