@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,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps every rule name removed or renamed by the v5 rule-system redesign
|
|
3
|
+
* (#3989) to how it expands into its current replacement(s). Consumed by
|
|
4
|
+
* `markuplint`'s config resolution via `@markuplint/ml-config`'s
|
|
5
|
+
* `applyRuleAliases`, so a user's existing configuration keeps working
|
|
6
|
+
* (with a deprecation notice) instead of silently losing checks.
|
|
7
|
+
*
|
|
8
|
+
* Populated incrementally, one entry per rename/split commit, once the
|
|
9
|
+
* replacement rule(s) exist — see `spec-conformance.spec.ts` for the
|
|
10
|
+
* matching incremental rollout of `meta.specConformance`. Removed in v6
|
|
11
|
+
* alongside the deprecated names themselves.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* A 1:1 rename: the old name's resolved configuration passes through
|
|
15
|
+
* unchanged under the new name.
|
|
16
|
+
*/
|
|
17
|
+
function renamed(newName) {
|
|
18
|
+
return {
|
|
19
|
+
expand: rule => ({ [newName]: rule }),
|
|
20
|
+
targets: [newName],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A 1:N split where every replacement takes the exact same configuration
|
|
25
|
+
* (severity/reason/options passed through unchanged to each) — for rules
|
|
26
|
+
* with no options whose single check split by *what it checks* rather than
|
|
27
|
+
* by *option*, e.g. `deprecated-attr`'s `obsolete`/`deprecated` split.
|
|
28
|
+
*/
|
|
29
|
+
function split(...newNames) {
|
|
30
|
+
return {
|
|
31
|
+
expand: rule => Object.fromEntries(newNames.map(name => [name, rule])),
|
|
32
|
+
targets: newNames,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** `AnyRule` is either a bare boolean/value shorthand or a full `RuleConfig` object. */
|
|
36
|
+
function normalize(rule) {
|
|
37
|
+
if (typeof rule !== 'object' || rule === null) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
const { severity, options, reason, reasonOnly } = rule;
|
|
41
|
+
return { severity, options, reason, reasonOnly };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether `rule` disables the rule outright — either the bare `false`
|
|
45
|
+
* shorthand, or the long form `{ value: false, ... }` (meaningful for the
|
|
46
|
+
* boolean-`value`-typed rules every custom `expand` function in this file
|
|
47
|
+
* operates on, where `value` doubles as the enable flag).
|
|
48
|
+
*/
|
|
49
|
+
function isDisabled(rule) {
|
|
50
|
+
if (rule === false) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return typeof rule === 'object' && rule !== null && rule.value === false;
|
|
54
|
+
}
|
|
55
|
+
function withOptions(rule, options) {
|
|
56
|
+
if (isDisabled(rule)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const { severity, reason, reasonOnly } = normalize(rule);
|
|
60
|
+
return {
|
|
61
|
+
value: true,
|
|
62
|
+
...(severity && { severity }),
|
|
63
|
+
...(options && Object.keys(options).length > 0 && { options }),
|
|
64
|
+
...(reason && { reason }),
|
|
65
|
+
...(reasonOnly && { reasonOnly }),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `invalid-attr`'s single check split four ways (v5 rule-system redesign):
|
|
70
|
+
* `no-unknown-attr` (name not in spec at all), `no-disallowed-attr` (name
|
|
71
|
+
* known but disallowed here — `noUse` / unmet `condition` / `is` on an
|
|
72
|
+
* autonomous custom element), `no-invalid-attr-value` (value/type
|
|
73
|
+
* violation), and `no-restricted-attr` (purely user-defined `disallowAttrs`
|
|
74
|
+
* denylisting, replacing the old rule's narrow named-rule mode).
|
|
75
|
+
*
|
|
76
|
+
* `allowAttrs` extends what a spec-validating rule considers valid, so it
|
|
77
|
+
* is copied to all three of them: it can suppress `no-unknown-attr` and
|
|
78
|
+
* `no-disallowed-attr`'s reports for a name, and supplies the value type
|
|
79
|
+
* `no-invalid-attr-value` checks against for names the spec doesn't define.
|
|
80
|
+
* `ignoreAttrNamePrefix` is copied to the two name-eligibility rules only —
|
|
81
|
+
* `no-invalid-attr-value` never reports for a name neither rule recognizes,
|
|
82
|
+
* so it needs no exclusion list of its own. `allowToAddPropertiesForPretender`
|
|
83
|
+
* moves to `no-unknown-attr` alone: it is specifically the pretender escape
|
|
84
|
+
* hatch for the "this name doesn't exist" report. `disallowAttrs` moves to
|
|
85
|
+
* `no-restricted-attr` alone — only included when actually configured, so a
|
|
86
|
+
* plain `invalid-attr: true` (no options) never turns on a rule with
|
|
87
|
+
* nothing to restrict.
|
|
88
|
+
*/
|
|
89
|
+
function expandInvalidAttr(rule) {
|
|
90
|
+
const { options } = normalize(rule);
|
|
91
|
+
const allowAttrs = options?.allowAttrs;
|
|
92
|
+
const disallowAttrs = options?.disallowAttrs;
|
|
93
|
+
const ignoreAttrNamePrefix = options?.ignoreAttrNamePrefix;
|
|
94
|
+
const allowToAddPropertiesForPretender = options?.allowToAddPropertiesForPretender;
|
|
95
|
+
const expanded = {
|
|
96
|
+
'no-unknown-attr': withOptions(rule, {
|
|
97
|
+
...(allowAttrs !== undefined && { allowAttrs }),
|
|
98
|
+
...(ignoreAttrNamePrefix !== undefined && { ignoreAttrNamePrefix }),
|
|
99
|
+
...(allowToAddPropertiesForPretender !== undefined && { allowToAddPropertiesForPretender }),
|
|
100
|
+
}),
|
|
101
|
+
'no-disallowed-attr': withOptions(rule, {
|
|
102
|
+
...(allowAttrs !== undefined && { allowAttrs }),
|
|
103
|
+
...(ignoreAttrNamePrefix !== undefined && { ignoreAttrNamePrefix }),
|
|
104
|
+
}),
|
|
105
|
+
'no-invalid-attr-value': withOptions(rule, {
|
|
106
|
+
...(allowAttrs !== undefined && { allowAttrs }),
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
if (disallowAttrs !== undefined) {
|
|
110
|
+
expanded['no-restricted-attr'] = withOptions(rule, { disallowAttrs });
|
|
111
|
+
}
|
|
112
|
+
return expanded;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* `landmark-roles` split two ways: `no-nested-top-level-landmark` (the
|
|
116
|
+
* `ignoreRoles` half — always present, `ignoreRoles` carried over unchanged)
|
|
117
|
+
* and `require-landmark-label` (the `labelEachArea` half, included unless
|
|
118
|
+
* the user explicitly set `labelEachArea: false` to opt out of it; the split
|
|
119
|
+
* rule has no such option itself, so there is nothing to carry over beyond
|
|
120
|
+
* whether it runs at all).
|
|
121
|
+
*/
|
|
122
|
+
function expandLandmarkRoles(rule) {
|
|
123
|
+
const { options } = normalize(rule);
|
|
124
|
+
const ignoreRoles = options?.ignoreRoles;
|
|
125
|
+
const labelEachArea = options?.labelEachArea;
|
|
126
|
+
const expanded = {
|
|
127
|
+
'no-nested-top-level-landmark': withOptions(rule, {
|
|
128
|
+
...(ignoreRoles !== undefined && { ignoreRoles }),
|
|
129
|
+
}),
|
|
130
|
+
};
|
|
131
|
+
if (labelEachArea !== false) {
|
|
132
|
+
expanded['require-landmark-label'] = withOptions(rule);
|
|
133
|
+
}
|
|
134
|
+
return expanded;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* `required-h1` split two ways: `require-h1` (the missing-`<h1>` half —
|
|
138
|
+
* always present regardless of the old options) and `no-duplicate-h1` (the
|
|
139
|
+
* `expected-once` half, included unless the user explicitly set
|
|
140
|
+
* `expected-once: false` to opt out of it). `in-document-fragment` is
|
|
141
|
+
* shared by both halves, so it is copied to each.
|
|
142
|
+
*/
|
|
143
|
+
function expandRequiredH1(rule) {
|
|
144
|
+
const { options } = normalize(rule);
|
|
145
|
+
const inDocumentFragment = options?.['in-document-fragment'];
|
|
146
|
+
const expectedOnce = options?.['expected-once'];
|
|
147
|
+
const sharedOptions = inDocumentFragment === undefined ? undefined : { 'in-document-fragment': inDocumentFragment };
|
|
148
|
+
const expanded = {
|
|
149
|
+
'require-h1': withOptions(rule, sharedOptions),
|
|
150
|
+
};
|
|
151
|
+
if (expectedOnce !== false) {
|
|
152
|
+
expanded['no-duplicate-h1'] = withOptions(rule, sharedOptions);
|
|
153
|
+
}
|
|
154
|
+
return expanded;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* `no-unsupported-features` split three ways: `no-unsupported-browser-features`
|
|
158
|
+
* (the browserslist-based check — always present, `browserslist` /
|
|
159
|
+
* `browserslistConfig` / `browserslistEnv` carried over unchanged),
|
|
160
|
+
* `no-experimental-features` (the `checkExperimental` half, included only
|
|
161
|
+
* when that option was `true` — the split rule has no toggle of its own,
|
|
162
|
+
* enabling it IS the toggle), and `no-nonstandard-features` (the
|
|
163
|
+
* `checkNonStandard` half, same reasoning). `ignoreFeatures` is shared by
|
|
164
|
+
* all three, so it is copied to each.
|
|
165
|
+
*/
|
|
166
|
+
function expandNoUnsupportedFeatures(rule) {
|
|
167
|
+
const { options } = normalize(rule);
|
|
168
|
+
const browserslist = options?.browserslist;
|
|
169
|
+
const browserslistConfig = options?.browserslistConfig;
|
|
170
|
+
const browserslistEnv = options?.browserslistEnv;
|
|
171
|
+
const ignoreFeatures = options?.ignoreFeatures;
|
|
172
|
+
const checkExperimental = options?.checkExperimental;
|
|
173
|
+
const checkNonStandard = options?.checkNonStandard;
|
|
174
|
+
const expanded = {
|
|
175
|
+
'no-unsupported-browser-features': withOptions(rule, {
|
|
176
|
+
...(browserslist !== undefined && { browserslist }),
|
|
177
|
+
...(browserslistConfig !== undefined && { browserslistConfig }),
|
|
178
|
+
...(browserslistEnv !== undefined && { browserslistEnv }),
|
|
179
|
+
...(ignoreFeatures !== undefined && { ignoreFeatures }),
|
|
180
|
+
}),
|
|
181
|
+
};
|
|
182
|
+
if (checkExperimental) {
|
|
183
|
+
expanded['no-experimental-features'] = withOptions(rule, {
|
|
184
|
+
...(ignoreFeatures !== undefined && { ignoreFeatures }),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
if (checkNonStandard) {
|
|
188
|
+
expanded['no-nonstandard-features'] = withOptions(rule, {
|
|
189
|
+
...(ignoreFeatures !== undefined && { ignoreFeatures }),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return expanded;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Every rule the `wai-aria` umbrella rule used to run a check for — the
|
|
196
|
+
* pre-existing 1:1-renamed/split successors, plus `no-aria-on-unsupported-element`
|
|
197
|
+
* (the `#ARIAAttrs: false` check the umbrella alone used to perform, before
|
|
198
|
+
* any of its per-check option toggles were even consulted).
|
|
199
|
+
*/
|
|
200
|
+
const WAI_ARIA_TARGETS = [
|
|
201
|
+
'no-aria-on-unsupported-element',
|
|
202
|
+
'no-unknown-role',
|
|
203
|
+
'no-abstract-role',
|
|
204
|
+
'require-parent-role',
|
|
205
|
+
'require-aria-prop',
|
|
206
|
+
'no-deprecated-role',
|
|
207
|
+
'no-redundant-role',
|
|
208
|
+
'permitted-roles',
|
|
209
|
+
'no-prohibited-naming',
|
|
210
|
+
'element-supports-aria-prop',
|
|
211
|
+
'role-supports-aria-prop',
|
|
212
|
+
'no-deprecated-aria-prop',
|
|
213
|
+
'no-redundant-aria-prop',
|
|
214
|
+
'no-contradictory-aria-prop',
|
|
215
|
+
'no-invalid-aria-prop-value',
|
|
216
|
+
'no-default-aria-value',
|
|
217
|
+
'aria-prop-requires-role',
|
|
218
|
+
'require-owned-elements',
|
|
219
|
+
'no-aria-on-presentational-children',
|
|
220
|
+
'no-focusable-in-aria-hidden',
|
|
221
|
+
'tab-requires-tabpanel',
|
|
222
|
+
];
|
|
223
|
+
/**
|
|
224
|
+
* `wai-aria: v` expands to every rule in `WAI_ARIA_TARGETS`, all receiving
|
|
225
|
+
* the same severity/reason (bare `withOptions(rule)`, no `options`). The
|
|
226
|
+
* umbrella's own per-check option toggles (`checkingDeprecatedRole`,
|
|
227
|
+
* `disallowSetImplicitProps`, `version`, etc.) have no successor to route
|
|
228
|
+
* to: each of these rules already ran its single check unconditionally
|
|
229
|
+
* once split off from the umbrella in an earlier step, and none of their
|
|
230
|
+
* schemas accept an `options` object at all — passing the toggles through
|
|
231
|
+
* would fail every target's schema validation, not silently no-op.
|
|
232
|
+
*/
|
|
233
|
+
function expandWaiAria(rule) {
|
|
234
|
+
const bare = withOptions(rule);
|
|
235
|
+
return Object.fromEntries(WAI_ARIA_TARGETS.map(name => [name, bare]));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* `doctype` split two ways: `require-doctype` (missing-DOCTYPE-entirely, the
|
|
239
|
+
* `value: 'always'` half — always present regardless of the old options) and
|
|
240
|
+
* `no-obsolete-doctype` (the `denyObsoleteType` half, included unless the
|
|
241
|
+
* user explicitly set `denyObsoleteType: false` to opt out of it).
|
|
242
|
+
*/
|
|
243
|
+
function expandDoctype(rule) {
|
|
244
|
+
const { options } = normalize(rule);
|
|
245
|
+
const denyObsoleteType = options?.denyObsoleteType;
|
|
246
|
+
const expanded = {
|
|
247
|
+
'require-doctype': withOptions(rule),
|
|
248
|
+
};
|
|
249
|
+
if (denyObsoleteType !== false) {
|
|
250
|
+
expanded['no-obsolete-doctype'] = withOptions(rule);
|
|
251
|
+
}
|
|
252
|
+
return expanded;
|
|
253
|
+
}
|
|
254
|
+
export const ruleAliasTable = {
|
|
255
|
+
doctype: {
|
|
256
|
+
expand: expandDoctype,
|
|
257
|
+
targets: ['require-doctype', 'no-obsolete-doctype'],
|
|
258
|
+
},
|
|
259
|
+
'deprecated-attr': split('no-obsolete-attr', 'no-deprecated-attr'),
|
|
260
|
+
'deprecated-element': split('no-obsolete-element', 'no-deprecated-element'),
|
|
261
|
+
'character-reference': split('no-malformed-character-reference', 'no-unescaped-char'),
|
|
262
|
+
'table-row-column-alignment': split('no-table-cell-overlap', 'no-table-span-overflow', 'no-empty-table-track', 'consistent-table-row-length'),
|
|
263
|
+
'script-content': split('valid-importmap', 'valid-speculation-rules'),
|
|
264
|
+
'srcset-sizes-constraint': split('no-unpaired-srcset-sizes', 'no-mixed-srcset-descriptors', 'sizes-auto-requires-lazy-loading', 'no-always-matching-source'),
|
|
265
|
+
'wai-aria-disallowed-props': split('no-prohibited-naming', 'element-supports-aria-prop', 'role-supports-aria-prop'),
|
|
266
|
+
'wai-aria-implicit-props': split('no-redundant-aria-prop', 'no-contradictory-aria-prop'),
|
|
267
|
+
'landmark-roles': {
|
|
268
|
+
expand: expandLandmarkRoles,
|
|
269
|
+
targets: ['no-nested-top-level-landmark', 'require-landmark-label'],
|
|
270
|
+
},
|
|
271
|
+
'required-h1': {
|
|
272
|
+
expand: expandRequiredH1,
|
|
273
|
+
targets: ['require-h1', 'no-duplicate-h1'],
|
|
274
|
+
},
|
|
275
|
+
'no-unsupported-features': {
|
|
276
|
+
expand: expandNoUnsupportedFeatures,
|
|
277
|
+
targets: ['no-unsupported-browser-features', 'no-experimental-features', 'no-nonstandard-features'],
|
|
278
|
+
},
|
|
279
|
+
'wai-aria': {
|
|
280
|
+
expand: expandWaiAria,
|
|
281
|
+
targets: WAI_ARIA_TARGETS,
|
|
282
|
+
},
|
|
283
|
+
'attr-duplication': renamed('no-duplicate-attr'),
|
|
284
|
+
'id-duplication': renamed('no-duplicate-id'),
|
|
285
|
+
'required-element': renamed('require-element'),
|
|
286
|
+
'ineffective-attr': renamed('no-ineffective-attr'),
|
|
287
|
+
'end-tag': renamed('require-end-tag'),
|
|
288
|
+
'disallowed-element': renamed('no-restricted-element'),
|
|
289
|
+
'correct-aspect-ratio': renamed('no-mismatched-aspect-ratio'),
|
|
290
|
+
'heading-levels': renamed('no-skipped-heading-level'),
|
|
291
|
+
'input-file-empty-value': renamed('no-input-file-value'),
|
|
292
|
+
'neighbor-popovers': renamed('require-adjacent-popover'),
|
|
293
|
+
'no-hard-code-id': renamed('no-hardcoded-id'),
|
|
294
|
+
'no-use-event-handler-attr': renamed('no-event-handler-attr'),
|
|
295
|
+
'redundant-accessible-name': renamed('no-redundant-accessible-name'),
|
|
296
|
+
'use-list': renamed('no-pseudo-list'),
|
|
297
|
+
'wai-aria-abstract-role': renamed('no-abstract-role'),
|
|
298
|
+
'wai-aria-deprecated-role': renamed('no-deprecated-role'),
|
|
299
|
+
'wai-aria-deprecated-props': renamed('no-deprecated-aria-prop'),
|
|
300
|
+
'wai-aria-default-value': renamed('no-default-aria-value'),
|
|
301
|
+
'wai-aria-implicit-role': renamed('no-redundant-role'),
|
|
302
|
+
'wai-aria-no-global-prop': renamed('aria-prop-requires-role'),
|
|
303
|
+
'wai-aria-non-existent-role': renamed('no-unknown-role'),
|
|
304
|
+
'wai-aria-permitted-roles': renamed('permitted-roles'),
|
|
305
|
+
'wai-aria-interaction-in-hidden': renamed('no-focusable-in-aria-hidden'),
|
|
306
|
+
'wai-aria-presentational-children': renamed('no-aria-on-presentational-children'),
|
|
307
|
+
'wai-aria-required-owned-elements': renamed('require-owned-elements'),
|
|
308
|
+
'wai-aria-required-parent-role': renamed('require-parent-role'),
|
|
309
|
+
'wai-aria-required-props': renamed('require-aria-prop'),
|
|
310
|
+
'wai-aria-tab-requires-tabpanel': renamed('tab-requires-tabpanel'),
|
|
311
|
+
'wai-aria-value': renamed('no-invalid-aria-prop-value'),
|
|
312
|
+
// A straight rename. The original plan (#4.4) proposed also moving this
|
|
313
|
+
// rule's `{ name, value }` pattern-matching responsibility to
|
|
314
|
+
// `no-restricted-attr` once that rule existed — reconsidered once
|
|
315
|
+
// `no-restricted-attr` actually landed: "require this attribute's value
|
|
316
|
+
// to match a pattern" is a positive REQUIRE constraint, not a denylist,
|
|
317
|
+
// and only fits `no-restricted-attr`'s deny-only shape via an awkward
|
|
318
|
+
// negated pattern that changes the violation message's wording for no
|
|
319
|
+
// real benefit. `require-attr` keeps its full pre-rename scope.
|
|
320
|
+
'required-attr': renamed('require-attr'),
|
|
321
|
+
'invalid-attr': {
|
|
322
|
+
expand: expandInvalidAttr,
|
|
323
|
+
targets: ['no-unknown-attr', 'no-disallowed-attr', 'no-invalid-attr-value', 'no-restricted-attr'],
|
|
324
|
+
},
|
|
325
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML LS § the img element / the source element: `sizes="auto"` defers
|
|
3
|
+
* sizing to the image's intrinsic dimensions, which are unknown until the
|
|
4
|
+
* image starts loading — so it only makes sense together with
|
|
5
|
+
* `loading="lazy"`, which the spec requires. Split out of the former
|
|
6
|
+
* `srcset-sizes-constraint` rule's Checks 3 (`<img>`) and 4 (`<source>`, which
|
|
7
|
+
* checks the following sibling `<img>` instead of itself).
|
|
8
|
+
*
|
|
9
|
+
* Gated on `srcset` being present, matching the source rule this was split
|
|
10
|
+
* from: `sizes="auto"` has nothing to auto-size without candidates to choose
|
|
11
|
+
* from.
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { hasSizesAuto } from '../srcset-sizes-constraint/parse-srcset.js';
|
|
3
|
+
import { findFollowingImg } from '../srcset-sizes-constraint/sibling-helpers.js';
|
|
4
|
+
import meta from './meta.js';
|
|
5
|
+
/**
|
|
6
|
+
* HTML LS § the img element / the source element: `sizes="auto"` defers
|
|
7
|
+
* sizing to the image's intrinsic dimensions, which are unknown until the
|
|
8
|
+
* image starts loading — so it only makes sense together with
|
|
9
|
+
* `loading="lazy"`, which the spec requires. Split out of the former
|
|
10
|
+
* `srcset-sizes-constraint` rule's Checks 3 (`<img>`) and 4 (`<source>`, which
|
|
11
|
+
* checks the following sibling `<img>` instead of itself).
|
|
12
|
+
*
|
|
13
|
+
* Gated on `srcset` being present, matching the source rule this was split
|
|
14
|
+
* from: `sizes="auto"` has nothing to auto-size without candidates to choose
|
|
15
|
+
* from.
|
|
16
|
+
*/
|
|
17
|
+
export default createRule({
|
|
18
|
+
meta,
|
|
19
|
+
async verify({ document, report }) {
|
|
20
|
+
await document.walkOn('Element', el => {
|
|
21
|
+
const localName = el.localName;
|
|
22
|
+
// Only check img and source (inside picture) elements
|
|
23
|
+
if (localName !== 'img' && localName !== 'source') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// source is only relevant inside <picture>
|
|
27
|
+
if (localName === 'source' && el.parentElement?.localName !== 'picture') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// Skip if element has spread attributes (dynamic props)
|
|
31
|
+
if (el.hasSpreadAttr) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!el.getAttributeNode('srcset')) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const sizesAttr = el.getAttributeNode('sizes');
|
|
38
|
+
const sizesValue = sizesAttr?.value ?? null;
|
|
39
|
+
const sizesIsDynamic = sizesAttr?.isDynamicValue;
|
|
40
|
+
// img[sizes=auto] → loading=lazy required
|
|
41
|
+
if (localName === 'img' && sizesValue != null && !sizesIsDynamic && hasSizesAuto(sizesValue)) {
|
|
42
|
+
const loading = el.getAttribute('loading');
|
|
43
|
+
if (loading !== 'lazy') {
|
|
44
|
+
report({
|
|
45
|
+
scope: el,
|
|
46
|
+
line: sizesAttr.valueNode?.startLine,
|
|
47
|
+
col: sizesAttr.valueNode?.startCol,
|
|
48
|
+
raw: sizesAttr.valueNode?.raw,
|
|
49
|
+
message: 'The "sizes" attribute with "auto" requires the "loading" attribute to be "lazy"',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// source[sizes=auto] → following sibling img must have loading=lazy
|
|
54
|
+
if (localName === 'source' && sizesValue != null && !sizesIsDynamic && hasSizesAuto(sizesValue)) {
|
|
55
|
+
const img = findFollowingImg(el);
|
|
56
|
+
if (!img || img.getAttribute('loading') !== 'lazy') {
|
|
57
|
+
report({
|
|
58
|
+
scope: el,
|
|
59
|
+
line: sizesAttr.valueNode?.startLine,
|
|
60
|
+
col: sizesAttr.valueNode?.startCol,
|
|
61
|
+
raw: sizesAttr.valueNode?.raw,
|
|
62
|
+
message: 'The "source" element with sizes="auto" requires the following sibling "img" element to have loading="lazy"',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared by the four rules split out of the former `srcset-sizes-constraint` rule:
|
|
3
|
+
* `no-unpaired-srcset-sizes`, `no-mixed-srcset-descriptors`, and
|
|
4
|
+
* `sizes-auto-requires-lazy-loading` (`no-always-matching-source` does not parse
|
|
5
|
+
* `srcset` at all).
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Descriptor type for an image candidate in a srcset attribute.
|
|
3
9
|
* - `width`: ends with `w` (e.g., `480w`)
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared by the four rules split out of the former `srcset-sizes-constraint` rule:
|
|
3
|
+
* `no-unpaired-srcset-sizes`, `no-mixed-srcset-descriptors`, and
|
|
4
|
+
* `sizes-auto-requires-lazy-loading` (`no-always-matching-source` does not parse
|
|
5
|
+
* `srcset` at all).
|
|
6
|
+
*/
|
|
1
7
|
/**
|
|
2
8
|
* Parse a `srcset` attribute value into its image candidates.
|
|
3
9
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Element } from '@markuplint/ml-core';
|
|
2
|
+
/**
|
|
3
|
+
* Iterate the element's following element siblings in document order.
|
|
4
|
+
*
|
|
5
|
+
* Shared by `no-unpaired-srcset-sizes`, `sizes-auto-requires-lazy-loading`, and
|
|
6
|
+
* `no-always-matching-source` — the three rules split out of the former
|
|
7
|
+
* `srcset-sizes-constraint` rule that need to look at a `<source>`'s following
|
|
8
|
+
* siblings.
|
|
9
|
+
*
|
|
10
|
+
* @param el - The element whose following siblings to iterate
|
|
11
|
+
* @yields Each following element sibling, nearest first
|
|
12
|
+
*/
|
|
13
|
+
export declare function followingElementSiblings(el: Element<boolean>): Generator<Element<boolean>>;
|
|
14
|
+
/**
|
|
15
|
+
* Find the first following sibling `<img>` element.
|
|
16
|
+
* Per the spec, the img does not have to be the immediately next sibling.
|
|
17
|
+
*
|
|
18
|
+
* @param el - The starting element to search from
|
|
19
|
+
* @returns The first following sibling `<img>` element, or `null` if none found
|
|
20
|
+
*/
|
|
21
|
+
export declare function findFollowingImg(el: Element<boolean>): Element<boolean> | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterate the element's following element siblings in document order.
|
|
3
|
+
*
|
|
4
|
+
* Shared by `no-unpaired-srcset-sizes`, `sizes-auto-requires-lazy-loading`, and
|
|
5
|
+
* `no-always-matching-source` — the three rules split out of the former
|
|
6
|
+
* `srcset-sizes-constraint` rule that need to look at a `<source>`'s following
|
|
7
|
+
* siblings.
|
|
8
|
+
*
|
|
9
|
+
* @param el - The element whose following siblings to iterate
|
|
10
|
+
* @yields Each following element sibling, nearest first
|
|
11
|
+
*/
|
|
12
|
+
export function* followingElementSiblings(
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
14
|
+
el) {
|
|
15
|
+
let sibling = el.nextElementSibling;
|
|
16
|
+
while (sibling != null) {
|
|
17
|
+
yield sibling;
|
|
18
|
+
sibling = sibling.nextElementSibling;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Find the first following sibling `<img>` element.
|
|
23
|
+
* Per the spec, the img does not have to be the immediately next sibling.
|
|
24
|
+
*
|
|
25
|
+
* @param el - The starting element to search from
|
|
26
|
+
* @returns The first following sibling `<img>` element, or `null` if none found
|
|
27
|
+
*/
|
|
28
|
+
export function findFollowingImg(
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
30
|
+
el) {
|
|
31
|
+
for (const sibling of followingElementSiblings(el)) {
|
|
32
|
+
if (sibling.localName === 'img') {
|
|
33
|
+
return sibling;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRule, getComputedRole, getSpec } from '@markuplint/ml-core';
|
|
2
|
+
import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
3
|
+
import { checkingTabRequiresTabpanel } from '../wai-aria/checkings/tab-requires-tabpanel.js';
|
|
4
|
+
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
5
|
+
import meta from './meta.js';
|
|
6
|
+
export default createRule({
|
|
7
|
+
meta,
|
|
8
|
+
defaultOptions,
|
|
9
|
+
async verify({ document, report }) {
|
|
10
|
+
await document.walkOn('Element', el => {
|
|
11
|
+
const elSpec = getSpec(el, document.specs.specs);
|
|
12
|
+
if (!elSpec)
|
|
13
|
+
return;
|
|
14
|
+
if (!elSpec.globalAttrs['#ARIAAttrs'])
|
|
15
|
+
return;
|
|
16
|
+
const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
|
|
17
|
+
const computed = getComputedRole(document.specs, el, ariaVersion);
|
|
18
|
+
report(checkingTabRequiresTabpanel({ el, role: computed.role }));
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
});
|