@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
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { createRule, ariaSpecs, getAttrSpecs, getSpec } from '@markuplint/ml-core';
|
|
2
2
|
import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
3
|
-
import {
|
|
3
|
+
import { checkingRedundantAriaProp } from '../wai-aria/checkings/redundant-aria-prop.js';
|
|
4
4
|
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
5
5
|
import meta from './meta.js';
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Split from the former `wai-aria-implicit-props` rule (#3989): the
|
|
8
|
+
* "redundant" half. See `checkingRedundantAriaProp`'s JSDoc for the full
|
|
9
|
+
* spec citation. Should-level (ARIA in HTML §6 recommends the native
|
|
10
|
+
* attribute), so this rule keeps the former rule's `warning` default —
|
|
11
|
+
* contrast `no-contradictory-aria-prop`'s `error`.
|
|
12
|
+
*/
|
|
7
13
|
export default createRule({
|
|
8
14
|
meta,
|
|
9
15
|
defaultSeverity: 'warning',
|
|
@@ -22,7 +28,7 @@ export default createRule({
|
|
|
22
28
|
const { props: propSpecs } = ariaSpecs(document.specs, ariaVersion);
|
|
23
29
|
const attrSpecs = getAttrSpecs(el, document.specs);
|
|
24
30
|
for (const attr of propAttrs) {
|
|
25
|
-
report(
|
|
31
|
+
report(checkingRedundantAriaProp({ attr, propSpecs, attrSpecs }));
|
|
26
32
|
}
|
|
27
33
|
});
|
|
28
34
|
},
|
|
@@ -2,7 +2,6 @@ import { createRule, getSpec } from '@markuplint/ml-core';
|
|
|
2
2
|
import { checkingImplicitRole } from '../wai-aria/checkings/implicit-role.js';
|
|
3
3
|
import { defaultOptions } from '../wai-aria/default-options.js';
|
|
4
4
|
import meta from './meta.js';
|
|
5
|
-
/** Warns when the explicit role attribute duplicates the element's implicit role. */
|
|
6
5
|
export default createRule({
|
|
7
6
|
meta,
|
|
8
7
|
defaultSeverity: 'warning',
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { ARIAVersion } from '@markuplint/ml-spec';
|
|
2
|
-
/**
|
|
3
|
-
* Rule that validates all ID references in attributes point to existing elements.
|
|
4
|
-
*
|
|
5
|
-
* Checks DOMID and DOMID-list attributes (e.g., `for`, `aria-labelledby`),
|
|
6
|
-
* ARIA ID reference properties, and fragment identifiers in hyperlinks (`href="#id"`).
|
|
7
|
-
* Reports any reference to an ID that does not exist in the document. Skips
|
|
8
|
-
* validation when dynamic IDs or preprocessor blocks are detected.
|
|
9
|
-
*/
|
|
10
2
|
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
|
|
11
3
|
ariaVersion: ARIAVersion | undefined;
|
|
12
|
-
fragmentRefersNameAttr: boolean;
|
|
13
4
|
}>>;
|
|
14
5
|
export default _default;
|
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import { createRule, getAttrSpecs, ariaSpecs } from '@markuplint/ml-core';
|
|
2
2
|
import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
|
|
3
|
-
import { decodeEntities
|
|
3
|
+
import { decodeEntities } from '@markuplint/shared';
|
|
4
4
|
import meta from './meta.js';
|
|
5
|
-
/** CSS selector matching hyperlink elements that have an `href` attribute. */
|
|
6
|
-
const HYPERLINK_SELECTOR = 'a[href], area[href]';
|
|
7
|
-
/**
|
|
8
|
-
* Rule that validates all ID references in attributes point to existing elements.
|
|
9
|
-
*
|
|
10
|
-
* Checks DOMID and DOMID-list attributes (e.g., `for`, `aria-labelledby`),
|
|
11
|
-
* ARIA ID reference properties, and fragment identifiers in hyperlinks (`href="#id"`).
|
|
12
|
-
* Reports any reference to an ID that does not exist in the document. Skips
|
|
13
|
-
* validation when dynamic IDs or preprocessor blocks are detected.
|
|
14
|
-
*/
|
|
15
5
|
export default createRule({
|
|
16
6
|
meta: meta,
|
|
17
7
|
defaultOptions: {
|
|
18
8
|
ariaVersion: undefined,
|
|
19
|
-
fragmentRefersNameAttr: false,
|
|
20
9
|
},
|
|
21
10
|
async verify({ document, report, t }) {
|
|
22
11
|
const idList = new Set();
|
|
23
|
-
const nameList = new Set();
|
|
24
12
|
let hasDynamicId = false;
|
|
25
|
-
let hasDynamicName = false;
|
|
26
13
|
const isMutable = document.nodeList.some(node => node.is(node.MARKUPLINT_PREPROCESSOR_BLOCK));
|
|
27
14
|
if (isMutable) {
|
|
28
15
|
return;
|
|
@@ -42,18 +29,6 @@ export default createRule({
|
|
|
42
29
|
if (hasDynamicId) {
|
|
43
30
|
return;
|
|
44
31
|
}
|
|
45
|
-
for (const el of document.querySelectorAll('[name]')) {
|
|
46
|
-
const attr = el.getAttributeNode('name');
|
|
47
|
-
if (!attr) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (attr.isDynamicValue) {
|
|
51
|
-
hasDynamicName = true;
|
|
52
|
-
}
|
|
53
|
-
if (attr.valueType !== 'code') {
|
|
54
|
-
nameList.add(decodeEntities(attr.value));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
32
|
await document.walkOn('Attr', attr => {
|
|
58
33
|
const attrSpec = getAttrSpecs(attr.ownerElement, document.specs);
|
|
59
34
|
if (!attrSpec) {
|
|
@@ -131,41 +106,5 @@ export default createRule({
|
|
|
131
106
|
}
|
|
132
107
|
}
|
|
133
108
|
});
|
|
134
|
-
/**
|
|
135
|
-
* @see https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
|
|
136
|
-
*/
|
|
137
|
-
await document.walkOn('Element', el => {
|
|
138
|
-
if (el.rule.options.fragmentRefersNameAttr && hasDynamicName) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (!el.matches(HYPERLINK_SELECTOR)) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const href = el.getAttributeNode('href');
|
|
145
|
-
if (!href) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
const rawFragment = href.value.match(/^#(.+)/)?.[1];
|
|
149
|
-
if (rawFragment == null) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
const decodedFragment = decodeHref(rawFragment);
|
|
153
|
-
// > 2. If fragment is the empty string, then return the special value top of the document.
|
|
154
|
-
// >
|
|
155
|
-
// > 9. If decodedFragment is an ASCII case-insensitive match for the string top, then return the top of the document.
|
|
156
|
-
if (decodedFragment === '' || /^top$/i.test(decodedFragment)) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (!idList.has(decodedFragment) &&
|
|
160
|
-
(el.rule.options.fragmentRefersNameAttr ? !nameList.has(decodedFragment) : true)) {
|
|
161
|
-
report({
|
|
162
|
-
scope: href,
|
|
163
|
-
line: href.valueNode?.startLine,
|
|
164
|
-
col: href.valueNode?.startCol,
|
|
165
|
-
raw: href.valueNode?.raw,
|
|
166
|
-
message: t('Missing {0}', t('"{0*}" ID', decodedFragment)),
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
109
|
},
|
|
171
110
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AttributeType } from '@markuplint/ml-spec';
|
|
2
|
+
import type { Pattern } from '@markuplint/types';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the `no-restricted-attr` rule.
|
|
5
|
+
*/
|
|
6
|
+
type Option = {
|
|
7
|
+
/**
|
|
8
|
+
* Attributes to disallow, in addition to whatever the HTML spec (checked
|
|
9
|
+
* by `no-unknown-attr` / `no-disallowed-attr` / `no-invalid-attr-value`)
|
|
10
|
+
* already restricts. This is the rule's only concern — narrow, purely
|
|
11
|
+
* user-defined denylisting, independent of spec conformance.
|
|
12
|
+
*
|
|
13
|
+
* @since 3.7.0
|
|
14
|
+
*/
|
|
15
|
+
disallowAttrs?: (string | Attr)[] | Record<string, AttributeType | Pattern>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Describes a single attribute with its name and expected value constraint.
|
|
19
|
+
*/
|
|
20
|
+
type Attr = {
|
|
21
|
+
/** The attribute name. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** The expected attribute value type or validation rule. */
|
|
24
|
+
value: AttributeType | Pattern;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Option>>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { check, isEnum, isPattern } from '@markuplint/types';
|
|
3
|
+
import { attrCheck } from '../attr-check.js';
|
|
4
|
+
import meta from './meta.js';
|
|
5
|
+
function disallowedTypes(disallowAttrs) {
|
|
6
|
+
const map = new Map();
|
|
7
|
+
if (!disallowAttrs) {
|
|
8
|
+
return map;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(disallowAttrs)) {
|
|
11
|
+
for (const disallowAttr of disallowAttrs) {
|
|
12
|
+
if (typeof disallowAttr === 'string') {
|
|
13
|
+
map.set(disallowAttr, 'Any');
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
map.set(disallowAttr.name, disallowAttr.value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
for (const [name, type] of Object.entries(disallowAttrs)) {
|
|
21
|
+
map.set(name, type);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return map;
|
|
25
|
+
}
|
|
26
|
+
export default createRule({
|
|
27
|
+
meta: meta,
|
|
28
|
+
defaultOptions: {},
|
|
29
|
+
async verify({ document, report, t }) {
|
|
30
|
+
await document.walkOn('Attr', attr => {
|
|
31
|
+
if (attr.isDirective) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const name = attr.name;
|
|
35
|
+
const value = attr.value;
|
|
36
|
+
const valueNode = attr.valueNode;
|
|
37
|
+
const attrName = attr.nameNode;
|
|
38
|
+
const disallowValue = disallowedTypes(attr.rule.options.disallowAttrs).get(name);
|
|
39
|
+
if (disallowValue === undefined) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (disallowValue === 'Any') {
|
|
43
|
+
report({
|
|
44
|
+
scope: attr,
|
|
45
|
+
message: t('{0} is disallowed', t('the "{0*}" {1}', name, 'attribute')),
|
|
46
|
+
line: attrName?.startLine,
|
|
47
|
+
col: attrName?.startCol,
|
|
48
|
+
raw: attrName?.raw,
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (attr.isDynamicValue) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const checkResult = isPattern(disallowValue)
|
|
56
|
+
? check(value, disallowValue)
|
|
57
|
+
: attrCheck(t, name, value, true, {
|
|
58
|
+
name,
|
|
59
|
+
type: disallowValue,
|
|
60
|
+
description: '',
|
|
61
|
+
});
|
|
62
|
+
const isMatched = isPattern(disallowValue)
|
|
63
|
+
? checkResult.matched
|
|
64
|
+
: checkResult === false;
|
|
65
|
+
if (!isMatched) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
report({
|
|
69
|
+
scope: attr,
|
|
70
|
+
message: createDisallowMessage(t, name, disallowValue),
|
|
71
|
+
line: valueNode?.startLine,
|
|
72
|
+
col: valueNode?.startCol,
|
|
73
|
+
raw: value,
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Creates an appropriate disallow message based on the type structure.
|
|
80
|
+
*
|
|
81
|
+
* @param t - The i18n translator
|
|
82
|
+
* @param name - The attribute name
|
|
83
|
+
* @param type - The attribute type or pattern
|
|
84
|
+
* @returns A localized message string
|
|
85
|
+
*/
|
|
86
|
+
function createDisallowMessage(t, name,
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
88
|
+
type) {
|
|
89
|
+
if (isPattern(type)) {
|
|
90
|
+
return t('{0} is matched with the below disallowed patterns: {1}', t('the "{0*}" {1}', name, 'attribute'), type.pattern);
|
|
91
|
+
}
|
|
92
|
+
if (typeof type !== 'string' && isEnum(type)) {
|
|
93
|
+
return t('{0} is disallowed to accept the following values: {1}', t('the "{0*}" {1}', name, 'attribute'), t(type.enum));
|
|
94
|
+
}
|
|
95
|
+
return t('{0} is disallowed', t('{0} of {1}', t('the {0}', 'type'), t('the "{0*}" {1}', name, 'attribute')));
|
|
96
|
+
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { createRule } from '@markuplint/ml-core';
|
|
2
2
|
import meta from './meta.js';
|
|
3
|
-
/**
|
|
4
|
-
* Rule that disallows elements matching the configured CSS selectors.
|
|
5
|
-
*
|
|
6
|
-
* Accepts an array of selector strings as its value. Queries the document
|
|
7
|
-
* (and per-element overrides) for matching elements and reports each one
|
|
8
|
-
* as disallowed.
|
|
9
|
-
*/
|
|
10
3
|
export default createRule({
|
|
11
4
|
meta: meta,
|
|
12
5
|
defaultValue: [],
|
|
@@ -27,10 +20,16 @@ export default createRule({
|
|
|
27
20
|
}
|
|
28
21
|
for (const query of el.rule.value) {
|
|
29
22
|
const elements = el.querySelectorAll(query);
|
|
30
|
-
for (const
|
|
23
|
+
for (const found of elements) {
|
|
31
24
|
const message = t('{0} is disallowed', t('the "{0*}" {1}', query, 'element'));
|
|
32
25
|
report({
|
|
26
|
+
// `scope` resolves the rule's `reason`/`reasonOnly` (the node-level rule
|
|
27
|
+
// setting is mapped to `el`, not to `found`), so it must stay `el`.
|
|
28
|
+
// Location comes from `line`/`col`/`raw`, which take precedence over the scope's.
|
|
33
29
|
scope: el,
|
|
30
|
+
line: found.startLine,
|
|
31
|
+
col: found.startCol,
|
|
32
|
+
raw: found.raw,
|
|
34
33
|
message,
|
|
35
34
|
});
|
|
36
35
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule that warns when a heading skips a level relative to the previous
|
|
3
|
+
* heading lead.
|
|
4
|
+
*
|
|
5
|
+
* Per HTML LS §4.3.11, the constraint applies only to a heading "following
|
|
6
|
+
* another heading lead". A document whose first heading is at any level
|
|
7
|
+
* (e.g., an article fragment starting with h3) has no lead, so it is
|
|
8
|
+
* unaffected and never fires on the first heading.
|
|
9
|
+
*
|
|
10
|
+
* @see https://html.spec.whatwg.org/multipage/sections.html#headings-and-outlines-2
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, null>>;
|
|
13
|
+
export default _default;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { createRule } from '@markuplint/ml-core';
|
|
2
2
|
import meta from './meta.js';
|
|
3
3
|
/**
|
|
4
|
-
* Rule that
|
|
4
|
+
* Rule that warns when a heading skips a level relative to the previous
|
|
5
|
+
* heading lead.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* Per HTML LS §4.3.11, the constraint applies only to a heading "following
|
|
8
|
+
* another heading lead". A document whose first heading is at any level
|
|
9
|
+
* (e.g., an article fragment starting with h3) has no lead, so it is
|
|
10
|
+
* unaffected and never fires on the first heading.
|
|
11
|
+
*
|
|
12
|
+
* @see https://html.spec.whatwg.org/multipage/sections.html#headings-and-outlines-2
|
|
8
13
|
*/
|
|
9
14
|
export default createRule({
|
|
10
15
|
meta: meta,
|
|
11
16
|
defaultOptions: null,
|
|
12
17
|
verify({ document, report, t }) {
|
|
13
18
|
const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
|
|
14
|
-
let prevLevel =
|
|
19
|
+
let prevLevel = null;
|
|
15
20
|
for (const heading of headings) {
|
|
16
21
|
const level = Number.parseInt(heading.nodeName.slice(1));
|
|
17
|
-
if (prevLevel + 1 < level) {
|
|
22
|
+
if (prevLevel !== null && prevLevel + 1 < level) {
|
|
18
23
|
report({
|
|
19
24
|
scope: heading,
|
|
20
25
|
message: t('{0} must not be skipped', t('Heading levels')),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML LS "in body" insertion mode:
|
|
3
|
+
*
|
|
4
|
+
* > A start tag whose tag name is "body": Parse error. If the stack of open
|
|
5
|
+
* > elements has only one node on it, or if the second element on the stack
|
|
6
|
+
* > of open elements is not a body element, or if there is a template
|
|
7
|
+
* > element on the stack of open elements, then ignore the token […].
|
|
8
|
+
* > Otherwise, set the frameset-ok flag to "not ok" […]
|
|
9
|
+
*
|
|
10
|
+
* "in body" insertion mode, "Any other end tag":
|
|
11
|
+
*
|
|
12
|
+
* > Initialize node to be the current node […]. If node's tag name […] is
|
|
13
|
+
* > not the same as the tag name of the token, then this is a parse error.
|
|
14
|
+
*
|
|
15
|
+
* Neither of these fires by the presence of disallowed `<head>` content
|
|
16
|
+
* itself (the "in head" insertion mode's own "Anything else" clause that
|
|
17
|
+
* pops an implicitly-invalid element out of head carries no "parse error"
|
|
18
|
+
* wording) — they fire only when the *source* still contains a literal
|
|
19
|
+
* `</head>` or `<body>` token that arrives once the parser has moved on.
|
|
20
|
+
* `@markuplint/html-parser`'s `nodeize` folds a token the tree constructor
|
|
21
|
+
* discards into the surrounding text node's `raw` span rather than
|
|
22
|
+
* dropping the bytes, so a genuinely-consumed stray/duplicate tag survives
|
|
23
|
+
* as plain text content — this rule looks for exactly that residue.
|
|
24
|
+
*
|
|
25
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
|
|
26
|
+
*/
|
|
27
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import meta from './meta.js';
|
|
3
|
+
/**
|
|
4
|
+
* Content whose element is one of these has RAWTEXT/RCDATA parsing (HTML LS
|
|
5
|
+
* "generic raw text element parsing algorithm" / "generic RCDATA element
|
|
6
|
+
* parsing algorithm"): the parser never re-tokenizes tag-shaped substrings
|
|
7
|
+
* inside it, so a literal `<body` or `</head` there is ordinary text, not a
|
|
8
|
+
* candidate for either check below.
|
|
9
|
+
*/
|
|
10
|
+
const RAW_TEXT_CONTAINERS = new Set(['script', 'style', 'title', 'textarea', 'xmp']);
|
|
11
|
+
const STRAY_HEAD_END_TAG = /<\/head(?=[\s/>])/i;
|
|
12
|
+
const DUPLICATE_BODY_START_TAG = /<body(?=[\s/>])/i;
|
|
13
|
+
/**
|
|
14
|
+
* HTML LS "in body" insertion mode:
|
|
15
|
+
*
|
|
16
|
+
* > A start tag whose tag name is "body": Parse error. If the stack of open
|
|
17
|
+
* > elements has only one node on it, or if the second element on the stack
|
|
18
|
+
* > of open elements is not a body element, or if there is a template
|
|
19
|
+
* > element on the stack of open elements, then ignore the token […].
|
|
20
|
+
* > Otherwise, set the frameset-ok flag to "not ok" […]
|
|
21
|
+
*
|
|
22
|
+
* "in body" insertion mode, "Any other end tag":
|
|
23
|
+
*
|
|
24
|
+
* > Initialize node to be the current node […]. If node's tag name […] is
|
|
25
|
+
* > not the same as the tag name of the token, then this is a parse error.
|
|
26
|
+
*
|
|
27
|
+
* Neither of these fires by the presence of disallowed `<head>` content
|
|
28
|
+
* itself (the "in head" insertion mode's own "Anything else" clause that
|
|
29
|
+
* pops an implicitly-invalid element out of head carries no "parse error"
|
|
30
|
+
* wording) — they fire only when the *source* still contains a literal
|
|
31
|
+
* `</head>` or `<body>` token that arrives once the parser has moved on.
|
|
32
|
+
* `@markuplint/html-parser`'s `nodeize` folds a token the tree constructor
|
|
33
|
+
* discards into the surrounding text node's `raw` span rather than
|
|
34
|
+
* dropping the bytes, so a genuinely-consumed stray/duplicate tag survives
|
|
35
|
+
* as plain text content — this rule looks for exactly that residue.
|
|
36
|
+
*
|
|
37
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
|
|
38
|
+
*/
|
|
39
|
+
export default createRule({
|
|
40
|
+
meta: meta,
|
|
41
|
+
async verify({ document, report, t }) {
|
|
42
|
+
await document.walkOn('Text', text => {
|
|
43
|
+
const parent = text.parentNode;
|
|
44
|
+
const parentLocalName = parent && 'localName' in parent ? parent.localName : '';
|
|
45
|
+
if (RAW_TEXT_CONTAINERS.has(parentLocalName))
|
|
46
|
+
return;
|
|
47
|
+
if (STRAY_HEAD_END_TAG.test(text.raw)) {
|
|
48
|
+
report({
|
|
49
|
+
scope: text,
|
|
50
|
+
message: t('{0} detected', t('a stray "{0}" end tag', 'head')),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (DUPLICATE_BODY_START_TAG.test(text.raw)) {
|
|
54
|
+
report({
|
|
55
|
+
scope: text,
|
|
56
|
+
message: t('{0} detected', t('a duplicate "{0}" start tag', 'body')),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML LS [§4.9.12.1 *Forming a table*](https://html.spec.whatwg.org/multipage/tables.html#forming-a-table)
|
|
3
|
+
* Step 14 table model error: two cells anchored so that a slot is covered twice.
|
|
4
|
+
*
|
|
5
|
+
* Split from the original `table-row-column-alignment` rule. This is the one check the sibling
|
|
6
|
+
* splits (`no-table-span-overflow`, `no-empty-table-track`, `consistent-table-row-length`) all
|
|
7
|
+
* skip a table for: once two cells claim the same slot, every column and width derived from the
|
|
8
|
+
* grid model is speculative, so reporting them would bury the one error the author has to fix
|
|
9
|
+
* first.
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { Grid } from '../table-row-column-alignment/grid.js';
|
|
3
|
+
import meta from './meta.js';
|
|
4
|
+
/**
|
|
5
|
+
* HTML LS [§4.9.12.1 *Forming a table*](https://html.spec.whatwg.org/multipage/tables.html#forming-a-table)
|
|
6
|
+
* Step 14 table model error: two cells anchored so that a slot is covered twice.
|
|
7
|
+
*
|
|
8
|
+
* Split from the original `table-row-column-alignment` rule. This is the one check the sibling
|
|
9
|
+
* splits (`no-table-span-overflow`, `no-empty-table-track`, `consistent-table-row-length`) all
|
|
10
|
+
* skip a table for: once two cells claim the same slot, every column and width derived from the
|
|
11
|
+
* grid model is speculative, so reporting them would bury the one error the author has to fix
|
|
12
|
+
* first.
|
|
13
|
+
*/
|
|
14
|
+
export default createRule({
|
|
15
|
+
meta,
|
|
16
|
+
verify({ document, report, t }) {
|
|
17
|
+
const tables = document.querySelectorAll('table');
|
|
18
|
+
for (const table of tables) {
|
|
19
|
+
const grid = new Grid(table);
|
|
20
|
+
if (grid.hasOverlapped()) {
|
|
21
|
+
report({
|
|
22
|
+
scope: table,
|
|
23
|
+
message: t(
|
|
24
|
+
//
|
|
25
|
+
'{0} are causing {1}', t(['rowspan', 'colspan'], true), 'cell overlap'),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML LS §4.9.12 ("A cell cannot cover slots that are from two or more row groups."): a cell
|
|
3
|
+
* whose `rowspan` reaches past the last row of its `<thead>` / `<tbody>` / `<tfoot>` is clipped
|
|
4
|
+
* to the row group by the *ending a row group* algorithm, which is itself the table model error
|
|
5
|
+
* this rule reports.
|
|
6
|
+
*
|
|
7
|
+
* Split from the original `table-row-column-alignment` rule. Skips a table that
|
|
8
|
+
* `no-table-cell-overlap` already reports on — once two cells claim the same slot, the grid
|
|
9
|
+
* model's row groups are no longer reliable.
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRule } from '@markuplint/ml-core';
|
|
2
|
+
import { Grid } from '../table-row-column-alignment/grid.js';
|
|
3
|
+
import meta from './meta.js';
|
|
4
|
+
/**
|
|
5
|
+
* HTML LS §4.9.12 ("A cell cannot cover slots that are from two or more row groups."): a cell
|
|
6
|
+
* whose `rowspan` reaches past the last row of its `<thead>` / `<tbody>` / `<tfoot>` is clipped
|
|
7
|
+
* to the row group by the *ending a row group* algorithm, which is itself the table model error
|
|
8
|
+
* this rule reports.
|
|
9
|
+
*
|
|
10
|
+
* Split from the original `table-row-column-alignment` rule. Skips a table that
|
|
11
|
+
* `no-table-cell-overlap` already reports on — once two cells claim the same slot, the grid
|
|
12
|
+
* model's row groups are no longer reliable.
|
|
13
|
+
*/
|
|
14
|
+
export default createRule({
|
|
15
|
+
meta,
|
|
16
|
+
verify({ document, report, t }) {
|
|
17
|
+
const tables = document.querySelectorAll('table');
|
|
18
|
+
for (const table of tables) {
|
|
19
|
+
const grid = new Grid(table);
|
|
20
|
+
if (grid.hasOverlapped()) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
for (const rowGroup of grid.rowGroups) {
|
|
24
|
+
for (const overflow of rowGroup.overflows) {
|
|
25
|
+
const rowSpan = overflow.cell.getAttributeNode('rowspan');
|
|
26
|
+
if (!rowSpan) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
report({
|
|
30
|
+
scope: rowSpan,
|
|
31
|
+
message: t('Exceeds the number of available {0}', 'rows'),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
});
|