@markuplint/rules 3.12.0 → 4.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 (142) hide show
  1. package/lib/attr-check.js +14 -19
  2. package/lib/attr-duplication/index.js +3 -6
  3. package/lib/attr-value-quotes/index.js +5 -9
  4. package/lib/case-sensitive-attr-name/index.js +9 -13
  5. package/lib/case-sensitive-tag-name/index.js +2 -4
  6. package/lib/character-reference/index.js +6 -8
  7. package/lib/class-naming/index.js +9 -11
  8. package/lib/create-message.js +9 -16
  9. package/lib/debug.js +2 -6
  10. package/lib/deprecated-attr/index.js +6 -9
  11. package/lib/deprecated-element/index.js +3 -5
  12. package/lib/disallowed-element/index.js +2 -4
  13. package/lib/doctype/index.js +2 -4
  14. package/lib/end-tag/index.js +5 -8
  15. package/lib/helpers.d.ts +1 -1
  16. package/lib/helpers.js +17 -28
  17. package/lib/id-duplication/index.js +2 -4
  18. package/lib/index.d.ts +15 -15
  19. package/lib/index.js +63 -66
  20. package/lib/ineffective-attr/index.js +5 -7
  21. package/lib/invalid-attr/index.js +30 -33
  22. package/lib/label-has-control/index.js +2 -4
  23. package/lib/landmark-roles/index.js +3 -6
  24. package/lib/no-boolean-attr-value/index.js +6 -9
  25. package/lib/no-default-value/index.js +9 -12
  26. package/lib/no-empty-palpable-content/index.js +5 -7
  27. package/lib/no-hard-code-id/index.js +2 -4
  28. package/lib/no-refer-to-non-existent-id/index.js +26 -30
  29. package/lib/no-use-event-handler-attr/index.js +4 -6
  30. package/lib/permitted-contents/choice.d.ts +1 -1
  31. package/lib/permitted-contents/choice.js +13 -18
  32. package/lib/permitted-contents/complex-branch.d.ts +1 -1
  33. package/lib/permitted-contents/complex-branch.js +10 -14
  34. package/lib/permitted-contents/content-model.d.ts +1 -1
  35. package/lib/permitted-contents/content-model.js +5 -9
  36. package/lib/permitted-contents/count-pattern.d.ts +1 -1
  37. package/lib/permitted-contents/count-pattern.js +19 -24
  38. package/lib/permitted-contents/debug.browser.js +9 -12
  39. package/lib/permitted-contents/debug.d.ts +8 -1
  40. package/lib/permitted-contents/debug.js +12 -13
  41. package/lib/permitted-contents/index.d.ts +1 -1
  42. package/lib/permitted-contents/index.js +10 -13
  43. package/lib/permitted-contents/matches-selector.d.ts +1 -1
  44. package/lib/permitted-contents/matches-selector.js +12 -17
  45. package/lib/permitted-contents/order.d.ts +1 -1
  46. package/lib/permitted-contents/order.js +17 -22
  47. package/lib/permitted-contents/recursive-branch.d.ts +2 -2
  48. package/lib/permitted-contents/recursive-branch.js +9 -13
  49. package/lib/permitted-contents/represent-transparent-nodes.d.ts +1 -1
  50. package/lib/permitted-contents/represent-transparent-nodes.js +15 -20
  51. package/lib/permitted-contents/start.d.ts +1 -1
  52. package/lib/permitted-contents/start.js +13 -21
  53. package/lib/permitted-contents/transparent.d.ts +1 -1
  54. package/lib/permitted-contents/transparent.js +4 -9
  55. package/lib/permitted-contents/types.js +1 -2
  56. package/lib/permitted-contents/utils.d.ts +1 -1
  57. package/lib/permitted-contents/utils.js +55 -74
  58. package/lib/placeholder-label-option/index.js +5 -9
  59. package/lib/require-accessible-name/index.js +10 -13
  60. package/lib/require-datetime/index.d.ts +1 -1
  61. package/lib/require-datetime/index.js +6 -8
  62. package/lib/require-datetime/types.js +1 -2
  63. package/lib/require-datetime/utils.d.ts +1 -1
  64. package/lib/require-datetime/utils.js +4 -11
  65. package/lib/required-attr/index.js +8 -11
  66. package/lib/required-element/index.js +3 -6
  67. package/lib/required-h1/index.js +3 -6
  68. package/lib/use-list/index.js +6 -10
  69. package/lib/wai-aria/checkings/abstract-role.d.ts +1 -1
  70. package/lib/wai-aria/checkings/abstract-role.js +5 -10
  71. package/lib/wai-aria/checkings/default-value.d.ts +1 -1
  72. package/lib/wai-aria/checkings/default-value.js +2 -6
  73. package/lib/wai-aria/checkings/deprecated-props.d.ts +1 -1
  74. package/lib/wai-aria/checkings/deprecated-props.js +3 -8
  75. package/lib/wai-aria/checkings/disallowed-prop.d.ts +1 -1
  76. package/lib/wai-aria/checkings/disallowed-prop.js +7 -12
  77. package/lib/wai-aria/checkings/implicit-props.d.ts +1 -1
  78. package/lib/wai-aria/checkings/implicit-props.js +6 -11
  79. package/lib/wai-aria/checkings/implicit-role.d.ts +1 -1
  80. package/lib/wai-aria/checkings/implicit-role.js +4 -9
  81. package/lib/wai-aria/checkings/interaction-in-hidden.d.ts +1 -1
  82. package/lib/wai-aria/checkings/interaction-in-hidden.js +4 -8
  83. package/lib/wai-aria/checkings/no-global-prop.d.ts +1 -1
  84. package/lib/wai-aria/checkings/no-global-prop.js +2 -7
  85. package/lib/wai-aria/checkings/non-existent-role.d.ts +1 -1
  86. package/lib/wai-aria/checkings/non-existent-role.js +4 -9
  87. package/lib/wai-aria/checkings/permitted-roles.d.ts +1 -1
  88. package/lib/wai-aria/checkings/permitted-roles.js +4 -9
  89. package/lib/wai-aria/checkings/presentational-children.d.ts +1 -1
  90. package/lib/wai-aria/checkings/presentational-children.js +4 -9
  91. package/lib/wai-aria/checkings/required-owned-elements.d.ts +1 -1
  92. package/lib/wai-aria/checkings/required-owned-elements.js +4 -8
  93. package/lib/wai-aria/checkings/required-prop.d.ts +1 -1
  94. package/lib/wai-aria/checkings/required-prop.js +2 -7
  95. package/lib/wai-aria/checkings/value.d.ts +1 -1
  96. package/lib/wai-aria/checkings/value.js +4 -10
  97. package/lib/wai-aria/index.d.ts +1 -1
  98. package/lib/wai-aria/index.js +38 -40
  99. package/lib/wai-aria/types.js +1 -2
  100. package/package.json +17 -12
  101. package/test/attr-check.spec.js +0 -77
  102. package/test/attr-duplication/index.spec.js +0 -159
  103. package/test/attr-value-quotes/index.spec.js +0 -133
  104. package/test/case-sensitive-attr-name/index.spec.js +0 -65
  105. package/test/case-sensitive-tag-name/index.spec.js +0 -80
  106. package/test/character-reference/index.spec.js +0 -72
  107. package/test/class-naming/index.spec.js +0 -470
  108. package/test/create-message.spec.js +0 -497
  109. package/test/deprecated-attr/index.spec.js +0 -48
  110. package/test/deprecated-element/index.spec.js +0 -35
  111. package/test/disallowed-element/index.spec.js +0 -90
  112. package/test/doctype/index.spec.js +0 -50
  113. package/test/end-tag/index.spec.js +0 -162
  114. package/test/id-duplication/index.spec.js +0 -47
  115. package/test/ineffective-attr/index.spec.js +0 -31
  116. package/test/invalid-attr/index.spec.js +0 -1641
  117. package/test/label-has-control/index.spec.js +0 -29
  118. package/test/landmark-roles/index.spec.js +0 -187
  119. package/test/no-boolean-attr-value/index.spec.js +0 -41
  120. package/test/no-default-value/index.spec.js +0 -74
  121. package/test/no-empty-palpable-content/index.spec.js +0 -115
  122. package/test/no-hard-code-id/index.spec.js +0 -100
  123. package/test/no-refer-to-non-existent-id/index.spec.js +0 -254
  124. package/test/no-use-event-handler-attr/index.spec.js +0 -57
  125. package/test/permitted-contents/choice.spec.js +0 -174
  126. package/test/permitted-contents/count-pattern.spec.js +0 -308
  127. package/test/permitted-contents/index.spec.js +0 -1395
  128. package/test/permitted-contents/matches-selector.spec.js +0 -59
  129. package/test/permitted-contents/order.spec.js +0 -351
  130. package/test/permitted-contents/recursive-branch.spec.js +0 -41
  131. package/test/permitted-contents/represent-transparent-nodes.spec.js +0 -24
  132. package/test/permitted-contents/start.spec.js +0 -67
  133. package/test/placeholder-label-option/index.spec.js +0 -113
  134. package/test/require-accessible-name/index.spec.js +0 -444
  135. package/test/require-datetime/index.spec.js +0 -54
  136. package/test/require-datetime/utils.spec.js +0 -52
  137. package/test/required-attr/index.spec.js +0 -414
  138. package/test/required-element/index.spec.js +0 -188
  139. package/test/required-h1/index.spec.js +0 -69
  140. package/test/use-list/index.spec.js +0 -109
  141. package/test/wai-aria/checkings/value.spec.js +0 -33
  142. package/test/wai-aria/index.spec.js +0 -1203
package/lib/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  declare const rules: {
2
2
  readonly 'attr-duplication': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
3
- readonly 'attr-value-quotes': Readonly<import("@markuplint/ml-core").RuleSeed<import("./attr-value-quotes").Type, undefined>>;
4
- readonly 'case-sensitive-attr-name': Readonly<import("@markuplint/ml-core").RuleSeed<import("./case-sensitive-attr-name").Value, undefined>>;
5
- readonly 'case-sensitive-tag-name': Readonly<import("@markuplint/ml-core").RuleSeed<import("./case-sensitive-tag-name").Value, undefined>>;
3
+ readonly 'attr-value-quotes': Readonly<import("@markuplint/ml-core").RuleSeed<import("./attr-value-quotes/index.js").Type, undefined>>;
4
+ readonly 'case-sensitive-attr-name': Readonly<import("@markuplint/ml-core").RuleSeed<import("./case-sensitive-attr-name/index.js").Value, undefined>>;
5
+ readonly 'case-sensitive-tag-name': Readonly<import("@markuplint/ml-core").RuleSeed<import("./case-sensitive-tag-name/index.js").Value, undefined>>;
6
6
  readonly 'character-reference': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
7
- readonly 'class-naming': Readonly<import("@markuplint/ml-core").RuleSeed<import("./class-naming").Value, undefined>>;
7
+ readonly 'class-naming': Readonly<import("@markuplint/ml-core").RuleSeed<import("./class-naming/index.js").Value, undefined>>;
8
8
  readonly 'deprecated-attr': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
9
9
  readonly 'deprecated-element': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
10
10
  readonly 'disallowed-element': Readonly<import("@markuplint/ml-core").RuleSeed<string[], undefined>>;
@@ -20,15 +20,15 @@ declare const rules: {
20
20
  } | {
21
21
  pattern: string;
22
22
  } | {
23
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
23
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
24
24
  }> | (string | {
25
25
  name: string;
26
- value: import("packages/@markuplint/ml-spec/lib").AttributeType | ({
26
+ value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
27
27
  enum: [string, ...string[]];
28
28
  } | {
29
29
  pattern: string;
30
30
  } | {
31
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
31
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
32
32
  });
33
33
  })[] | undefined;
34
34
  disallowAttrs?: Record<string, {
@@ -36,15 +36,15 @@ declare const rules: {
36
36
  } | {
37
37
  pattern: string;
38
38
  } | {
39
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
39
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
40
40
  }> | (string | {
41
41
  name: string;
42
- value: import("packages/@markuplint/ml-spec/lib").AttributeType | ({
42
+ value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
43
43
  enum: [string, ...string[]];
44
44
  } | {
45
45
  pattern: string;
46
46
  } | {
47
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
47
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
48
48
  });
49
49
  })[] | undefined;
50
50
  ignoreAttrNamePrefix?: string | string[] | undefined;
@@ -54,7 +54,7 @@ declare const rules: {
54
54
  } | {
55
55
  pattern: string;
56
56
  } | {
57
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
57
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
58
58
  }) | {
59
59
  disallowed: true;
60
60
  }> | undefined;
@@ -78,13 +78,13 @@ declare const rules: {
78
78
  readonly 'no-use-event-handler-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
79
79
  ignore?: string | string[] | undefined;
80
80
  }>>;
81
- readonly 'permitted-contents': Readonly<import("@markuplint/ml-core").RuleSeed<import("./permitted-contents/types").TagRule[], import("./permitted-contents/types").Options>>;
81
+ readonly 'permitted-contents': Readonly<import("@markuplint/ml-core").RuleSeed<import("./permitted-contents/types.js").TagRule[], import("./permitted-contents/types.js").Options>>;
82
82
  readonly 'placeholder-label-option': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
83
83
  readonly 'require-accessible-name': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
84
84
  ariaVersion: "1.1" | "1.2" | "1.3";
85
85
  }>>;
86
86
  readonly 'require-datetime': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
87
- langs?: import("./require-datetime/types").Lang[] | undefined;
87
+ langs?: import("./require-datetime/types.js").Lang[] | undefined;
88
88
  }>>;
89
89
  readonly 'required-attr': Readonly<import("@markuplint/ml-core").RuleSeed<string | (string | {
90
90
  name: string;
@@ -93,10 +93,10 @@ declare const rules: {
93
93
  readonly 'required-element': Readonly<import("@markuplint/ml-core").RuleSeed<string[], {
94
94
  ignoreHasMutableContents: boolean;
95
95
  }>>;
96
- readonly 'required-h1': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./required-h1").Options>>;
96
+ readonly 'required-h1': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./required-h1/index.js").Options>>;
97
97
  readonly 'use-list': Readonly<import("@markuplint/ml-core").RuleSeed<readonly string[], {
98
98
  spaceNeededBullets?: string[] | undefined;
99
99
  }>>;
100
- readonly 'wai-aria': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./wai-aria/types").Options>>;
100
+ readonly 'wai-aria': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, import("./wai-aria/types.js").Options>>;
101
101
  };
102
102
  export default rules;
package/lib/index.js CHANGED
@@ -1,68 +1,65 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const attr_duplication_1 = tslib_1.__importDefault(require("./attr-duplication"));
5
- const attr_value_quotes_1 = tslib_1.__importDefault(require("./attr-value-quotes"));
6
- const case_sensitive_attr_name_1 = tslib_1.__importDefault(require("./case-sensitive-attr-name"));
7
- const case_sensitive_tag_name_1 = tslib_1.__importDefault(require("./case-sensitive-tag-name"));
8
- const character_reference_1 = tslib_1.__importDefault(require("./character-reference"));
9
- const class_naming_1 = tslib_1.__importDefault(require("./class-naming"));
10
- const deprecated_attr_1 = tslib_1.__importDefault(require("./deprecated-attr"));
11
- const deprecated_element_1 = tslib_1.__importDefault(require("./deprecated-element"));
12
- const disallowed_element_1 = tslib_1.__importDefault(require("./disallowed-element"));
13
- const doctype_1 = tslib_1.__importDefault(require("./doctype"));
14
- const end_tag_1 = tslib_1.__importDefault(require("./end-tag"));
15
- const id_duplication_1 = tslib_1.__importDefault(require("./id-duplication"));
16
- const ineffective_attr_1 = tslib_1.__importDefault(require("./ineffective-attr"));
17
- const invalid_attr_1 = tslib_1.__importDefault(require("./invalid-attr"));
18
- const label_has_control_1 = tslib_1.__importDefault(require("./label-has-control"));
19
- const landmark_roles_1 = tslib_1.__importDefault(require("./landmark-roles"));
20
- const no_boolean_attr_value_1 = tslib_1.__importDefault(require("./no-boolean-attr-value"));
21
- const no_default_value_1 = tslib_1.__importDefault(require("./no-default-value"));
22
- const no_empty_palpable_content_1 = tslib_1.__importDefault(require("./no-empty-palpable-content"));
23
- const no_hard_code_id_1 = tslib_1.__importDefault(require("./no-hard-code-id"));
24
- const no_refer_to_non_existent_id_1 = tslib_1.__importDefault(require("./no-refer-to-non-existent-id"));
25
- const no_use_event_handler_attr_1 = tslib_1.__importDefault(require("./no-use-event-handler-attr"));
26
- const permitted_contents_1 = tslib_1.__importDefault(require("./permitted-contents"));
27
- const placeholder_label_option_1 = tslib_1.__importDefault(require("./placeholder-label-option"));
28
- const require_accessible_name_1 = tslib_1.__importDefault(require("./require-accessible-name"));
29
- const require_datetime_1 = tslib_1.__importDefault(require("./require-datetime"));
30
- const required_attr_1 = tslib_1.__importDefault(require("./required-attr"));
31
- const required_element_1 = tslib_1.__importDefault(require("./required-element"));
32
- const required_h1_1 = tslib_1.__importDefault(require("./required-h1"));
33
- const use_list_1 = tslib_1.__importDefault(require("./use-list"));
34
- const wai_aria_1 = tslib_1.__importDefault(require("./wai-aria"));
1
+ import AttrDuplication from './attr-duplication/index.js';
2
+ import AttrValueQuotes from './attr-value-quotes/index.js';
3
+ import CaseSensitiveAttrName from './case-sensitive-attr-name/index.js';
4
+ import CaseSensitiveTagName from './case-sensitive-tag-name/index.js';
5
+ import CharacterReference from './character-reference/index.js';
6
+ import ClassNaming from './class-naming/index.js';
7
+ import DeprecatedAttr from './deprecated-attr/index.js';
8
+ import DeprecatedElement from './deprecated-element/index.js';
9
+ import DisallowedElement from './disallowed-element/index.js';
10
+ import Doctype from './doctype/index.js';
11
+ import EndTag from './end-tag/index.js';
12
+ import IdDuplication from './id-duplication/index.js';
13
+ import IneffectiveAttr from './ineffective-attr/index.js';
14
+ import InvalidAttr from './invalid-attr/index.js';
15
+ import LabelHasControl from './label-has-control/index.js';
16
+ import LandmarkRoles from './landmark-roles/index.js';
17
+ import NoBooleanAttrValue from './no-boolean-attr-value/index.js';
18
+ import NoDefaultValue from './no-default-value/index.js';
19
+ import NoEmptyPalpableContent from './no-empty-palpable-content/index.js';
20
+ import NoHardCodeId from './no-hard-code-id/index.js';
21
+ import NoReferToNonExistentId from './no-refer-to-non-existent-id/index.js';
22
+ import NoUseEventHandlerAttr from './no-use-event-handler-attr/index.js';
23
+ import PermittedContents from './permitted-contents/index.js';
24
+ import PlaceholderLabelOption from './placeholder-label-option/index.js';
25
+ import RequireAccessibleName from './require-accessible-name/index.js';
26
+ import RequireDatetime from './require-datetime/index.js';
27
+ import RequiredAttr from './required-attr/index.js';
28
+ import RequiredElement from './required-element/index.js';
29
+ import RequiredH1 from './required-h1/index.js';
30
+ import UseList from './use-list/index.js';
31
+ import WaiAria from './wai-aria/index.js';
35
32
  const rules = {
36
- 'attr-duplication': attr_duplication_1.default,
37
- 'attr-value-quotes': attr_value_quotes_1.default,
38
- 'case-sensitive-attr-name': case_sensitive_attr_name_1.default,
39
- 'case-sensitive-tag-name': case_sensitive_tag_name_1.default,
40
- 'character-reference': character_reference_1.default,
41
- 'class-naming': class_naming_1.default,
42
- 'deprecated-attr': deprecated_attr_1.default,
43
- 'deprecated-element': deprecated_element_1.default,
44
- 'disallowed-element': disallowed_element_1.default,
45
- doctype: doctype_1.default,
46
- 'end-tag': end_tag_1.default,
47
- 'id-duplication': id_duplication_1.default,
48
- 'ineffective-attr': ineffective_attr_1.default,
49
- 'invalid-attr': invalid_attr_1.default,
50
- 'label-has-control': label_has_control_1.default,
51
- 'landmark-roles': landmark_roles_1.default,
52
- 'no-boolean-attr-value': no_boolean_attr_value_1.default,
53
- 'no-default-value': no_default_value_1.default,
54
- 'no-empty-palpable-content': no_empty_palpable_content_1.default,
55
- 'no-hard-code-id': no_hard_code_id_1.default,
56
- 'no-refer-to-non-existent-id': no_refer_to_non_existent_id_1.default,
57
- 'no-use-event-handler-attr': no_use_event_handler_attr_1.default,
58
- 'permitted-contents': permitted_contents_1.default,
59
- 'placeholder-label-option': placeholder_label_option_1.default,
60
- 'require-accessible-name': require_accessible_name_1.default,
61
- 'require-datetime': require_datetime_1.default,
62
- 'required-attr': required_attr_1.default,
63
- 'required-element': required_element_1.default,
64
- 'required-h1': required_h1_1.default,
65
- 'use-list': use_list_1.default,
66
- 'wai-aria': wai_aria_1.default,
33
+ 'attr-duplication': AttrDuplication,
34
+ 'attr-value-quotes': AttrValueQuotes,
35
+ 'case-sensitive-attr-name': CaseSensitiveAttrName,
36
+ 'case-sensitive-tag-name': CaseSensitiveTagName,
37
+ 'character-reference': CharacterReference,
38
+ 'class-naming': ClassNaming,
39
+ 'deprecated-attr': DeprecatedAttr,
40
+ 'deprecated-element': DeprecatedElement,
41
+ 'disallowed-element': DisallowedElement,
42
+ doctype: Doctype,
43
+ 'end-tag': EndTag,
44
+ 'id-duplication': IdDuplication,
45
+ 'ineffective-attr': IneffectiveAttr,
46
+ 'invalid-attr': InvalidAttr,
47
+ 'label-has-control': LabelHasControl,
48
+ 'landmark-roles': LandmarkRoles,
49
+ 'no-boolean-attr-value': NoBooleanAttrValue,
50
+ 'no-default-value': NoDefaultValue,
51
+ 'no-empty-palpable-content': NoEmptyPalpableContent,
52
+ 'no-hard-code-id': NoHardCodeId,
53
+ 'no-refer-to-non-existent-id': NoReferToNonExistentId,
54
+ 'no-use-event-handler-attr': NoUseEventHandlerAttr,
55
+ 'permitted-contents': PermittedContents,
56
+ 'placeholder-label-option': PlaceholderLabelOption,
57
+ 'require-accessible-name': RequireAccessibleName,
58
+ 'require-datetime': RequireDatetime,
59
+ 'required-attr': RequiredAttr,
60
+ 'required-element': RequiredElement,
61
+ 'required-h1': RequiredH1,
62
+ 'use-list': UseList,
63
+ 'wai-aria': WaiAria,
67
64
  };
68
- exports.default = rules;
65
+ export default rules;
@@ -1,12 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- const shared_1 = require("@markuplint/shared");
5
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
+ import { toNoEmptyStringArrayFromStringOrArray } from '@markuplint/shared';
3
+ export default createRule({
6
4
  defaultSeverity: 'warning',
7
5
  async verify({ document, report, t }) {
8
6
  await document.walkOn('Attr', attr => {
9
- const attrSpec = (0, ml_core_1.getAttrSpecs)(attr.ownerElement, document.specs);
7
+ const attrSpec = getAttrSpecs(attr.ownerElement, document.specs);
10
8
  if (!attrSpec) {
11
9
  return;
12
10
  }
@@ -15,7 +13,7 @@ exports.default = (0, ml_core_1.createRule)({
15
13
  if (!spec) {
16
14
  return;
17
15
  }
18
- const ineffectiveConditions = (0, shared_1.toNoEmptyStringArrayFromStringOrArray)(spec.ineffective);
16
+ const ineffectiveConditions = toNoEmptyStringArrayFromStringOrArray(spec.ineffective);
19
17
  if (ineffectiveConditions.some(selector => attr.ownerElement.matches(selector))) {
20
18
  report({
21
19
  scope: attr,
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- const attr_check_1 = require("../attr-check");
5
- const debug_1 = require("../debug");
6
- const helpers_1 = require("../helpers");
7
- const log = debug_1.log.extend('invalid-attr');
8
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule, getAttrSpecs, getSpec } from '@markuplint/ml-core';
2
+ import { attrCheck } from '../attr-check.js';
3
+ import { log as ruleLog } from '../debug.js';
4
+ import { isValidAttr, match } from '../helpers.js';
5
+ const log = ruleLog.extend('invalid-attr');
6
+ export default createRule({
9
7
  defaultOptions: {},
10
8
  async verify({ document, report, t }) {
11
9
  await document.walkOn('Attr', attr => {
12
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
13
10
  // Default
14
- const allowToAddPropertiesForPretender = (_a = attr.rule.options.allowToAddPropertiesForPretender) !== null && _a !== void 0 ? _a : true;
11
+ const allowToAddPropertiesForPretender = attr.rule.options.allowToAddPropertiesForPretender ?? true;
15
12
  if (attr.isDirective) {
16
13
  return;
17
14
  }
18
- const attrSpecs = (0, ml_core_1.getAttrSpecs)(attr.ownerElement, document.specs);
15
+ const attrSpecs = getAttrSpecs(attr.ownerElement, document.specs);
19
16
  const attrName = attr.nameNode;
20
17
  const name = attr.name;
21
18
  if (attr.ownerElement.elementType === 'html' && attr.candidate) {
@@ -24,9 +21,9 @@ exports.default = (0, ml_core_1.createRule)({
24
21
  t('Did you mean "{0}"?', attr.candidate);
25
22
  report({
26
23
  scope: attr,
27
- line: attrName === null || attrName === void 0 ? void 0 : attrName.startLine,
28
- col: attrName === null || attrName === void 0 ? void 0 : attrName.startCol,
29
- raw: attrName === null || attrName === void 0 ? void 0 : attrName.raw,
24
+ line: attrName?.startLine,
25
+ col: attrName?.startCol,
26
+ raw: attrName?.raw,
30
27
  message: message,
31
28
  });
32
29
  return;
@@ -94,11 +91,11 @@ exports.default = (0, ml_core_1.createRule)({
94
91
  }
95
92
  }
96
93
  }
97
- const allowValue = (_b = allowAttrs[name]) !== null && _b !== void 0 ? _b : null;
98
- const disallowValue = (_c = disallowAttrs[name]) !== null && _c !== void 0 ? _c : null;
94
+ const allowValue = allowAttrs[name] ?? null;
95
+ const disallowValue = disallowAttrs[name] ?? null;
99
96
  if (allowValue) {
100
97
  if ('enum' in allowValue) {
101
- invalid = (0, attr_check_1.attrCheck)(t, name.toLowerCase(), value, true, {
98
+ invalid = attrCheck(t, name.toLowerCase(), value, true, {
102
99
  name,
103
100
  type: {
104
101
  enum: allowValue.enum,
@@ -107,7 +104,7 @@ exports.default = (0, ml_core_1.createRule)({
107
104
  });
108
105
  }
109
106
  else if ('pattern' in allowValue) {
110
- if (!(0, helpers_1.match)(value, allowValue.pattern)) {
107
+ if (!match(value, allowValue.pattern)) {
111
108
  invalid = {
112
109
  invalidType: 'invalid-value',
113
110
  message: t('{0} is unmatched with the below patterns: {1}', t('the "{0*}" {1}', name, 'attribute'), allowValue.pattern),
@@ -115,12 +112,12 @@ exports.default = (0, ml_core_1.createRule)({
115
112
  }
116
113
  }
117
114
  else if ('type' in allowValue) {
118
- invalid = (0, attr_check_1.attrCheck)(t, name, value, true, { name, type: allowValue.type, description: '' });
115
+ invalid = attrCheck(t, name, value, true, { name, type: allowValue.type, description: '' });
119
116
  }
120
117
  }
121
118
  else if (disallowValue) {
122
119
  if ('enum' in disallowValue) {
123
- const checkResult = (0, attr_check_1.attrCheck)(t, name.toLowerCase(), value, true, {
120
+ const checkResult = attrCheck(t, name.toLowerCase(), value, true, {
124
121
  name,
125
122
  type: {
126
123
  enum: disallowValue.enum,
@@ -135,7 +132,7 @@ exports.default = (0, ml_core_1.createRule)({
135
132
  }
136
133
  }
137
134
  else if ('pattern' in disallowValue) {
138
- if ((0, helpers_1.match)(value, disallowValue.pattern)) {
135
+ if (match(value, disallowValue.pattern)) {
139
136
  invalid = {
140
137
  invalidType: 'invalid-value',
141
138
  message: t('{0} is matched with the below disallowed patterns: {1}', t('the "{0*}" {1}', name, 'attribute'), disallowValue.pattern),
@@ -150,7 +147,7 @@ exports.default = (0, ml_core_1.createRule)({
150
147
  };
151
148
  }
152
149
  else {
153
- const checkResult = (0, attr_check_1.attrCheck)(t, name, value, true, {
150
+ const checkResult = attrCheck(t, name, value, true, {
154
151
  name,
155
152
  type: disallowValue.type,
156
153
  description: '',
@@ -166,7 +163,7 @@ exports.default = (0, ml_core_1.createRule)({
166
163
  }
167
164
  else if (attr.ownerElement.elementType === 'html' && attrSpecs) {
168
165
  log('Checking %s[%s="%s"]', attr.nodeName, name, value);
169
- invalid = (0, helpers_1.isValidAttr)(t, name, value, attr.isDynamicValue || false, attr.ownerElement, attrSpecs, log);
166
+ invalid = isValidAttr(t, name, value, attr.isDynamicValue || false, attr.ownerElement, attrSpecs, log);
170
167
  }
171
168
  if (invalid !== false) {
172
169
  switch (invalid.invalidType) {
@@ -184,28 +181,28 @@ exports.default = (0, ml_core_1.createRule)({
184
181
  report({
185
182
  scope: attr,
186
183
  message: invalid.message,
187
- line: ((_d = valueNode === null || valueNode === void 0 ? void 0 : valueNode.startLine) !== null && _d !== void 0 ? _d : 0) + ((_f = (_e = invalid.loc) === null || _e === void 0 ? void 0 : _e.line) !== null && _f !== void 0 ? _f : 0),
184
+ line: (valueNode?.startLine ?? 0) + (invalid.loc?.line ?? 0),
188
185
  col: invalid.loc && invalid.loc.line > 0
189
- ? ((_g = invalid.loc) === null || _g === void 0 ? void 0 : _g.col) + 1
190
- : ((_h = valueNode === null || valueNode === void 0 ? void 0 : valueNode.startCol) !== null && _h !== void 0 ? _h : 0) + ((_k = (_j = invalid.loc) === null || _j === void 0 ? void 0 : _j.col) !== null && _k !== void 0 ? _k : 0),
191
- raw: (_m = (_l = invalid.loc) === null || _l === void 0 ? void 0 : _l.raw) !== null && _m !== void 0 ? _m : value,
186
+ ? invalid.loc?.col + 1
187
+ : (valueNode?.startCol ?? 0) + (invalid.loc?.col ?? 0),
188
+ raw: invalid.loc?.raw ?? value,
192
189
  });
193
190
  break;
194
191
  }
195
192
  case 'non-existent': {
196
- if (allowToAddPropertiesForPretender && ((_o = attr.ownerElement.pretenderContext) === null || _o === void 0 ? void 0 : _o.type) === 'origin') {
193
+ if (allowToAddPropertiesForPretender && attr.ownerElement.pretenderContext?.type === 'origin') {
197
194
  return;
198
195
  }
199
- const spec = (0, ml_core_1.getSpec)(attr.ownerElement, document.specs.specs);
200
- if (spec === null || spec === void 0 ? void 0 : spec.possibleToAddProperties) {
196
+ const spec = getSpec(attr.ownerElement, document.specs.specs);
197
+ if (spec?.possibleToAddProperties) {
201
198
  return;
202
199
  }
203
200
  report({
204
201
  scope: attr,
205
202
  message: invalid.message,
206
- line: attrName === null || attrName === void 0 ? void 0 : attrName.startLine,
207
- col: attrName === null || attrName === void 0 ? void 0 : attrName.startCol,
208
- raw: attrName === null || attrName === void 0 ? void 0 : attrName.raw,
203
+ line: attrName?.startLine,
204
+ col: attrName?.startCol,
205
+ raw: attrName?.raw,
209
206
  });
210
207
  }
211
208
  }
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
1
+ import { createRule } from '@markuplint/ml-core';
4
2
  const controlSelector = ["input:not([type='hidden' i])", 'select', 'textarea'].join(',');
5
- exports.default = (0, ml_core_1.createRule)({
3
+ export default createRule({
6
4
  defaultSeverity: 'warning',
7
5
  async verify({ document, report, t }) {
8
6
  await document.walkOn('Element', el => {
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
1
+ import { createRule } from '@markuplint/ml-core';
4
2
  const selectors = {
5
3
  complementary: ['[role="complementary"]', 'aside'],
6
4
  contentinfo: ['[role="contentinfo"]'],
@@ -11,14 +9,13 @@ const selectors = {
11
9
  region: ['[role="region"]', 'section[aria-labelledby]', 'section[aria-label]', 'section[title]'],
12
10
  };
13
11
  const topLevelRoles = ['banner', 'main', 'complementary', 'contentinfo'];
14
- exports.default = (0, ml_core_1.createRule)({
12
+ export default createRule({
15
13
  defaultSeverity: 'warning',
16
14
  defaultOptions: {
17
15
  ignoreRoles: [],
18
16
  labelEachArea: true,
19
17
  },
20
18
  verify({ document, report, t }) {
21
- var _a;
22
19
  if (document.isFragment) {
23
20
  return;
24
21
  }
@@ -72,7 +69,7 @@ exports.default = (0, ml_core_1.createRule)({
72
69
  if (el.rule.disabled) {
73
70
  continue;
74
71
  }
75
- if ((_a = el.rule.options.ignoreRoles) === null || _a === void 0 ? void 0 : _a.includes(role)) {
72
+ if (el.rule.options.ignoreRoles?.includes(role)) {
76
73
  continue;
77
74
  }
78
75
  if (el.isDescendantByUUIDList(uuidList)) {
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
+ export default createRule({
5
3
  defaultSeverity: 'warning',
6
4
  async verify({ document, report, t }) {
7
5
  await document.walkOn('Attr', attr => {
8
- var _a, _b;
9
- const attrSpec = (0, ml_core_1.getAttrSpecs)(attr.ownerElement, document.specs);
6
+ const attrSpec = getAttrSpecs(attr.ownerElement, document.specs);
10
7
  if (!attrSpec) {
11
8
  return;
12
9
  }
@@ -29,12 +26,12 @@ exports.default = (0, ml_core_1.createRule)({
29
26
  attr.valueNode,
30
27
  attr.endQuote,
31
28
  ];
32
- const extraRaw = extraTokens.reduce((raw, t) => { var _a; return raw + ((_a = t === null || t === void 0 ? void 0 : t.raw) !== null && _a !== void 0 ? _a : ''); }, '');
29
+ const extraRaw = extraTokens.reduce((raw, t) => raw + (t?.raw ?? ''), '');
33
30
  if (extraRaw) {
34
31
  report({
35
32
  scope: attr,
36
- line: (_a = attr.spacesBeforeEqual) === null || _a === void 0 ? void 0 : _a.startLine,
37
- col: (_b = attr.spacesBeforeEqual) === null || _b === void 0 ? void 0 : _b.startCol,
33
+ line: attr.spacesBeforeEqual?.startLine,
34
+ col: attr.spacesBeforeEqual?.startCol,
38
35
  raw: extraRaw,
39
36
  message: t('{0} is {1}', t('the "{0*}" {1}', name, 'attribute'), t('a {0}', 'boolean attribute')) +
40
37
  t('. ') +
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- const helpers_1 = require("../helpers");
5
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule, getAttrSpecs } from '@markuplint/ml-core';
2
+ import { toNormalizedValue } from '../helpers.js';
3
+ export default createRule({
6
4
  defaultSeverity: 'warning',
7
5
  async verify({ document, report, t }) {
8
6
  await document.walkOn('Attr', attr => {
9
- var _a, _b, _c;
10
- const attrSpec = (0, ml_core_1.getAttrSpecs)(attr.ownerElement, document.specs);
7
+ const attrSpec = getAttrSpecs(attr.ownerElement, document.specs);
11
8
  if (!attrSpec) {
12
9
  return;
13
10
  }
@@ -18,14 +15,14 @@ exports.default = (0, ml_core_1.createRule)({
18
15
  if (!spec.defaultValue) {
19
16
  return;
20
17
  }
21
- const normalizedValue = (0, helpers_1.toNormalizedValue)(attr.value, spec);
22
- const defaultValue = (0, helpers_1.toNormalizedValue)(spec.defaultValue, spec);
18
+ const normalizedValue = toNormalizedValue(attr.value, spec);
19
+ const defaultValue = toNormalizedValue(spec.defaultValue, spec);
23
20
  if (defaultValue === normalizedValue) {
24
21
  report({
25
22
  scope: attr,
26
- line: (_a = attr.valueNode) === null || _a === void 0 ? void 0 : _a.startLine,
27
- col: (_b = attr.valueNode) === null || _b === void 0 ? void 0 : _b.startCol,
28
- raw: (_c = attr.valueNode) === null || _c === void 0 ? void 0 : _c.raw,
23
+ line: attr.valueNode?.startLine,
24
+ col: attr.valueNode?.startCol,
25
+ raw: attr.valueNode?.raw,
29
26
  message: t('It is {0}', t('the {0}', 'default value')),
30
27
  });
31
28
  }
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- const ml_spec_1 = require("@markuplint/ml-spec");
5
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule } from '@markuplint/ml-core';
2
+ import { isNothingContentModel, isPalpableElement } from '@markuplint/ml-spec';
3
+ export default createRule({
6
4
  defaultSeverity: 'warning',
7
5
  defaultOptions: {
8
6
  extendsExposableElements: true,
@@ -18,13 +16,13 @@ exports.default = (0, ml_core_1.createRule)({
18
16
  if (el.localName === 'textarea') {
19
17
  return;
20
18
  }
21
- if (!(0, ml_spec_1.isPalpableElement)(el, el.ownerMLDocument.specs, {
19
+ if (!isPalpableElement(el, el.ownerMLDocument.specs, {
22
20
  extendsSvg: false,
23
21
  extendsExposableElements: el.rule.options.extendsExposableElements,
24
22
  })) {
25
23
  return;
26
24
  }
27
- if ((0, ml_spec_1.isNothingContentModel)(el)) {
25
+ if (isNothingContentModel(el)) {
28
26
  return;
29
27
  }
30
28
  if (el.rule.options.ignoreIfAriaBusy && el.getAttribute('aria-busy') === 'true') {
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ml_core_1 = require("@markuplint/ml-core");
4
- exports.default = (0, ml_core_1.createRule)({
1
+ import { createRule } from '@markuplint/ml-core';
2
+ export default createRule({
5
3
  defaultSeverity: 'warning',
6
4
  async verify({ document, report, t }) {
7
5
  if (!document.isFragment) {