@markuplint/rules 3.5.0 → 3.6.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 (84) hide show
  1. package/lib/attr-check.d.ts +1 -1
  2. package/lib/attr-check.js +19 -22
  3. package/lib/attr-duplication/index.d.ts +3 -1
  4. package/lib/attr-duplication/index.js +2 -1
  5. package/lib/attr-value-quotes/index.d.ts +2 -2
  6. package/lib/case-sensitive-attr-name/index.d.ts +1 -1
  7. package/lib/case-sensitive-tag-name/index.d.ts +1 -1
  8. package/lib/character-reference/index.d.ts +1 -1
  9. package/lib/class-naming/index.d.ts +1 -1
  10. package/lib/class-naming/index.js +2 -4
  11. package/lib/create-message.d.ts +12 -2
  12. package/lib/create-message.js +5 -4
  13. package/lib/deprecated-attr/index.d.ts +3 -1
  14. package/lib/deprecated-element/index.d.ts +3 -1
  15. package/lib/deprecated-element/index.js +2 -2
  16. package/lib/disallowed-element/index.d.ts +1 -1
  17. package/lib/doctype/index.d.ts +2 -2
  18. package/lib/end-tag/index.d.ts +1 -1
  19. package/lib/helpers.d.ts +0 -1
  20. package/lib/helpers.js +8 -9
  21. package/lib/id-duplication/index.d.ts +3 -1
  22. package/lib/index.d.ts +172 -67
  23. package/lib/ineffective-attr/index.d.ts +3 -1
  24. package/lib/ineffective-attr/index.js +2 -5
  25. package/lib/invalid-attr/index.d.ts +17 -13
  26. package/lib/invalid-attr/index.js +8 -8
  27. package/lib/label-has-control/index.d.ts +3 -1
  28. package/lib/landmark-roles/index.d.ts +3 -3
  29. package/lib/landmark-roles/index.js +1 -1
  30. package/lib/no-boolean-attr-value/index.d.ts +3 -1
  31. package/lib/no-default-value/index.d.ts +3 -1
  32. package/lib/no-empty-palpable-content/index.d.ts +3 -3
  33. package/lib/no-hard-code-id/index.d.ts +3 -1
  34. package/lib/no-refer-to-non-existent-id/index.d.ts +9 -4
  35. package/lib/no-refer-to-non-existent-id/index.js +4 -14
  36. package/lib/no-use-event-handler-attr/index.d.ts +2 -2
  37. package/lib/permitted-contents/choice.d.ts +7 -1
  38. package/lib/permitted-contents/complex-branch.d.ts +7 -1
  39. package/lib/permitted-contents/content-model.js +1 -1
  40. package/lib/permitted-contents/count-pattern.d.ts +17 -2
  41. package/lib/permitted-contents/count-pattern.js +1 -1
  42. package/lib/permitted-contents/debug.browser.d.ts +15 -15
  43. package/lib/permitted-contents/debug.d.ts +1 -1
  44. package/lib/permitted-contents/index.d.ts +1 -1
  45. package/lib/permitted-contents/index.js +5 -10
  46. package/lib/permitted-contents/matches-selector.d.ts +6 -1
  47. package/lib/permitted-contents/matches-selector.js +1 -1
  48. package/lib/permitted-contents/order.d.ts +7 -1
  49. package/lib/permitted-contents/order.js +4 -4
  50. package/lib/permitted-contents/recursive-branch.d.ts +7 -1
  51. package/lib/permitted-contents/represent-transparent-nodes.d.ts +7 -3
  52. package/lib/permitted-contents/represent-transparent-nodes.js +1 -1
  53. package/lib/permitted-contents/start.d.ts +6 -1
  54. package/lib/permitted-contents/start.js +1 -1
  55. package/lib/permitted-contents/types.d.ts +29 -29
  56. package/lib/permitted-contents/utils.d.ts +90 -41
  57. package/lib/permitted-contents/utils.js +3 -3
  58. package/lib/placeholder-label-option/index.d.ts +1 -1
  59. package/lib/placeholder-label-option/index.js +5 -4
  60. package/lib/require-accessible-name/index.d.ts +2 -2
  61. package/lib/require-datetime/index.d.ts +2 -2
  62. package/lib/require-datetime/types.d.ts +2 -2
  63. package/lib/require-datetime/utils.js +3 -2
  64. package/lib/required-attr/index.d.ts +3 -3
  65. package/lib/required-attr/index.js +4 -4
  66. package/lib/required-element/index.d.ts +2 -2
  67. package/lib/required-h1/index.d.ts +3 -3
  68. package/lib/use-list/index.d.ts +2 -2
  69. package/lib/use-list/index.js +4 -3
  70. package/lib/wai-aria/checkings/default-value.d.ts +7 -3
  71. package/lib/wai-aria/checkings/deprecated-props.d.ts +8 -4
  72. package/lib/wai-aria/checkings/disallowed-prop.d.ts +8 -4
  73. package/lib/wai-aria/checkings/disallowed-prop.js +1 -1
  74. package/lib/wai-aria/checkings/implicit-props.d.ts +8 -4
  75. package/lib/wai-aria/checkings/implicit-props.js +3 -2
  76. package/lib/wai-aria/checkings/no-global-prop.d.ts +7 -3
  77. package/lib/wai-aria/checkings/required-owned-elements.d.ts +7 -3
  78. package/lib/wai-aria/checkings/required-owned-elements.js +1 -1
  79. package/lib/wai-aria/checkings/required-prop.d.ts +12 -6
  80. package/lib/wai-aria/checkings/value.d.ts +15 -6
  81. package/lib/wai-aria/checkings/value.js +3 -1
  82. package/lib/wai-aria/index.d.ts +1 -1
  83. package/lib/wai-aria/types.d.ts +10 -10
  84. package/package.json +8 -8
@@ -1,51 +1,100 @@
1
1
  import type { ChildNode, Element, Hints, MissingNodeReason, RepeatSign, Specs } from './types';
2
- import type { PermittedContentPattern, PermittedContentChoice, PermittedContentOneOrMore, PermittedContentOptional, PermittedContentRequire, PermittedContentTransparent, PermittedContentZeroOrMore, Model } from '@markuplint/ml-spec';
2
+ import type {
3
+ PermittedContentPattern,
4
+ PermittedContentChoice,
5
+ PermittedContentOneOrMore,
6
+ PermittedContentOptional,
7
+ PermittedContentRequire,
8
+ PermittedContentTransparent,
9
+ PermittedContentZeroOrMore,
10
+ Model,
11
+ } from '@markuplint/ml-spec';
3
12
  import type { ReadonlyDeep } from 'type-fest';
4
13
  export declare function getChildNodesWithoutWhitespaces(el: Element): ChildNode[];
5
14
  export declare function isModel(model: ReadonlyDeep<Model | PermittedContentPattern[]>): model is ReadonlyDeep<Model>;
6
- export declare function matches(selector: string, node: ChildNode, specs: Specs): {
7
- matched: boolean;
8
- not?: undefined;
9
- } | {
10
- matched: boolean;
11
- not: ChildNode | undefined;
15
+ export declare function matches(
16
+ selector: string,
17
+ node: ChildNode,
18
+ specs: Specs,
19
+ ):
20
+ | {
21
+ matched: boolean;
22
+ not?: undefined;
23
+ }
24
+ | {
25
+ matched: boolean;
26
+ not: ChildNode | undefined;
27
+ };
28
+ export declare function isRequire(
29
+ content: ReadonlyDeep<PermittedContentPattern>,
30
+ ): content is ReadonlyDeep<PermittedContentRequire>;
31
+ export declare function isOptional(
32
+ content: ReadonlyDeep<PermittedContentPattern>,
33
+ ): content is ReadonlyDeep<PermittedContentOptional>;
34
+ export declare function isOneOrMore(
35
+ content: ReadonlyDeep<PermittedContentPattern>,
36
+ ): content is ReadonlyDeep<PermittedContentOneOrMore>;
37
+ export declare function isZeroOrMore(
38
+ content: ReadonlyDeep<PermittedContentPattern>,
39
+ ): content is ReadonlyDeep<PermittedContentZeroOrMore>;
40
+ export declare function isChoice(
41
+ content: ReadonlyDeep<PermittedContentPattern>,
42
+ ): content is ReadonlyDeep<PermittedContentChoice>;
43
+ export declare function isTransparent(
44
+ content: ReadonlyDeep<PermittedContentPattern>,
45
+ ): content is ReadonlyDeep<PermittedContentTransparent>;
46
+ export declare function normalizeModel(
47
+ pattern:
48
+ | ReadonlyDeep<PermittedContentRequire>
49
+ | ReadonlyDeep<PermittedContentOptional>
50
+ | ReadonlyDeep<PermittedContentOneOrMore>
51
+ | ReadonlyDeep<PermittedContentZeroOrMore>,
52
+ ): {
53
+ model: ReadonlyDeep<PermittedContentPattern[] | Model>;
54
+ min: number;
55
+ max: number;
56
+ repeat: RepeatSign;
57
+ missingType: MissingNodeReason | undefined;
12
58
  };
13
- export declare function isRequire(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentRequire>;
14
- export declare function isOptional(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentOptional>;
15
- export declare function isOneOrMore(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentOneOrMore>;
16
- export declare function isZeroOrMore(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentZeroOrMore>;
17
- export declare function isChoice(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentChoice>;
18
- export declare function isTransparent(content: ReadonlyDeep<PermittedContentPattern>): content is ReadonlyDeep<PermittedContentTransparent>;
19
- export declare function normalizeModel(pattern: ReadonlyDeep<PermittedContentRequire> | ReadonlyDeep<PermittedContentOptional> | ReadonlyDeep<PermittedContentOneOrMore> | ReadonlyDeep<PermittedContentZeroOrMore>): {
20
- model: ReadonlyDeep<PermittedContentPattern[] | Model>;
21
- min: number;
22
- max: number;
23
- repeat: RepeatSign;
24
- missingType: MissingNodeReason | undefined;
25
- };
26
- export declare function mergeHints(a: Readonly<Hints>, b: Readonly<Hints>): Partial<{
27
- missing: Partial<{
28
- barelyMatchedElements?: number | undefined;
29
- need?: string | undefined;
30
- }> | undefined;
31
- max?: number | undefined;
32
- not?: import("packages/@markuplint/ml-core/lib").DocumentType<import("./types").TagRule[], import("./types").Options> | import("packages/@markuplint/ml-core/lib/ml-dom/node/character-data").MLCharacterData<import("./types").TagRule[], import("./types").Options, import("packages/@markuplint/ml-ast/lib").MLASTAbstractNode> | import("packages/@markuplint/ml-core/lib").Element<import("./types").TagRule[], import("./types").Options> | import("packages/@markuplint/ml-core/lib").Block<import("./types").TagRule[], import("./types").Options> | undefined;
33
- transparent?: Element | undefined;
59
+ export declare function mergeHints(
60
+ a: Readonly<Hints>,
61
+ b: Readonly<Hints>,
62
+ ): Partial<{
63
+ missing:
64
+ | Partial<{
65
+ barelyMatchedElements?: number | undefined;
66
+ need?: string | undefined;
67
+ }>
68
+ | undefined;
69
+ max?: number | undefined;
70
+ not?:
71
+ | import('packages/@markuplint/ml-core/lib').DocumentType<
72
+ import('./types').TagRule[],
73
+ import('./types').Options
74
+ >
75
+ | import('packages/@markuplint/ml-core/lib/ml-dom/node/character-data').MLCharacterData<
76
+ import('./types').TagRule[],
77
+ import('./types').Options,
78
+ import('packages/@markuplint/ml-ast/lib').MLASTAbstractNode
79
+ >
80
+ | import('packages/@markuplint/ml-core/lib').Element<import('./types').TagRule[], import('./types').Options>
81
+ | import('packages/@markuplint/ml-core/lib').Block<import('./types').TagRule[], import('./types').Options>
82
+ | undefined;
83
+ transparent?: Element | undefined;
34
84
  }>;
35
85
  export declare function cleanObject<T extends Object>(object: T): Partial<T>;
36
86
  export declare class Collection {
37
- #private;
38
- constructor(origin: readonly ChildNode[]);
39
- get matched(): ChildNode[];
40
- get matchedCount(): number;
41
- get nodes(): ChildNode[];
42
- get unmatched(): ChildNode[];
43
- addMatched(nodes: ChildNode[]): boolean;
44
- back(): void;
45
- lock(): void;
46
- max(max: number): void;
47
- toString(highlightExtraNodes?: boolean): string;
48
- }
49
- export declare class UnsupportedError extends Error {
87
+ #private;
88
+ constructor(origin: readonly ChildNode[]);
89
+ get matched(): ChildNode[];
90
+ get matchedCount(): number;
91
+ get nodes(): ChildNode[];
92
+ get unmatched(): ChildNode[];
93
+ addMatched(nodes: ChildNode[]): boolean;
94
+ back(): void;
95
+ lock(): void;
96
+ max(max: number): void;
97
+ toString(highlightExtraNodes?: boolean): string;
50
98
  }
99
+ export declare class UnsupportedError extends Error {}
51
100
  export declare function modelLog(model: ReadonlyDeep<Model | PermittedContentPattern[]>, repeat: RepeatSign): string;
@@ -43,7 +43,7 @@ function matches(selector,
43
43
  node, specs) {
44
44
  const selectorResult = (0, selector_1.createSelector)(selector, specs).search(node);
45
45
  const matched = selectorResult.filter((r) => r.matched);
46
- if (matched.length) {
46
+ if (matched.length > 0) {
47
47
  return {
48
48
  matched: true,
49
49
  };
@@ -64,9 +64,9 @@ function descendants(
64
64
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
65
65
  selectorResult) {
66
66
  let nodes = selectorResult.nodes.slice();
67
- while (selectorResult.has.length) {
67
+ while (selectorResult.has.length > 0) {
68
68
  for (const dep of selectorResult.has) {
69
- if (!dep.has.length) {
69
+ if (dep.has.length === 0) {
70
70
  nodes = dep.nodes;
71
71
  continue;
72
72
  }
@@ -1,2 +1,2 @@
1
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
1
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, undefined>>;
2
2
  export default _default;
@@ -29,6 +29,7 @@ exports.default = (0, ml_core_1.createRule)({
29
29
  function needPlaceholderLabelOption(
30
30
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
31
31
  select) {
32
+ var _a;
32
33
  const hasRequired = select.hasAttribute('required');
33
34
  if (!hasRequired) {
34
35
  return false;
@@ -37,7 +38,7 @@ select) {
37
38
  if (hasMultiple) {
38
39
  return false;
39
40
  }
40
- const size = select.getAttribute('size') || '1';
41
+ const size = (_a = select.getAttribute('size')) !== null && _a !== void 0 ? _a : '1';
41
42
  if (size !== '1') {
42
43
  return false;
43
44
  }
@@ -58,7 +59,7 @@ select) {
58
59
  function hasPlaceholderLabelOption(
59
60
  // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
60
61
  select) {
61
- var _a;
62
+ var _a, _b;
62
63
  // > has a required attribute specified
63
64
  if (!select.hasAttribute('required')) {
64
65
  return false;
@@ -68,7 +69,7 @@ select) {
68
69
  return false;
69
70
  }
70
71
  // > has a display size of 1
71
- const size = select.getAttribute('size') || '1';
72
+ const size = (_a = select.getAttribute('size')) !== null && _a !== void 0 ? _a : '1';
72
73
  if (size !== '1') {
73
74
  return false;
74
75
  }
@@ -79,7 +80,7 @@ select) {
79
80
  return true;
80
81
  }
81
82
  // > that option element's parent node is the select element (and not an optgroup element)
82
- if (((_a = firstOption.parentElement) === null || _a === void 0 ? void 0 : _a.localName) === 'optgroup') {
83
+ if (((_b = firstOption.parentElement) === null || _b === void 0 ? void 0 : _b.localName) === 'optgroup') {
83
84
  return false;
84
85
  }
85
86
  const value = firstOption.getAttribute('value');
@@ -1,6 +1,6 @@
1
1
  import type { ARIAVersion } from '@markuplint/ml-spec';
2
2
  type Option = {
3
- ariaVersion: ARIAVersion;
3
+ ariaVersion: ARIAVersion;
4
4
  };
5
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Option>>;
5
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, Option>>;
6
6
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import type { Lang } from './types';
2
2
  type Options = {
3
- langs?: Lang[];
3
+ langs?: Lang[];
4
4
  };
5
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
5
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, Options>>;
6
6
  export default _default;
@@ -1,8 +1,8 @@
1
1
  export type DateTimeKey = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'ms';
2
2
  export type DateTimeData = Partial<Record<DateTimeKey, number>>;
3
3
  export type DateTime = {
4
- datetime: DateTimeData;
5
- zone?: number;
4
+ datetime: DateTimeData;
5
+ zone?: number;
6
6
  };
7
7
  /**
8
8
  * @see https://github.com/wanasit/chrono#locales
@@ -13,6 +13,7 @@ const defaultLangs = ['en', 'ja', 'fr', 'nl', 'ru', 'de', 'pt', 'zh'];
13
13
  * @returns
14
14
  */
15
15
  function parseADatetime(content, langs, base) {
16
+ var _a;
16
17
  const date = parseTryMultipleLangs(content, langs, base);
17
18
  if (!date) {
18
19
  return null;
@@ -31,7 +32,7 @@ function parseADatetime(content, langs, base) {
31
32
  data.hour = date.get('hour');
32
33
  }
33
34
  if (date.isCertain('hour')) {
34
- data.minute = date.get('minute') || 0;
35
+ data.minute = (_a = date.get('minute')) !== null && _a !== void 0 ? _a : 0;
35
36
  }
36
37
  if (date.isCertain('second')) {
37
38
  data.second = date.get('second');
@@ -57,7 +58,7 @@ function getCandidateDatetimeString(content, langs = defaultLangs) {
57
58
  if (!datetimeStr) {
58
59
  return null;
59
60
  }
60
- if (date.zone) {
61
+ if (date.zone != null) {
61
62
  const plusMinus = date.zone < 0 ? '-' : '+';
62
63
  const hour = Math.floor(Math.abs(date.zone) / 60);
63
64
  const minute = Math.abs(date.zone) % 60;
@@ -1,7 +1,7 @@
1
1
  type RequiredAttributes = string | (string | Attr)[];
2
2
  type Attr = {
3
- name: string;
4
- value: string | string[];
3
+ name: string;
4
+ value: string | string[];
5
5
  };
6
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<RequiredAttributes, undefined>>;
6
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<RequiredAttributes, undefined>>;
7
7
  export default _default;
@@ -15,7 +15,7 @@ exports.default = (0, ml_core_1.createRule)({
15
15
  const attributeSpecs = {};
16
16
  if (attrSpec && el.elementType === 'html') {
17
17
  for (const spec of attrSpec) {
18
- if (spec.required || spec.requiredEither || spec.condition) {
18
+ if (spec.required != null || spec.requiredEither || spec.condition != null) {
19
19
  attributeSpecs[spec.name] = {
20
20
  ...spec,
21
21
  values: [],
@@ -54,7 +54,7 @@ exports.default = (0, ml_core_1.createRule)({
54
54
  else if (spec.required === true) {
55
55
  invalid = (0, helpers_1.attrMatches)(el, spec.condition) && didntHave;
56
56
  }
57
- else if (spec.required) {
57
+ else if (spec.required != null && spec.required !== false) {
58
58
  const selector = typeof spec.required === 'string' ? spec.required : spec.required.join(',');
59
59
  invalid = el.matches(selector) && didntHave;
60
60
  }
@@ -66,14 +66,14 @@ exports.default = (0, ml_core_1.createRule)({
66
66
  });
67
67
  }
68
68
  const value = el.getAttribute(spec.name);
69
- if (spec.values.length && value) {
69
+ if (spec.values.length > 0 && value) {
70
70
  const matched = spec.values.some(pattern => (0, helpers_1.match)(value, pattern));
71
71
  if (!matched) {
72
72
  const expects = spec.values.length === 1 ? t(spec.values) : t('either {0}', t(spec.values));
73
73
  const message = t('{0} expects {1}', t('the "{0*}" {1}', spec.name, 'attribute'), expects);
74
74
  const attrToken = el.getAttributeToken(spec.name);
75
75
  const valueToken = (_a = attrToken[0]) === null || _a === void 0 ? void 0 : _a.valueNode;
76
- const token = valueToken || attrToken[0];
76
+ const token = valueToken !== null && valueToken !== void 0 ? valueToken : attrToken[0];
77
77
  if (token) {
78
78
  report({
79
79
  scope: {
@@ -1,5 +1,5 @@
1
1
  type Options = {
2
- ignoreHasMutableContents: boolean;
2
+ ignoreHasMutableContents: boolean;
3
3
  };
4
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<string[], Options>>;
4
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<string[], Options>>;
5
5
  export default _default;
@@ -1,6 +1,6 @@
1
1
  export interface Options {
2
- 'expected-once': boolean;
3
- 'in-document-fragment': boolean;
2
+ 'expected-once': boolean;
3
+ 'in-document-fragment': boolean;
4
4
  }
5
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
5
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, Options>>;
6
6
  export default _default;
@@ -1,6 +1,6 @@
1
1
  type Bullets = readonly string[];
2
2
  type Options = {
3
- spaceNeededBullets?: string[];
3
+ spaceNeededBullets?: string[];
4
4
  };
5
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<Bullets, Options>>;
5
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<Bullets, Options>>;
6
6
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ml_core_1 = require("@markuplint/ml-core");
4
- const helpers_1 = require("../helpers");
4
+ const shared_1 = require("@markuplint/shared");
5
5
  exports.default = (0, ml_core_1.createRule)({
6
6
  defaultValue: [
7
7
  /**
@@ -57,7 +57,8 @@ exports.default = (0, ml_core_1.createRule)({
57
57
  defaultSeverity: 'warning',
58
58
  async verify({ document, report, t }) {
59
59
  await document.walkOn('Text', textNode => {
60
- const text = (0, helpers_1.decodeCharRef)(textNode.raw.trim());
60
+ var _a;
61
+ const text = (0, shared_1.decodeEntities)(textNode.raw.trim());
61
62
  if (!text) {
62
63
  // empty
63
64
  return;
@@ -67,7 +68,7 @@ exports.default = (0, ml_core_1.createRule)({
67
68
  return;
68
69
  }
69
70
  const bullets = textNode.rule.value;
70
- const spaceNeededBullets = textNode.rule.options.spaceNeededBullets || [];
71
+ const spaceNeededBullets = (_a = textNode.rule.options.spaceNeededBullets) !== null && _a !== void 0 ? _a : [];
71
72
  if (isMayListItem(text, bullets, spaceNeededBullets)) {
72
73
  report({
73
74
  scope: textNode,
@@ -1,6 +1,10 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty } from '@markuplint/ml-spec';
4
- export declare const checkingDefaultValue: AttrChecker<boolean, Options, {
5
- propSpecs: readonly ARIAProperty[];
6
- }>;
4
+ export declare const checkingDefaultValue: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ propSpecs: readonly ARIAProperty[];
9
+ }
10
+ >;
@@ -1,7 +1,11 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty, ARIARole } from '@markuplint/ml-spec';
4
- export declare const checkingDeprecatedProps: AttrChecker<boolean, Options, {
5
- role: ARIARole | null;
6
- propSpecs: readonly ARIAProperty[];
7
- }>;
4
+ export declare const checkingDeprecatedProps: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ role: ARIARole | null;
9
+ propSpecs: readonly ARIAProperty[];
10
+ }
11
+ >;
@@ -1,7 +1,11 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty, ARIARole } from '@markuplint/ml-spec';
4
- export declare const checkingDisallowedProp: AttrChecker<boolean, Options, {
5
- role: ARIARole | null;
6
- propSpecs: readonly ARIAProperty[];
7
- }>;
4
+ export declare const checkingDisallowedProp: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ role: ARIARole | null;
9
+ propSpecs: readonly ARIAProperty[];
10
+ }
11
+ >;
@@ -13,7 +13,7 @@ const checkingDisallowedProp = ({ attr, role, propSpecs }) => t => {
13
13
  const statesAndProp = role.ownedProperties.find(p => p.name === attr.name);
14
14
  const propSpec = propSpecs.find(p => p.name === attr.name);
15
15
  const elAriaSpec = (0, ml_spec_1.getARIA)(attr.ownerMLDocument.specs, attr.ownerElement.localName, attr.ownerElement.namespaceURI, attr.rule.options.version, attr.ownerElement.matches.bind(attr.ownerElement));
16
- if ((elAriaSpec === null || elAriaSpec === void 0 ? void 0 : elAriaSpec.properties) && ((_a = elAriaSpec === null || elAriaSpec === void 0 ? void 0 : elAriaSpec.properties) === null || _a === void 0 ? void 0 : _a.without)) {
16
+ if ((elAriaSpec === null || elAriaSpec === void 0 ? void 0 : elAriaSpec.properties) !== false && ((_a = elAriaSpec === null || elAriaSpec === void 0 ? void 0 : elAriaSpec.properties) === null || _a === void 0 ? void 0 : _a.without)) {
17
17
  for (const ignore of elAriaSpec.properties.without) {
18
18
  if (ignore.name === attr.name) {
19
19
  return {
@@ -1,7 +1,11 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty, Attribute } from '@markuplint/ml-spec';
4
- export declare const checkingImplicitProps: AttrChecker<boolean, Options, {
5
- propSpecs: readonly ARIAProperty[];
6
- attrSpecs: readonly Attribute[] | null;
7
- }>;
4
+ export declare const checkingImplicitProps: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ propSpecs: readonly ARIAProperty[];
9
+ attrSpecs: readonly Attribute[] | null;
10
+ }
11
+ >;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkingImplicitProps = void 0;
4
4
  const helpers_1 = require("../../helpers");
5
5
  const checkingImplicitProps = ({ attr, propSpecs, attrSpecs }) => t => {
6
+ var _a;
6
7
  if (!attrSpecs) {
7
8
  return;
8
9
  }
@@ -15,8 +16,8 @@ const checkingImplicitProps = ({ attr, propSpecs, attrSpecs }) => t => {
15
16
  }
16
17
  for (const equivalentHtmlAttr of propSpec.equivalentHtmlAttrs) {
17
18
  const htmlAttrSpec = attrSpecs.find(a => a.name === equivalentHtmlAttr.htmlAttrName);
18
- const isValid = (0, helpers_1.isValidAttr)(t, equivalentHtmlAttr.htmlAttrName, equivalentHtmlAttr.value || '', false, attr.ownerElement, attrSpecs);
19
- if (isValid && isValid.invalidType === 'non-existent') {
19
+ const isValid = (0, helpers_1.isValidAttr)(t, equivalentHtmlAttr.htmlAttrName, (_a = equivalentHtmlAttr.value) !== null && _a !== void 0 ? _a : '', false, attr.ownerElement, attrSpecs);
20
+ if (isValid !== false && isValid.invalidType === 'non-existent') {
20
21
  continue;
21
22
  }
22
23
  const value = attr.value.trim().toLowerCase();
@@ -1,6 +1,10 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty } from '@markuplint/ml-spec';
4
- export declare const checkingNoGlobalProp: AttrChecker<boolean, Options, {
5
- propSpecs: readonly ARIAProperty[];
6
- }>;
4
+ export declare const checkingNoGlobalProp: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ propSpecs: readonly ARIAProperty[];
9
+ }
10
+ >;
@@ -6,6 +6,10 @@ import type { ARIARole } from '@markuplint/ml-spec';
6
6
  *
7
7
  * @see https://w3c.github.io/aria/#mustContain
8
8
  */
9
- export declare const checkingRequiredOwnedElements: ElementChecker<boolean, Options, {
10
- role?: ARIARole | null;
11
- }>;
9
+ export declare const checkingRequiredOwnedElements: ElementChecker<
10
+ boolean,
11
+ Options,
12
+ {
13
+ role?: ARIARole | null;
14
+ }
15
+ >;
@@ -11,7 +11,7 @@ const checkingRequiredOwnedElements = ({ el, role }) => t => {
11
11
  if (!role) {
12
12
  return;
13
13
  }
14
- if (!role.requiredOwnedElements.length) {
14
+ if (role.requiredOwnedElements.length === 0) {
15
15
  return;
16
16
  }
17
17
  /**
@@ -1,9 +1,15 @@
1
1
  import type { Options } from '../types';
2
2
  import type { ElementChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty, ARIARole } from '@markuplint/ml-spec';
4
- export declare const checkingRequiredProp: ElementChecker<boolean, Options, {
5
- role?: (ARIARole & {
6
- isImplicit?: boolean;
7
- }) | null;
8
- propSpecs: readonly ARIAProperty[];
9
- }>;
4
+ export declare const checkingRequiredProp: ElementChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ role?:
9
+ | (ARIARole & {
10
+ isImplicit?: boolean;
11
+ })
12
+ | null;
13
+ propSpecs: readonly ARIAProperty[];
14
+ }
15
+ >;
@@ -1,13 +1,22 @@
1
1
  import type { Options } from '../types';
2
2
  import type { AttrChecker } from '@markuplint/ml-core';
3
3
  import type { ARIAProperty, ARIARole } from '@markuplint/ml-spec';
4
- export declare const checkingValue: AttrChecker<boolean, Options, {
5
- role?: ARIARole | null;
6
- propSpecs: readonly ARIAProperty[];
7
- booleanish?: boolean;
8
- }>;
4
+ export declare const checkingValue: AttrChecker<
5
+ boolean,
6
+ Options,
7
+ {
8
+ role?: ARIARole | null;
9
+ propSpecs: readonly ARIAProperty[];
10
+ booleanish?: boolean;
11
+ }
12
+ >;
9
13
  /**
10
14
  *
11
15
  * @see https://www.w3.org/TR/wai-aria-1.2/#propcharacteristic_value
12
16
  */
13
- export declare function checkAriaValue(type: string, value: string, tokenEnum: readonly string[], booleanish?: boolean): boolean;
17
+ export declare function checkAriaValue(
18
+ type: string,
19
+ value: string,
20
+ tokenEnum: readonly string[],
21
+ booleanish?: boolean,
22
+ ): boolean;
@@ -14,7 +14,9 @@ const checkingValue = ({ attr, role, propSpecs, booleanish }) => t => {
14
14
  return {
15
15
  scope: attr,
16
16
  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'}`)) +
17
- ('enum' in result && result.enum.length ? t('. ') + t('Allowed values are: {0}', t(result.enum)) : ''),
17
+ ('enum' in result && result.enum.length > 0
18
+ ? t('. ') + t('Allowed values are: {0}', t(result.enum))
19
+ : ''),
18
20
  };
19
21
  };
20
22
  exports.checkingValue = checkingValue;
@@ -1,3 +1,3 @@
1
1
  import type { Options } from './types';
2
- declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, Options>>;
2
+ declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, Options>>;
3
3
  export default _default;
@@ -1,13 +1,13 @@
1
1
  import type { ARIAVersion } from '@markuplint/ml-spec';
2
2
  export 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;
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
13
  };