@markuplint/rules 5.0.0-rc.1 → 5.0.0-rc.2

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/CLAUDE.md +27 -0
  3. package/SKILL.md +1 -0
  4. package/lib/attr-check.d.ts +3 -1
  5. package/lib/attr-check.js +10 -1
  6. package/lib/helpers.js +16 -1
  7. package/lib/index.d.ts +18 -0
  8. package/lib/index.js +36 -0
  9. package/lib/invalid-attr/index.js +12 -0
  10. package/lib/no-duplicate-autofocus/index.d.ts +7 -0
  11. package/lib/no-duplicate-autofocus/index.js +27 -0
  12. package/lib/no-duplicate-autofocus/meta.d.ts +4 -0
  13. package/lib/no-duplicate-autofocus/meta.js +3 -0
  14. package/lib/no-duplicate-visible-main/index.d.ts +8 -0
  15. package/lib/no-duplicate-visible-main/index.js +28 -0
  16. package/lib/no-duplicate-visible-main/meta.d.ts +4 -0
  17. package/lib/no-duplicate-visible-main/meta.js +3 -0
  18. package/lib/permitted-contents/choice.d.ts +5 -2
  19. package/lib/permitted-contents/choice.js +5 -2
  20. package/lib/permitted-contents/complex-branch.d.ts +5 -2
  21. package/lib/permitted-contents/complex-branch.js +6 -3
  22. package/lib/permitted-contents/content-model.d.ts +21 -2
  23. package/lib/permitted-contents/content-model.js +32 -6
  24. package/lib/permitted-contents/count-pattern.d.ts +5 -2
  25. package/lib/permitted-contents/count-pattern.js +13 -5
  26. package/lib/permitted-contents/index.d.ts +7 -1
  27. package/lib/permitted-contents/index.js +160 -65
  28. package/lib/permitted-contents/matches-selector.d.ts +2 -2
  29. package/lib/permitted-contents/matches-selector.js +43 -5
  30. package/lib/permitted-contents/order.d.ts +9 -2
  31. package/lib/permitted-contents/order.js +9 -2
  32. package/lib/permitted-contents/recursive-branch.d.ts +5 -2
  33. package/lib/permitted-contents/recursive-branch.js +7 -4
  34. package/lib/permitted-contents/represent-transparent-nodes.d.ts +2 -2
  35. package/lib/permitted-contents/represent-transparent-nodes.js +6 -6
  36. package/lib/permitted-contents/start.d.ts +2 -2
  37. package/lib/permitted-contents/start.js +3 -3
  38. package/lib/permitted-contents/types.d.ts +14 -0
  39. package/lib/permitted-contents/utils.d.ts +11 -2
  40. package/lib/permitted-contents/utils.js +62 -13
  41. package/lib/wai-aria/checkings/disallowed-prop.d.ts +2 -1
  42. package/lib/wai-aria/checkings/disallowed-prop.js +27 -5
  43. package/lib/wai-aria/checkings/permitted-roles.js +16 -3
  44. package/lib/wai-aria/checkings/required-accessibility-parent-role.js +1 -1
  45. package/lib/wai-aria/default-options.d.ts +5 -0
  46. package/lib/wai-aria/default-options.js +18 -0
  47. package/lib/wai-aria/index.js +8 -19
  48. package/lib/wai-aria-abstract-role/index.d.ts +4 -0
  49. package/lib/wai-aria-abstract-role/index.js +22 -0
  50. package/lib/wai-aria-abstract-role/meta.d.ts +4 -0
  51. package/lib/wai-aria-abstract-role/meta.js +3 -0
  52. package/lib/wai-aria-default-value/index.d.ts +4 -0
  53. package/lib/wai-aria-default-value/index.js +28 -0
  54. package/lib/wai-aria-default-value/meta.d.ts +5 -0
  55. package/lib/wai-aria-default-value/meta.js +4 -0
  56. package/lib/wai-aria-deprecated-props/index.d.ts +4 -0
  57. package/lib/wai-aria-deprecated-props/index.js +29 -0
  58. package/lib/wai-aria-deprecated-props/meta.d.ts +5 -0
  59. package/lib/wai-aria-deprecated-props/meta.js +4 -0
  60. package/lib/wai-aria-deprecated-role/index.d.ts +4 -0
  61. package/lib/wai-aria-deprecated-role/index.js +26 -0
  62. package/lib/wai-aria-deprecated-role/meta.d.ts +4 -0
  63. package/lib/wai-aria-deprecated-role/meta.js +3 -0
  64. package/lib/wai-aria-disallowed-props/index.d.ts +4 -0
  65. package/lib/wai-aria-disallowed-props/index.js +33 -0
  66. package/lib/wai-aria-disallowed-props/meta.d.ts +5 -0
  67. package/lib/wai-aria-disallowed-props/meta.js +4 -0
  68. package/lib/wai-aria-implicit-props/index.d.ts +4 -0
  69. package/lib/wai-aria-implicit-props/index.js +29 -0
  70. package/lib/wai-aria-implicit-props/meta.d.ts +5 -0
  71. package/lib/wai-aria-implicit-props/meta.js +4 -0
  72. package/lib/wai-aria-implicit-role/index.d.ts +4 -0
  73. package/lib/wai-aria-implicit-role/index.js +23 -0
  74. package/lib/wai-aria-implicit-role/meta.d.ts +4 -0
  75. package/lib/wai-aria-implicit-role/meta.js +3 -0
  76. package/lib/wai-aria-interaction-in-hidden/index.d.ts +4 -0
  77. package/lib/wai-aria-interaction-in-hidden/index.js +20 -0
  78. package/lib/wai-aria-interaction-in-hidden/meta.d.ts +5 -0
  79. package/lib/wai-aria-interaction-in-hidden/meta.js +4 -0
  80. package/lib/wai-aria-no-global-prop/index.d.ts +4 -0
  81. package/lib/wai-aria-no-global-prop/index.js +30 -0
  82. package/lib/wai-aria-no-global-prop/meta.d.ts +5 -0
  83. package/lib/wai-aria-no-global-prop/meta.js +4 -0
  84. package/lib/wai-aria-non-existent-role/index.d.ts +4 -0
  85. package/lib/wai-aria-non-existent-role/index.js +22 -0
  86. package/lib/wai-aria-non-existent-role/meta.d.ts +4 -0
  87. package/lib/wai-aria-non-existent-role/meta.js +3 -0
  88. package/lib/wai-aria-permitted-roles/index.d.ts +4 -0
  89. package/lib/wai-aria-permitted-roles/index.js +22 -0
  90. package/lib/wai-aria-permitted-roles/meta.d.ts +4 -0
  91. package/lib/wai-aria-permitted-roles/meta.js +3 -0
  92. package/lib/wai-aria-presentational-children/index.d.ts +4 -0
  93. package/lib/wai-aria-presentational-children/index.js +20 -0
  94. package/lib/wai-aria-presentational-children/meta.d.ts +5 -0
  95. package/lib/wai-aria-presentational-children/meta.js +4 -0
  96. package/lib/wai-aria-required-owned-elements/index.d.ts +4 -0
  97. package/lib/wai-aria-required-owned-elements/index.js +23 -0
  98. package/lib/wai-aria-required-owned-elements/meta.d.ts +4 -0
  99. package/lib/wai-aria-required-owned-elements/meta.js +3 -0
  100. package/lib/wai-aria-required-parent-role/index.d.ts +4 -0
  101. package/lib/wai-aria-required-parent-role/index.js +25 -0
  102. package/lib/wai-aria-required-parent-role/meta.d.ts +4 -0
  103. package/lib/wai-aria-required-parent-role/meta.js +3 -0
  104. package/lib/wai-aria-required-props/index.d.ts +4 -0
  105. package/lib/wai-aria-required-props/index.js +26 -0
  106. package/lib/wai-aria-required-props/meta.d.ts +4 -0
  107. package/lib/wai-aria-required-props/meta.js +3 -0
  108. package/lib/wai-aria-value/index.d.ts +4 -0
  109. package/lib/wai-aria-value/index.js +28 -0
  110. package/lib/wai-aria-value/meta.d.ts +5 -0
  111. package/lib/wai-aria-value/meta.js +4 -0
  112. package/package.json +13 -9
  113. package/schema.json +54 -0
@@ -0,0 +1,23 @@
1
+ import { createRule, getSpec } from '@markuplint/ml-core';
2
+ import { checkingImplicitRole } from '../wai-aria/checkings/implicit-role.js';
3
+ import { defaultOptions } from '../wai-aria/default-options.js';
4
+ import meta from './meta.js';
5
+ /** Warns when the explicit role attribute duplicates the element's implicit role. */
6
+ export default createRule({
7
+ meta,
8
+ defaultSeverity: 'warning',
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const roleAttr = el.getAttributeNode('role');
13
+ if (!roleAttr)
14
+ return;
15
+ const elSpec = getSpec(el, document.specs.specs);
16
+ if (!elSpec)
17
+ return;
18
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
19
+ return;
20
+ report(checkingImplicitRole({ attr: roleAttr }));
21
+ });
22
+ },
23
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when focusable interactive elements are placed inside an aria-hidden subtree. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { createRule, getSpec } from '@markuplint/ml-core';
2
+ import { checkingInteractionInHidden } from '../wai-aria/checkings/interaction-in-hidden.js';
3
+ import { defaultOptions } from '../wai-aria/default-options.js';
4
+ import meta from './meta.js';
5
+ /** Warns when focusable interactive elements are placed inside an aria-hidden subtree. */
6
+ export default createRule({
7
+ meta,
8
+ defaultSeverity: 'warning',
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const elSpec = getSpec(el, document.specs.specs);
13
+ if (!elSpec)
14
+ return;
15
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
16
+ return;
17
+ report(checkingInteractionInHidden({ el }));
18
+ });
19
+ },
20
+ });
@@ -0,0 +1,5 @@
1
+ /** Rule metadata for the `wai-aria-interaction-in-hidden` rule, categorized under accessibility. */
2
+ declare const _default: {
3
+ readonly category: "a11y";
4
+ };
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ /** Rule metadata for the `wai-aria-interaction-in-hidden` rule, categorized under accessibility. */
2
+ export default {
3
+ category: 'a11y',
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when a non-global ARIA property is used on an element without an explicit role. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { createRule, getComputedRole, ariaSpecs, getSpec } from '@markuplint/ml-core';
2
+ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
+ import { checkingNoGlobalProp } from '../wai-aria/checkings/no-global-prop.js';
4
+ import { defaultOptions } from '../wai-aria/default-options.js';
5
+ import meta from './meta.js';
6
+ /** Warns when a non-global ARIA property is used on an element without an explicit role. */
7
+ export default createRule({
8
+ meta,
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const elSpec = getSpec(el, document.specs.specs);
13
+ if (!elSpec)
14
+ return;
15
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
16
+ return;
17
+ const propAttrs = el.attributes.filter(attr => /^aria-/i.test(attr.name));
18
+ if (propAttrs.length === 0)
19
+ return;
20
+ const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
21
+ const computed = getComputedRole(document.specs, el, ariaVersion);
22
+ if (computed.role)
23
+ return;
24
+ const { props: propSpecs } = ariaSpecs(document.specs, ariaVersion);
25
+ for (const attr of propAttrs) {
26
+ report(checkingNoGlobalProp({ attr, propSpecs }));
27
+ }
28
+ });
29
+ },
30
+ });
@@ -0,0 +1,5 @@
1
+ /** Rule metadata for the `wai-aria-no-global-prop` rule, categorized under accessibility. */
2
+ declare const _default: {
3
+ readonly category: "a11y";
4
+ };
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ /** Rule metadata for the `wai-aria-no-global-prop` rule, categorized under accessibility. */
2
+ export default {
3
+ category: 'a11y',
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when a role attribute value does not exist in the WAI-ARIA specification. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { createRule, getSpec } from '@markuplint/ml-core';
2
+ import { checkingNonExistentRole } from '../wai-aria/checkings/non-existent-role.js';
3
+ import { defaultOptions } from '../wai-aria/default-options.js';
4
+ import meta from './meta.js';
5
+ /** Warns when a role attribute value does not exist in the WAI-ARIA specification. */
6
+ export default createRule({
7
+ meta,
8
+ defaultOptions,
9
+ async verify({ document, report }) {
10
+ await document.walkOn('Element', el => {
11
+ const roleAttr = el.getAttributeNode('role');
12
+ if (!roleAttr)
13
+ return;
14
+ const elSpec = getSpec(el, document.specs.specs);
15
+ if (!elSpec)
16
+ return;
17
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
18
+ return;
19
+ report(checkingNonExistentRole({ attr: roleAttr }));
20
+ });
21
+ },
22
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when a role is not permitted on the element according to ARIA in HTML. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { createRule, getSpec } from '@markuplint/ml-core';
2
+ import { checkingPermittedRoles } from '../wai-aria/checkings/permitted-roles.js';
3
+ import { defaultOptions } from '../wai-aria/default-options.js';
4
+ import meta from './meta.js';
5
+ /** Warns when a role is not permitted on the element according to ARIA in HTML. */
6
+ export default createRule({
7
+ meta,
8
+ defaultOptions,
9
+ async verify({ document, report }) {
10
+ await document.walkOn('Element', el => {
11
+ const roleAttr = el.getAttributeNode('role');
12
+ if (!roleAttr)
13
+ return;
14
+ const elSpec = getSpec(el, document.specs.specs);
15
+ if (!elSpec)
16
+ return;
17
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
18
+ return;
19
+ report(checkingPermittedRoles({ attr: roleAttr }));
20
+ });
21
+ },
22
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when ARIA attributes are set on descendants of roles with presentational children. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { createRule, getSpec } from '@markuplint/ml-core';
2
+ import { checkingPresentationalChildren } from '../wai-aria/checkings/presentational-children.js';
3
+ import { defaultOptions } from '../wai-aria/default-options.js';
4
+ import meta from './meta.js';
5
+ /** Warns when ARIA attributes are set on descendants of roles with presentational children. */
6
+ export default createRule({
7
+ meta,
8
+ defaultSeverity: 'warning',
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const elSpec = getSpec(el, document.specs.specs);
13
+ if (!elSpec)
14
+ return;
15
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
16
+ return;
17
+ report(checkingPresentationalChildren({ el }));
18
+ });
19
+ },
20
+ });
@@ -0,0 +1,5 @@
1
+ /** Rule metadata for the `wai-aria-presentational-children` rule, categorized under accessibility. */
2
+ declare const _default: {
3
+ readonly category: "a11y";
4
+ };
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ /** Rule metadata for the `wai-aria-presentational-children` rule, categorized under accessibility. */
2
+ export default {
3
+ category: 'a11y',
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when a role does not contain its required child roles. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import { createRule, getComputedRole, getSpec } from '@markuplint/ml-core';
2
+ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
+ import { checkingRequiredOwnedElements } from '../wai-aria/checkings/required-owned-elements.js';
4
+ import { defaultOptions } from '../wai-aria/default-options.js';
5
+ import meta from './meta.js';
6
+ /** Warns when a role does not contain its required child roles. */
7
+ export default createRule({
8
+ meta,
9
+ defaultSeverity: 'warning',
10
+ defaultOptions,
11
+ async verify({ document, report }) {
12
+ await document.walkOn('Element', el => {
13
+ const elSpec = getSpec(el, document.specs.specs);
14
+ if (!elSpec)
15
+ return;
16
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
17
+ return;
18
+ const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
19
+ const computed = getComputedRole(document.specs, el, ariaVersion);
20
+ report(checkingRequiredOwnedElements({ el, role: computed.role }));
21
+ });
22
+ },
23
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when an element with an explicit role is placed outside its required parent context. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { createRule, getComputedRole, getSpec } from '@markuplint/ml-core';
2
+ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
+ import { checkingRequiredAccessibilityParentRole } from '../wai-aria/checkings/required-accessibility-parent-role.js';
4
+ import { defaultOptions } from '../wai-aria/default-options.js';
5
+ import meta from './meta.js';
6
+ /** Warns when an element with an explicit role is placed outside its required parent context. */
7
+ export default createRule({
8
+ meta,
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const roleAttr = el.getAttributeNode('role');
13
+ if (!roleAttr)
14
+ return;
15
+ const elSpec = getSpec(el, document.specs.specs);
16
+ if (!elSpec)
17
+ return;
18
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
19
+ return;
20
+ const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
21
+ const computed = getComputedRole(document.specs, el, ariaVersion);
22
+ report(checkingRequiredAccessibilityParentRole({ el, computed }));
23
+ });
24
+ },
25
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when required ARIA properties for a role are missing. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { ariaSpecs, createRule, getComputedRole, getSpec } from '@markuplint/ml-core';
2
+ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
+ import { checkingRequiredProp } from '../wai-aria/checkings/required-prop.js';
4
+ import { defaultOptions } from '../wai-aria/default-options.js';
5
+ import meta from './meta.js';
6
+ /** Warns when required ARIA properties for a role are missing. */
7
+ export default createRule({
8
+ meta,
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const roleAttr = el.getAttributeNode('role');
13
+ if (!roleAttr)
14
+ return;
15
+ const elSpec = getSpec(el, document.specs.specs);
16
+ if (!elSpec)
17
+ return;
18
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
19
+ return;
20
+ const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
21
+ const computed = getComputedRole(document.specs, el, ariaVersion);
22
+ const { props: propSpecs } = ariaSpecs(document.specs, ariaVersion);
23
+ report(checkingRequiredProp({ el, role: computed.role, propSpecs }));
24
+ });
25
+ },
26
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ readonly category: "a11y";
3
+ };
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export default {
2
+ category: 'a11y',
3
+ };
@@ -0,0 +1,4 @@
1
+ import type { Options } from '../wai-aria/types.js';
2
+ /** Warns when an ARIA property or state value does not conform to its expected type. */
3
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
4
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { createRule, getComputedRole, ariaSpecs, getSpec } from '@markuplint/ml-core';
2
+ import { ARIA_RECOMMENDED_VERSION } from '@markuplint/ml-spec';
3
+ import { checkingValue } from '../wai-aria/checkings/value.js';
4
+ import { defaultOptions } from '../wai-aria/default-options.js';
5
+ import meta from './meta.js';
6
+ /** Warns when an ARIA property or state value does not conform to its expected type. */
7
+ export default createRule({
8
+ meta,
9
+ defaultOptions,
10
+ async verify({ document, report }) {
11
+ await document.walkOn('Element', el => {
12
+ const elSpec = getSpec(el, document.specs.specs);
13
+ if (!elSpec)
14
+ return;
15
+ if (!elSpec.globalAttrs['#ARIAAttrs'])
16
+ return;
17
+ const propAttrs = el.attributes.filter(attr => /^aria-/i.test(attr.name));
18
+ if (propAttrs.length === 0)
19
+ return;
20
+ const ariaVersion = el.rule.options?.version ?? document.ruleCommonSettings?.ariaVersion ?? ARIA_RECOMMENDED_VERSION;
21
+ const computed = getComputedRole(document.specs, el, ariaVersion);
22
+ const { props: propSpecs } = ariaSpecs(document.specs, ariaVersion);
23
+ for (const attr of propAttrs) {
24
+ report(checkingValue({ attr, role: computed.role, propSpecs, booleanish: document.booleanish }));
25
+ }
26
+ });
27
+ },
28
+ });
@@ -0,0 +1,5 @@
1
+ /** Rule metadata for the `wai-aria-value` rule, categorized under accessibility. */
2
+ declare const _default: {
3
+ readonly category: "a11y";
4
+ };
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ /** Rule metadata for the `wai-aria-value` rule, categorized under accessibility. */
2
+ export default {
3
+ category: 'a11y',
4
+ };
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.2",
4
4
  "description": "Built-in rules of markuplint",
5
- "repository": "git@github.com:markuplint/markuplint.git",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/markuplint/markuplint.git",
8
+ "directory": "packages/@markuplint/rules"
9
+ },
6
10
  "author": "Yusuke Hirao <yusukehirao@me.com>",
7
11
  "license": "MIT",
8
12
  "engines": {
@@ -27,12 +31,12 @@
27
31
  "./lib/permitted-contents/debug.js": "./lib/permitted-contents/debug.browser.js"
28
32
  },
29
33
  "dependencies": {
30
- "@markuplint/html-spec": "5.0.0-rc.1",
31
- "@markuplint/ml-core": "5.0.0-rc.1",
32
- "@markuplint/ml-spec": "5.0.0-rc.1",
33
- "@markuplint/selector": "5.0.0-rc.1",
34
- "@markuplint/shared": "5.0.0-rc.1",
35
- "@markuplint/types": "5.0.0-rc.1",
34
+ "@markuplint/html-spec": "5.0.0-rc.2",
35
+ "@markuplint/ml-core": "5.0.0-rc.2",
36
+ "@markuplint/ml-spec": "5.0.0-rc.2",
37
+ "@markuplint/selector": "5.0.0-rc.2",
38
+ "@markuplint/shared": "5.0.0-rc.2",
39
+ "@markuplint/types": "5.0.0-rc.2",
36
40
  "@mdn/browser-compat-data": "^7.3.2",
37
41
  "@types/debug": "4.1.13",
38
42
  "ansi-colors": "4.1.3",
@@ -42,5 +46,5 @@
42
46
  "image-size": "^2.0.2",
43
47
  "type-fest": "5.5.0"
44
48
  },
45
- "gitHead": "0d6b4324d9a7d6b9e1ba57d4a57e45d36975cba9"
49
+ "gitHead": "e43763858d9234c417053becc73dbd088c1e7ea6"
46
50
  }
package/schema.json CHANGED
@@ -84,9 +84,15 @@
84
84
  "no-default-value": {
85
85
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/no-default-value/schema.json"
86
86
  },
87
+ "no-duplicate-autofocus": {
88
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/no-duplicate-autofocus/schema.json"
89
+ },
87
90
  "no-duplicate-dt": {
88
91
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/no-duplicate-dt/schema.json"
89
92
  },
93
+ "no-duplicate-visible-main": {
94
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/no-duplicate-visible-main/schema.json"
95
+ },
90
96
  "no-empty-palpable-content": {
91
97
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/no-empty-palpable-content/schema.json"
92
98
  },
@@ -143,6 +149,54 @@
143
149
  },
144
150
  "wai-aria": {
145
151
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria/schema.json"
152
+ },
153
+ "wai-aria-abstract-role": {
154
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-abstract-role/schema.json"
155
+ },
156
+ "wai-aria-default-value": {
157
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-default-value/schema.json"
158
+ },
159
+ "wai-aria-deprecated-props": {
160
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-deprecated-props/schema.json"
161
+ },
162
+ "wai-aria-deprecated-role": {
163
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-deprecated-role/schema.json"
164
+ },
165
+ "wai-aria-disallowed-props": {
166
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-disallowed-props/schema.json"
167
+ },
168
+ "wai-aria-implicit-props": {
169
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-implicit-props/schema.json"
170
+ },
171
+ "wai-aria-implicit-role": {
172
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-implicit-role/schema.json"
173
+ },
174
+ "wai-aria-interaction-in-hidden": {
175
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-interaction-in-hidden/schema.json"
176
+ },
177
+ "wai-aria-no-global-prop": {
178
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-no-global-prop/schema.json"
179
+ },
180
+ "wai-aria-non-existent-role": {
181
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-non-existent-role/schema.json"
182
+ },
183
+ "wai-aria-permitted-roles": {
184
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-permitted-roles/schema.json"
185
+ },
186
+ "wai-aria-presentational-children": {
187
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-presentational-children/schema.json"
188
+ },
189
+ "wai-aria-required-owned-elements": {
190
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-required-owned-elements/schema.json"
191
+ },
192
+ "wai-aria-required-parent-role": {
193
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-required-parent-role/schema.json"
194
+ },
195
+ "wai-aria-required-props": {
196
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-required-props/schema.json"
197
+ },
198
+ "wai-aria-value": {
199
+ "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/wai-aria-value/schema.json"
146
200
  }
147
201
  }
148
202
  }