@markuplint/rules 2.4.3 → 3.0.0-alpha.1

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 (118) hide show
  1. package/README.md +2 -6
  2. package/lib/attr-check.js +1 -1
  3. package/lib/attr-duplication/index.js +10 -7
  4. package/lib/attr-value-quotes/index.js +22 -26
  5. package/lib/case-sensitive-attr-name/index.d.ts +1 -5
  6. package/lib/case-sensitive-attr-name/index.js +52 -82
  7. package/lib/case-sensitive-tag-name/index.js +39 -31
  8. package/lib/character-reference/index.d.ts +2 -1
  9. package/lib/character-reference/index.js +6 -8
  10. package/lib/class-naming/index.js +12 -12
  11. package/lib/create-message.d.ts +1 -1
  12. package/lib/create-message.js +5 -5
  13. package/lib/deprecated-attr/index.js +17 -18
  14. package/lib/deprecated-element/index.js +5 -7
  15. package/lib/disallowed-element/index.js +8 -9
  16. package/lib/doctype/index.d.ts +1 -1
  17. package/lib/doctype/index.js +8 -8
  18. package/lib/end-tag/index.js +5 -2
  19. package/lib/helpers.d.ts +15 -28
  20. package/lib/helpers.js +42 -156
  21. package/lib/id-duplication/index.js +4 -6
  22. package/lib/index.d.ts +12 -21
  23. package/lib/index.js +0 -8
  24. package/lib/ineffective-attr/index.js +20 -28
  25. package/lib/invalid-attr/index.js +83 -83
  26. package/lib/landmark-roles/index.d.ts +2 -2
  27. package/lib/landmark-roles/index.js +10 -10
  28. package/lib/no-boolean-attr-value/index.js +34 -35
  29. package/lib/no-default-value/index.js +21 -25
  30. package/lib/no-hard-code-id/index.js +10 -14
  31. package/lib/no-refer-to-non-existent-id/index.d.ts +4 -1
  32. package/lib/no-refer-to-non-existent-id/index.js +77 -83
  33. package/lib/no-use-event-handler-attr/index.js +21 -23
  34. package/lib/permitted-contents/choice.d.ts +3 -0
  35. package/lib/permitted-contents/choice.js +37 -0
  36. package/lib/permitted-contents/complex-branch.d.ts +13 -0
  37. package/lib/permitted-contents/complex-branch.js +27 -0
  38. package/lib/permitted-contents/content-model.d.ts +2 -0
  39. package/lib/permitted-contents/content-model.js +49 -0
  40. package/lib/permitted-contents/count-pattern.d.ts +13 -0
  41. package/lib/permitted-contents/count-pattern.js +155 -0
  42. package/lib/permitted-contents/debug.d.ts +2 -0
  43. package/lib/permitted-contents/debug.js +5 -0
  44. package/lib/permitted-contents/index.d.ts +2 -5
  45. package/lib/permitted-contents/index.js +78 -249
  46. package/lib/permitted-contents/matches-selector.d.ts +3 -0
  47. package/lib/permitted-contents/matches-selector.js +185 -0
  48. package/lib/permitted-contents/order.d.ts +13 -0
  49. package/lib/permitted-contents/order.js +89 -0
  50. package/lib/permitted-contents/recursive-branch.d.ts +4 -0
  51. package/lib/permitted-contents/recursive-branch.js +43 -0
  52. package/lib/permitted-contents/represent-transparent-nodes.d.ts +6 -0
  53. package/lib/permitted-contents/represent-transparent-nodes.js +79 -0
  54. package/lib/permitted-contents/start.d.ts +12 -0
  55. package/lib/permitted-contents/start.js +71 -0
  56. package/lib/permitted-contents/transparent.d.ts +2 -0
  57. package/lib/permitted-contents/transparent.js +34 -0
  58. package/lib/permitted-contents/types.d.ts +45 -0
  59. package/lib/permitted-contents/types.js +2 -0
  60. package/lib/permitted-contents/utils.d.ts +32 -0
  61. package/lib/permitted-contents/utils.js +184 -0
  62. package/lib/require-accessible-name/index.d.ts +5 -1
  63. package/lib/require-accessible-name/index.js +11 -4
  64. package/lib/required-attr/index.js +16 -25
  65. package/lib/required-element/index.d.ts +1 -1
  66. package/lib/required-element/index.js +6 -6
  67. package/lib/required-h1/index.d.ts +2 -2
  68. package/lib/required-h1/index.js +3 -3
  69. package/lib/use-list/index.js +2 -2
  70. package/lib/wai-aria/checkings/abstract-role.d.ts +3 -0
  71. package/lib/wai-aria/checkings/abstract-role.js +22 -0
  72. package/lib/wai-aria/checkings/default-value.d.ts +6 -0
  73. package/lib/wai-aria/checkings/default-value.js +17 -0
  74. package/lib/wai-aria/checkings/deprecated-props.d.ts +7 -0
  75. package/lib/wai-aria/checkings/deprecated-props.js +18 -0
  76. package/lib/wai-aria/checkings/disallowed-prop.d.ts +7 -0
  77. package/lib/wai-aria/checkings/disallowed-prop.js +22 -0
  78. package/lib/wai-aria/checkings/implicit-props.d.ts +7 -0
  79. package/lib/wai-aria/checkings/implicit-props.js +50 -0
  80. package/lib/wai-aria/checkings/implicit-role.d.ts +3 -0
  81. package/lib/wai-aria/checkings/implicit-role.js +21 -0
  82. package/lib/wai-aria/checkings/interaction-in-hidden.d.ts +11 -0
  83. package/lib/wai-aria/checkings/interaction-in-hidden.js +47 -0
  84. package/lib/wai-aria/checkings/no-global-prop.d.ts +6 -0
  85. package/lib/wai-aria/checkings/no-global-prop.js +14 -0
  86. package/lib/wai-aria/checkings/non-existant-role.d.ts +3 -0
  87. package/lib/wai-aria/checkings/non-existant-role.js +28 -0
  88. package/lib/wai-aria/checkings/permitted-roles.d.ts +3 -0
  89. package/lib/wai-aria/checkings/permitted-roles.js +28 -0
  90. package/lib/wai-aria/checkings/presentational-children.d.ts +29 -0
  91. package/lib/wai-aria/checkings/presentational-children.js +60 -0
  92. package/lib/wai-aria/checkings/required-owned-elements.d.ts +11 -0
  93. package/lib/wai-aria/checkings/required-owned-elements.js +63 -0
  94. package/lib/wai-aria/checkings/required-prop.d.ts +9 -0
  95. package/lib/wai-aria/checkings/required-prop.js +27 -0
  96. package/lib/wai-aria/checkings/value.d.ts +7 -0
  97. package/lib/wai-aria/checkings/value.js +21 -0
  98. package/lib/wai-aria/index.d.ts +1 -8
  99. package/lib/wai-aria/index.js +66 -207
  100. package/lib/wai-aria/types.d.ts +13 -0
  101. package/lib/wai-aria/types.js +2 -0
  102. package/package.json +8 -7
  103. package/schema.json +0 -12
  104. package/tsconfig.tsbuildinfo +1 -1
  105. package/lib/attr-equal-space-after/index.d.ts +0 -3
  106. package/lib/attr-equal-space-after/index.js +0 -90
  107. package/lib/attr-equal-space-before/index.d.ts +0 -3
  108. package/lib/attr-equal-space-before/index.js +0 -90
  109. package/lib/attr-spacing/index.d.ts +0 -6
  110. package/lib/attr-spacing/index.js +0 -100
  111. package/lib/indentation/index.d.ts +0 -7
  112. package/lib/indentation/index.js +0 -208
  113. package/lib/permitted-contents/array.combination.d.ts +0 -1
  114. package/lib/permitted-contents/array.combination.js +0 -33
  115. package/lib/permitted-contents/permitted-content.spec-to-regexp.d.ts +0 -11
  116. package/lib/permitted-contents/permitted-content.spec-to-regexp.js +0 -225
  117. package/lib/permitted-contents/unfold-content-models-to-tags.d.ts +0 -2
  118. package/lib/permitted-contents/unfold-content-models-to-tags.js +0 -8
@@ -0,0 +1,7 @@
1
+ import type { Options } from '../types';
2
+ import type { AttrChecker } from '@markuplint/ml-core';
3
+ import type { ARIAProperty, ARIARole } from '@markuplint/ml-spec';
4
+ export declare const checkingValue: AttrChecker<boolean, Options, {
5
+ role?: ARIARole | null;
6
+ propSpecs: ARIAProperty[];
7
+ }>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkingValue = void 0;
4
+ const helpers_1 = require("../../helpers");
5
+ const checkingValue = ({ attr, role, propSpecs }) => t => {
6
+ var _a;
7
+ if (attr.isDynamicValue) {
8
+ return;
9
+ }
10
+ const propSpec = propSpecs.find(p => p.name === attr.name);
11
+ const result = (0, helpers_1.checkAria)(attr.ownerMLDocument.specs, attr.name, attr.value, attr.rule.option.version, role === null || role === void 0 ? void 0 : role.name);
12
+ if (result.isValid) {
13
+ return;
14
+ }
15
+ return {
16
+ scope: attr,
17
+ message: t('{0:c} on {1}', t('{0} is {1:c}', t('the "{0}"', attr.value), 'disallowed'), t('the "{0*}" {1}', attr.name, `ARIA ${(_a = propSpec === null || propSpec === void 0 ? void 0 : propSpec.type) !== null && _a !== void 0 ? _a : 'property'}`)) +
18
+ ('enum' in result && result.enum.length ? t('. ') + t('Allowed values are: {0}', t(result.enum)) : ''),
19
+ };
20
+ };
21
+ exports.checkingValue = checkingValue;
@@ -1,10 +1,3 @@
1
- declare type Options = {
2
- checkingValue?: boolean;
3
- checkingDeprecatedProps?: boolean;
4
- permittedAriaRoles?: boolean;
5
- disallowSetImplicitRole?: boolean;
6
- disallowSetImplicitProps?: boolean;
7
- disallowDefaultValue?: boolean;
8
- };
1
+ import type { Options } from './types';
9
2
  declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
10
3
  export default _default;
@@ -2,237 +2,96 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ml_core_1 = require("@markuplint/ml-core");
4
4
  const helpers_1 = require("../helpers");
5
+ const abstract_role_1 = require("./checkings/abstract-role");
6
+ const default_value_1 = require("./checkings/default-value");
7
+ const deprecated_props_1 = require("./checkings/deprecated-props");
8
+ const disallowed_prop_1 = require("./checkings/disallowed-prop");
9
+ const implicit_props_1 = require("./checkings/implicit-props");
10
+ const implicit_role_1 = require("./checkings/implicit-role");
11
+ const interaction_in_hidden_1 = require("./checkings/interaction-in-hidden");
12
+ const no_global_prop_1 = require("./checkings/no-global-prop");
13
+ const non_existant_role_1 = require("./checkings/non-existant-role");
14
+ const permitted_roles_1 = require("./checkings/permitted-roles");
15
+ const presentational_children_1 = require("./checkings/presentational-children");
16
+ const required_owned_elements_1 = require("./checkings/required-owned-elements");
17
+ const required_prop_1 = require("./checkings/required-prop");
18
+ const value_1 = require("./checkings/value");
5
19
  exports.default = (0, ml_core_1.createRule)({
6
20
  defaultOptions: {
7
21
  checkingValue: true,
8
22
  checkingDeprecatedProps: true,
9
23
  permittedAriaRoles: true,
24
+ checkingRequiredOwnedElements: true,
25
+ checkingPresentationalChildren: false,
26
+ checkingInteractionInHidden: false,
10
27
  disallowSetImplicitRole: true,
11
28
  disallowSetImplicitProps: true,
12
29
  disallowDefaultValue: false,
30
+ version: '1.2',
13
31
  },
14
32
  async verify({ document, report, t }) {
15
- await document.walkOn('Element', node => {
16
- const attrSpecs = (0, ml_core_1.getAttrSpecs)(node.nameWithNS, document.specs);
17
- const html = (0, helpers_1.htmlSpec)(document.specs, node.nodeName);
18
- const { roles, ariaAttrs } = (0, helpers_1.ariaSpec)(document.specs);
19
- if (!html || !attrSpecs) {
33
+ await document.walkOn('Element', el => {
34
+ const roleAttr = el.getAttributeNode('role');
35
+ const propAttrs = el.attributes.filter(attr => /^aria-/i.test(attr.name));
36
+ const ariaAttrs = new helpers_1.Collection(roleAttr, ...propAttrs);
37
+ const elSpec = (0, ml_core_1.getSpec)(el, document.specs.specs);
38
+ if (!elSpec) {
20
39
  return;
21
40
  }
22
- const roleAttrTokens = node.getAttributeToken('role');
23
- const roleAttr = roleAttrTokens[0];
24
- // Roles in the spec
25
- if (roleAttr) {
26
- const value = roleAttr.getValue().potential.trim().toLowerCase();
27
- const existedRole = roles.find(role => role.name === value);
28
- if (!existedRole) {
29
- // Not exist
41
+ if (!elSpec.globalAttrs['#ARIAAttrs']) {
42
+ for (const ariaAttr of ariaAttrs) {
30
43
  report({
31
- scope: node,
32
- message: t('{0} according to {1}', t('{0} does not exist', t('the "{0*}" {1}', value, 'role')), 'the WAI-ARIA specification') + `This "${value}" role does not exist in WAI-ARIA.`,
33
- line: roleAttr.startLine,
34
- col: roleAttr.startCol,
35
- raw: roleAttr.raw,
44
+ scope: ariaAttr,
45
+ message: 'ARIA attribute is disallowed',
36
46
  });
37
47
  }
38
- else if (existedRole.isAbstract) {
39
- // the abstract role
40
- report({
41
- scope: node,
42
- message: t('{0} is {1}', t('the "{0*}" {1}', value, 'role'), 'the abstract role'),
43
- line: roleAttr.startLine,
44
- col: roleAttr.startCol,
45
- raw: roleAttr.raw,
46
- });
48
+ return;
49
+ }
50
+ const computed = (0, ml_core_1.getComputedRole)(document.specs, el, el.rule.option.version);
51
+ const { props: propSpecs } = (0, ml_core_1.ariaSpecs)(document.specs, el.rule.option.version);
52
+ if (roleAttr) {
53
+ if (report((0, non_existant_role_1.checkingNonExistantRole)({ attr: roleAttr }))) {
54
+ return;
47
55
  }
48
- // Set the implicit role explicitly
49
- if (node.rule.option.disallowSetImplicitRole) {
50
- const implictRole = (0, helpers_1.getImplicitRole)(document.specs, node);
51
- if (implictRole && implictRole === value) {
52
- // the implicit role
53
- report({
54
- scope: node,
55
- message: t('{0} is {1}', t('the "{0*}" {1}', value, 'role'), t('{0} of {1}', 'the implicit role', t('the "{0*}" {1}', node.nodeName, 'element'))),
56
- line: roleAttr.startLine,
57
- col: roleAttr.startCol,
58
- raw: roleAttr.raw,
59
- });
60
- }
56
+ if (report((0, abstract_role_1.checkingAbstractRole)({ attr: roleAttr }))) {
57
+ return;
61
58
  }
62
- // Permitted ARIA Roles
63
- if (node.rule.option.permittedAriaRoles) {
64
- const permittedRoles = (0, helpers_1.getPermittedRoles)(document.specs, node);
65
- if (permittedRoles === false) {
66
- report({
67
- scope: node,
68
- message: t('{0} according to {1}', t('Cannot overwrite {0}', t('{0} of {1}', t('the {0}', 'role'), t('the "{0*}" {1}', node.nodeName, 'element'))), 'ARIA in HTML specification'),
69
- line: roleAttr.startLine,
70
- col: roleAttr.startCol,
71
- raw: roleAttr.raw,
72
- });
73
- }
74
- else if (Array.isArray(permittedRoles) && !permittedRoles.includes(value)) {
75
- report({
76
- scope: node,
77
- message: t('{0} according to {1}', t('Cannot overwrite {0} to {1}', t('the "{0*}" {1}', value, 'role'), t('the "{0*}" {1}', node.nodeName, 'element')), 'ARIA in HTML specification'),
78
- line: roleAttr.startLine,
79
- col: roleAttr.startCol,
80
- raw: roleAttr.raw,
81
- });
82
- }
59
+ report((0, required_prop_1.checkingRequiredProp)({ el, role: computed.role, propSpecs }));
60
+ if (el.rule.option.disallowSetImplicitRole) {
61
+ report((0, implicit_role_1.checkingImplicitRole)({ attr: roleAttr }));
83
62
  }
84
- }
85
- const computedRole = (0, helpers_1.getComputedRole)(document.specs, node);
86
- if (computedRole) {
87
- const role = (0, helpers_1.getRoleSpec)(document.specs, computedRole.name);
88
- if (role) {
89
- // Checking aria-* on the role
90
- for (const attr of node.attributes) {
91
- const attrName = attr.getName().potential.trim().toLowerCase();
92
- if (/^aria-/i.test(attrName)) {
93
- const statesAndProp = role.statesAndProps.find(s => s.name === attrName);
94
- if (statesAndProp) {
95
- if (node.rule.option.checkingDeprecatedProps && statesAndProp.deprecated) {
96
- report({
97
- scope: node,
98
- message: t('{0:c} on {1}', t('{0} is {1:c}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), 'deprecated'), t('the "{0*}" {1}', role.name, 'role')),
99
- line: attr.startLine,
100
- col: attr.startCol,
101
- raw: attr.raw,
102
- });
103
- }
104
- }
105
- else {
106
- report({
107
- scope: node,
108
- message: t('{0:c} on {1}', t('{0} is {1:c}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), 'disallowed'), t('the "{0*}" {1}', role.name, 'role')),
109
- line: attr.startLine,
110
- col: attr.startCol,
111
- raw: attr.raw,
112
- });
113
- }
114
- }
115
- }
116
- // Checing required props
117
- if (!computedRole.isImplicit) {
118
- const requiredProps = role.statesAndProps.filter(s => s.required).map(s => s.name);
119
- for (const requiredProp of requiredProps) {
120
- const has = node.attributes.some(attr => {
121
- const attrName = attr.getName().potential.trim().toLowerCase();
122
- return attrName === requiredProp;
123
- });
124
- if (!has) {
125
- report({
126
- scope: node,
127
- message: t('{0:c} on {1}', t('Require {0}', t('the "{0*}" {1}', requiredProp, 'ARIA state/property')), t('the "{0*}" {1}', role.name, 'role')),
128
- });
129
- }
130
- }
131
- }
63
+ if (el.rule.option.permittedAriaRoles) {
64
+ report((0, permitted_roles_1.checkingPermittedRoles)({ attr: roleAttr }));
132
65
  }
133
66
  }
134
- else {
135
- // No role element
136
- const { ariaAttrs } = (0, helpers_1.ariaSpec)(document.specs);
137
- for (const attr of node.attributes) {
138
- const attrName = attr.getName().potential.trim().toLowerCase();
139
- if (/^aria-/i.test(attrName)) {
140
- const ariaAttr = ariaAttrs.find(attr => attr.name === attrName);
141
- if (ariaAttr && !ariaAttr.isGlobal) {
142
- report({
143
- scope: node,
144
- message: t('{0} is not {1}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), 'global state/property'),
145
- line: attr.startLine,
146
- col: attr.startCol,
147
- raw: attr.raw,
148
- });
149
- }
150
- }
67
+ for (const attr of propAttrs) {
68
+ report((0, disallowed_prop_1.checkingDisallowedProp)({ attr, role: computed.role, propSpecs }));
69
+ if (el.rule.option.checkingDeprecatedProps) {
70
+ report((0, deprecated_props_1.checkingDeprecatedProps)({ attr, role: computed.role, propSpecs }));
151
71
  }
152
- }
153
- for (const attr of node.attributes) {
154
- if (attr.attrType === 'html-attr' && attr.isDynamicValue) {
155
- continue;
72
+ if (el.rule.option.disallowSetImplicitProps) {
73
+ const attrSpecs = (0, ml_core_1.getAttrSpecs)(el, document.specs);
74
+ report((0, implicit_props_1.checkingImplicitProps)({ attr, propSpecs, attrSpecs }));
75
+ }
76
+ if (el.rule.option.checkingValue) {
77
+ report((0, value_1.checkingValue)({ attr, role: computed.role, propSpecs }));
78
+ }
79
+ if (el.rule.option.disallowDefaultValue) {
80
+ report((0, default_value_1.checkingDefaultValue)({ attr, propSpecs }));
156
81
  }
157
- const attrName = attr.getName().potential.trim().toLowerCase();
158
- if (/^aria-/i.test(attrName)) {
159
- const value = attr.getValue().potential.trim().toLowerCase();
160
- const propSpec = ariaAttrs.find(p => p.name === attrName);
161
- // Checking ARIA Value
162
- if (node.rule.option.checkingValue) {
163
- const result = (0, helpers_1.checkAria)(document.specs, attrName, value, computedRole === null || computedRole === void 0 ? void 0 : computedRole.name);
164
- if (!result.isValid) {
165
- report({
166
- scope: node,
167
- message: t('{0:c} on {1}', t('{0} is {1:c}', t('the "{0}"', value), 'disallowed'), t('the "{0*}" {1}', attrName, 'ARIA state/property')) +
168
- ('enum' in result && result.enum.length
169
- ? t('. ') + t('Allowed values are: {0}', t(result.enum))
170
- : ''),
171
- line: attr.startLine,
172
- col: attr.startCol,
173
- raw: attr.raw,
174
- });
175
- }
176
- }
177
- // Checking implicit props
178
- if (node.rule.option.disallowSetImplicitProps) {
179
- if (propSpec && propSpec.equivalentHtmlAttrs) {
180
- for (const equivalentHtmlAttr of propSpec.equivalentHtmlAttrs) {
181
- const htmlAttrSpec = attrSpecs.find(a => a.name === equivalentHtmlAttr.htmlAttrName);
182
- const isValid = (0, helpers_1.isValidAttr)(t, equivalentHtmlAttr.htmlAttrName, equivalentHtmlAttr.value || '', false, node, attrSpecs);
183
- if (isValid && isValid.invalidType === 'non-existent') {
184
- continue;
185
- }
186
- if (node.hasAttribute(equivalentHtmlAttr.htmlAttrName)) {
187
- const targetAttrValue = node.getAttribute(equivalentHtmlAttr.htmlAttrName);
188
- if ((equivalentHtmlAttr.value == null && targetAttrValue === value) ||
189
- equivalentHtmlAttr.value === value) {
190
- report({
191
- scope: node,
192
- message: t('{0} has {1}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), t('the same {0} as {1}', 'semantics', t('{0} or {1}', t('the current "{0}" {1}', equivalentHtmlAttr.htmlAttrName, 'attribute'), t('the implicit "{0}" {1}', equivalentHtmlAttr.htmlAttrName, 'attribute')))),
193
- line: attr.startLine,
194
- col: attr.startCol,
195
- raw: attr.raw,
196
- });
197
- continue;
198
- }
199
- if ((htmlAttrSpec === null || htmlAttrSpec === void 0 ? void 0 : htmlAttrSpec.type) === 'Boolean' && value !== 'false') {
200
- continue;
201
- }
202
- report({
203
- scope: node,
204
- message: t('{0} contradicts {1}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), t('the current "{0}" {1}', equivalentHtmlAttr.htmlAttrName, 'attribute')),
205
- line: attr.startLine,
206
- col: attr.startCol,
207
- raw: attr.raw,
208
- });
209
- }
210
- else if (value === 'true') {
211
- if (!equivalentHtmlAttr.isNotStrictEquivalent && (htmlAttrSpec === null || htmlAttrSpec === void 0 ? void 0 : htmlAttrSpec.type) === 'Boolean') {
212
- report({
213
- scope: node,
214
- message: t('{0} contradicts {1}', t('the "{0*}" {1}', attrName, 'ARIA state/property'), t('the implicit "{0}" {1}', equivalentHtmlAttr.htmlAttrName, 'attribute')),
215
- line: attr.startLine,
216
- col: attr.startCol,
217
- raw: attr.raw,
218
- });
219
- }
220
- }
221
- }
222
- }
223
- }
224
- // Default value
225
- if (node.rule.option.disallowDefaultValue && propSpec && propSpec.defaultValue === value) {
226
- report({
227
- scope: node,
228
- message: t('It is {0}', 'default value'),
229
- line: attr.startLine,
230
- col: attr.startCol,
231
- raw: attr.raw,
232
- });
233
- }
82
+ if (!computed.role) {
83
+ report((0, no_global_prop_1.checkingNoGlobalProp)({ attr, propSpecs }));
234
84
  }
235
85
  }
86
+ if (el.rule.option.checkingRequiredOwnedElements) {
87
+ report((0, required_owned_elements_1.checkingRequiredOwnedElements)({ el, role: computed.role }));
88
+ }
89
+ if (el.rule.option.checkingPresentationalChildren) {
90
+ report((0, presentational_children_1.checkingPresentationalChildren)({ el }));
91
+ }
92
+ if (el.rule.option.checkingInteractionInHidden) {
93
+ report((0, interaction_in_hidden_1.checkingInteractionInHidden)({ el }));
94
+ }
236
95
  });
237
96
  },
238
97
  });
@@ -0,0 +1,13 @@
1
+ import type { ARIAVersion } from '@markuplint/ml-spec';
2
+ export declare type Options = {
3
+ checkingValue: boolean;
4
+ checkingDeprecatedProps: boolean;
5
+ permittedAriaRoles: boolean;
6
+ checkingRequiredOwnedElements: boolean;
7
+ checkingPresentationalChildren: boolean;
8
+ checkingInteractionInHidden: boolean;
9
+ disallowSetImplicitRole: boolean;
10
+ disallowSetImplicitProps: boolean;
11
+ disallowDefaultValue: boolean;
12
+ version: ARIAVersion;
13
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "2.4.3",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "Rules for markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -17,16 +17,17 @@
17
17
  "clean": "tsc --build --clean"
18
18
  },
19
19
  "dependencies": {
20
- "@markuplint/html-spec": "2.8.0",
21
- "@markuplint/ml-core": "2.3.3",
22
- "@markuplint/ml-spec": "2.1.1",
23
- "@markuplint/types": "2.2.0",
20
+ "@markuplint/html-spec": "3.0.0-alpha.1",
21
+ "@markuplint/ml-core": "3.0.0-alpha.1",
22
+ "@markuplint/ml-spec": "3.0.0-alpha.1",
23
+ "@markuplint/types": "3.0.0-alpha.1",
24
+ "@ungap/structured-clone": "^1.0.1",
24
25
  "debug": "^4.3.4",
25
26
  "html-entities": "^2.3.3",
26
- "tslib": "^2.3.1"
27
+ "tslib": "^2.4.0"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/debug": "^4.1.7"
30
31
  },
31
- "gitHead": "c28258b756d8c42890698e26c03cdc02c6833489"
32
+ "gitHead": "56de89456146a06777eb5b6d4e8ba456147dd18b"
32
33
  }
package/schema.json CHANGED
@@ -9,15 +9,6 @@
9
9
  "attr-duplication": {
10
10
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/attr-duplication/schema.json"
11
11
  },
12
- "attr-equal-space-after": {
13
- "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/attr-equal-space-after/schema.json"
14
- },
15
- "attr-equal-space-before": {
16
- "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/attr-equal-space-before/schema.json"
17
- },
18
- "attr-spacing": {
19
- "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/attr-spacing/schema.json"
20
- },
21
12
  "attr-value-quotes": {
22
13
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/attr-value-quotes/schema.json"
23
14
  },
@@ -51,9 +42,6 @@
51
42
  "end-tag": {
52
43
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/end-tag/schema.json"
53
44
  },
54
- "indentation": {
55
- "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/indentation/schema.json"
56
- },
57
45
  "ineffective-attr": {
58
46
  "$ref": "https://raw.githubusercontent.com/markuplint/markuplint/main/packages/%40markuplint/rules/src/ineffective-attr/schema.json"
59
47
  },