@markuplint/rules 3.0.0-alpha.4 → 3.0.0-alpha.6

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 (66) hide show
  1. package/README.md +1 -1
  2. package/lib/attr-check.d.ts +21 -10
  3. package/lib/attr-duplication/index.d.ts +1 -1
  4. package/lib/attr-value-quotes/index.d.ts +5 -5
  5. package/lib/case-sensitive-attr-name/index.d.ts +2 -2
  6. package/lib/case-sensitive-tag-name/index.d.ts +2 -2
  7. package/lib/character-reference/index.d.ts +1 -1
  8. package/lib/class-naming/index.d.ts +2 -2
  9. package/lib/create-message.d.ts +12 -2
  10. package/lib/debug.d.ts +1 -1
  11. package/lib/deprecated-attr/index.d.ts +1 -1
  12. package/lib/deprecated-element/index.d.ts +1 -1
  13. package/lib/disallowed-element/index.d.ts +1 -1
  14. package/lib/doctype/index.d.ts +3 -3
  15. package/lib/doctype/index.js +1 -1
  16. package/lib/end-tag/index.d.ts +1 -1
  17. package/lib/end-tag/index.js +2 -17
  18. package/lib/helpers.d.ts +36 -18
  19. package/lib/id-duplication/index.d.ts +1 -1
  20. package/lib/index.d.ts +2 -60
  21. package/lib/index.js +2 -0
  22. package/lib/ineffective-attr/index.d.ts +1 -1
  23. package/lib/invalid-attr/index.d.ts +18 -14
  24. package/lib/label-has-control/index.d.ts +1 -1
  25. package/lib/landmark-roles/index.d.ts +6 -6
  26. package/lib/no-boolean-attr-value/index.d.ts +1 -1
  27. package/lib/no-default-value/index.d.ts +1 -1
  28. package/lib/no-empty-palpable-content/index.d.ts +6 -0
  29. package/lib/no-empty-palpable-content/index.js +34 -0
  30. package/lib/no-hard-code-id/index.d.ts +1 -1
  31. package/lib/no-refer-to-non-existent-id/index.d.ts +6 -3
  32. package/lib/no-use-event-handler-attr/index.d.ts +3 -3
  33. package/lib/permitted-contents/choice.d.ts +7 -1
  34. package/lib/permitted-contents/complex-branch.d.ts +7 -1
  35. package/lib/permitted-contents/count-pattern.d.ts +17 -2
  36. package/lib/permitted-contents/debug.d.ts +1 -1
  37. package/lib/permitted-contents/index.d.ts +1 -1
  38. package/lib/permitted-contents/matches-selector.d.ts +8 -2
  39. package/lib/permitted-contents/order.d.ts +7 -1
  40. package/lib/permitted-contents/recursive-branch.d.ts +7 -1
  41. package/lib/permitted-contents/represent-transparent-nodes.d.ts +8 -4
  42. package/lib/permitted-contents/start.d.ts +6 -1
  43. package/lib/permitted-contents/types.d.ts +42 -38
  44. package/lib/permitted-contents/utils.d.ts +35 -21
  45. package/lib/require-accessible-name/index.d.ts +3 -3
  46. package/lib/require-accessible-name/index.js +4 -0
  47. package/lib/required-attr/index.d.ts +5 -5
  48. package/lib/required-element/index.d.ts +3 -3
  49. package/lib/required-h1/index.d.ts +3 -3
  50. package/lib/use-list/index.d.ts +4 -4
  51. package/lib/wai-aria/checkings/default-value.d.ts +7 -3
  52. package/lib/wai-aria/checkings/deprecated-props.d.ts +8 -4
  53. package/lib/wai-aria/checkings/disallowed-prop.d.ts +8 -4
  54. package/lib/wai-aria/checkings/implicit-props.d.ts +8 -4
  55. package/lib/wai-aria/checkings/no-global-prop.d.ts +7 -3
  56. package/lib/wai-aria/checkings/{non-existant-role.d.ts → non-existent-role.d.ts} +1 -1
  57. package/lib/wai-aria/checkings/{non-existant-role.js → non-existent-role.js} +3 -3
  58. package/lib/wai-aria/checkings/required-owned-elements.d.ts +7 -3
  59. package/lib/wai-aria/checkings/required-prop.d.ts +12 -6
  60. package/lib/wai-aria/checkings/value.d.ts +9 -5
  61. package/lib/wai-aria/index.d.ts +1 -1
  62. package/lib/wai-aria/index.js +2 -2
  63. package/lib/wai-aria/types.d.ts +11 -11
  64. package/package.json +6 -6
  65. package/schema.json +3 -0
  66. package/tsconfig.tsbuildinfo +1 -1
package/README.md CHANGED
@@ -9,7 +9,6 @@
9
9
  ### Conformance checking
10
10
 
11
11
  - [`attr-duplication`](./src/attr-duplication)
12
- - [`character-reference`](./src/character-reference)
13
12
  - [`deprecated-attr`](./src/deprecated-attr)
14
13
  - [`deprecated-element`](./src/deprecated-element)
15
14
  - [`disallowed-element`](./src/disallowed-element)
@@ -43,6 +42,7 @@
43
42
  - [`attr-value-quotes`](./src/attr-value-quotes)
44
43
  - [`case-sensitive-attr-name`](./src/case-sensitive-attr-name)
45
44
  - [`case-sensitive-tag-name`](./src/case-sensitive-tag-name)
45
+ - [`character-reference`](./src/character-reference)
46
46
  - [`end-tag`](./src/end-tag)
47
47
  - [`no-boolean-attr-value`](./src/no-boolean-attr-value)
48
48
  - [`no-default-value`](./src/no-default-value)
@@ -1,14 +1,14 @@
1
1
  import type { Translator } from '@markuplint/i18n';
2
2
  import type { Attribute as AttrSpec, AttributeType } from '@markuplint/ml-spec';
3
- declare type Invalid = {
4
- invalidType: 'non-existent' | 'invalid-value';
5
- message: string;
6
- loc?: Loc;
3
+ type Invalid = {
4
+ invalidType: 'non-existent' | 'invalid-value';
5
+ message: string;
6
+ loc?: Loc;
7
7
  };
8
- declare type Loc = {
9
- raw: string;
10
- line: number;
11
- col: number;
8
+ type Loc = {
9
+ raw: string;
10
+ line: number;
11
+ col: number;
12
12
  };
13
13
  /**
14
14
  * Use in rules `invalid-attr` and `wai-aria`
@@ -18,6 +18,17 @@ declare type Loc = {
18
18
  * @param isCustomRule
19
19
  * @param spec
20
20
  */
21
- export declare function attrCheck(t: Translator, name: string, value: string, isCustomRule: boolean, spec?: AttrSpec): Invalid | false;
22
- export declare function valueCheck(t: Translator, name: string, value: string, type: AttributeType): string | [string, Loc] | false;
21
+ export declare function attrCheck(
22
+ t: Translator,
23
+ name: string,
24
+ value: string,
25
+ isCustomRule: boolean,
26
+ spec?: AttrSpec,
27
+ ): Invalid | false;
28
+ export declare function valueCheck(
29
+ t: Translator,
30
+ name: string,
31
+ value: string,
32
+ type: AttributeType,
33
+ ): string | [string, Loc] | false;
23
34
  export {};
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,7 +1,7 @@
1
- export declare type Type = 'double' | 'single';
2
- export declare type Quote = '"' | "'";
3
- export declare type QuoteMap = {
4
- [P in Type]: Quote;
1
+ export type Type = 'double' | 'single';
2
+ export type Quote = '"' | "'";
3
+ export type QuoteMap = {
4
+ [P in Type]: Quote;
5
5
  };
6
- declare const _default: import("@markuplint/ml-core").RuleSeed<Type, null>;
6
+ declare const _default: import('@markuplint/ml-core').RuleSeed<Type, null>;
7
7
  export default _default;
@@ -1,3 +1,3 @@
1
- export declare type Value = 'lower' | 'upper';
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<Value, null>;
1
+ export type Value = 'lower' | 'upper';
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<Value, null>;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- export declare type Value = 'lower' | 'upper';
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<Value, null>;
1
+ export type Value = 'lower' | 'upper';
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<Value, null>;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { RuleConfigValue } from '@markuplint/ml-config';
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<RuleConfigValue, null>;
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<RuleConfigValue, null>;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- export declare type Value = string | string[] | null;
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<Value, null>;
1
+ export type Value = string | string[] | null;
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<Value, null>;
3
3
  export default _default;
@@ -1,5 +1,15 @@
1
1
  import type { Translator } from '@markuplint/i18n';
2
2
  import type { AttributeType } from '@markuplint/ml-spec';
3
3
  import type { UnmatchedResult } from '@markuplint/types';
4
- export declare function createMessageValueExpected(t: Translator, baseTarget: string, type: AttributeType, matches: UnmatchedResult): string;
5
- export declare function __createMessageValueExpected(t: Translator, baseTarget: string, expected: string | null, matches: Pick<UnmatchedResult, 'partName' | 'reason' | 'raw' | 'candidate' | 'ref' | 'extra'>): string;
4
+ export declare function createMessageValueExpected(
5
+ t: Translator,
6
+ baseTarget: string,
7
+ type: AttributeType,
8
+ matches: UnmatchedResult,
9
+ ): string;
10
+ export declare function __createMessageValueExpected(
11
+ t: Translator,
12
+ baseTarget: string,
13
+ expected: string | null,
14
+ matches: Pick<UnmatchedResult, 'partName' | 'reason' | 'raw' | 'candidate' | 'ref' | 'extra'>,
15
+ ): string;
package/lib/debug.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import debug from 'debug';
2
- export declare type Log = debug.Debugger;
2
+ export type Log = debug.Debugger;
3
3
  export declare const log: debug.Debugger;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<string[], null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<string[], null>;
2
2
  export default _default;
@@ -1,5 +1,5 @@
1
- declare type Option = {
2
- denyObsoleteType: boolean;
1
+ type Option = {
2
+ denyObsoleteType: boolean;
3
3
  };
4
- declare const _default: import("@markuplint/ml-core").RuleSeed<"always", Option>;
4
+ declare const _default: import('@markuplint/ml-core').RuleSeed<'always', Option>;
5
5
  export default _default;
@@ -23,7 +23,7 @@ exports.default = (0, ml_core_1.createRule)({
23
23
  if ((doctype.name.toLowerCase() === 'html' && doctype.publicId) || doctype.systemId) {
24
24
  report({
25
25
  scope: doctype,
26
- message: t('Never {0} {1}', 'declarate', 'obsolete doctype'),
26
+ message: t('Never {0} {1}', 'declare', 'obsolete doctype'),
27
27
  });
28
28
  }
29
29
  },
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, null>;
2
2
  export default _default;
@@ -1,22 +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 voidElements = [
5
- 'area',
6
- 'base',
7
- 'br',
8
- 'col',
9
- 'embed',
10
- 'hr',
11
- 'img',
12
- 'input',
13
- 'link',
14
- 'meta',
15
- 'param',
16
- 'source',
17
- 'track',
18
- 'wbr',
19
- ];
4
+ const ml_spec_1 = require("@markuplint/ml-spec");
20
5
  exports.default = (0, ml_core_1.createRule)({
21
6
  defaultSeverity: 'warning',
22
7
  async verify({ document, report, t }) {
@@ -28,7 +13,7 @@ exports.default = (0, ml_core_1.createRule)({
28
13
  if (el.isOmitted) {
29
14
  return;
30
15
  }
31
- if (voidElements.some(vE => vE === el.localName)) {
16
+ if ((0, ml_spec_1.isVoidElement)(el)) {
32
17
  return;
33
18
  }
34
19
  if (el.closeTag != null) {
package/lib/helpers.d.ts CHANGED
@@ -2,7 +2,10 @@ import type { Log } from './debug';
2
2
  import type { Translator } from '@markuplint/i18n';
3
3
  import type { Element, RuleConfigValue, Document } from '@markuplint/ml-core';
4
4
  import type { Attribute } from '@markuplint/ml-spec';
5
- export declare function attrMatches<T extends RuleConfigValue, R>(node: Element<T, R>, condition: Attribute['condition']): boolean;
5
+ export declare function attrMatches<T extends RuleConfigValue, R>(
6
+ node: Element<T, R>,
7
+ condition: Attribute['condition'],
8
+ ): boolean;
6
9
  export declare function match(needle: string, pattern: string): boolean;
7
10
  /**
8
11
  * PotentialCustomElementName
@@ -20,28 +23,43 @@ export declare function match(needle: string, pattern: string): boolean;
20
23
  * Originally, it is not possible to define a name including ASCII upper alphas in the custom element, but it is not treated as illegal by the HTML parser.
21
24
  */
22
25
  export declare const rePCENChar: string;
23
- export declare function isValidAttr(t: Translator, name: string, value: string, isDynamicValue: boolean, node: Element<any, any>, attrSpecs: Attribute[], log?: Log): false | {
24
- invalidType: "non-existent" | "invalid-value";
25
- message: string;
26
- loc?: {
27
- raw: string;
28
- line: number;
29
- col: number;
30
- } | undefined;
31
- };
26
+ export declare function isValidAttr(
27
+ t: Translator,
28
+ name: string,
29
+ value: string,
30
+ isDynamicValue: boolean,
31
+ node: Element<any, any>,
32
+ attrSpecs: Attribute[],
33
+ log?: Log,
34
+ ):
35
+ | false
36
+ | {
37
+ invalidType: 'non-existent' | 'invalid-value';
38
+ message: string;
39
+ loc?:
40
+ | {
41
+ raw: string;
42
+ line: number;
43
+ col: number;
44
+ }
45
+ | undefined;
46
+ };
32
47
  export declare function toNormalizedValue(value: string, spec: Attribute): string;
33
48
  export declare function accnameMayBeMutable(el: Element<any, any>, document: Document<any, any>): boolean;
34
- export declare function getOwnedLabel<V extends RuleConfigValue, O>(el: Element<V, O>, document: Document<V, O>): Element<V, O> | null;
49
+ export declare function getOwnedLabel<V extends RuleConfigValue, O>(
50
+ el: Element<V, O>,
51
+ document: Document<V, O>,
52
+ ): Element<V, O> | null;
35
53
  export declare function decodeCharRef(characterReference: string): string;
36
54
  export declare class Collection<T> {
37
- #private;
38
- constructor(...items: (T | null | undefined)[]);
39
- [Symbol.iterator](): Iterator<T>;
40
- add(...items: (T | null | undefined)[]): void;
41
- toArray(): readonly T[];
55
+ #private;
56
+ constructor(...items: (T | null | undefined)[]);
57
+ [Symbol.iterator](): Iterator<T>;
58
+ add(...items: (T | null | undefined)[]): void;
59
+ toArray(): readonly T[];
42
60
  }
43
- declare type Writeable<T> = {
44
- -readonly [P in keyof T]: T[P];
61
+ type Writeable<T> = {
62
+ -readonly [P in keyof T]: T[P];
45
63
  };
46
64
  export declare function deepCopy<T>(value: T): Writeable<T>;
47
65
  export {};
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
package/lib/index.d.ts CHANGED
@@ -1,61 +1,3 @@
1
- declare const _default: {
2
- 'attr-duplication': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
3
- 'attr-value-quotes': import("packages/@markuplint/ml-core/lib").RuleSeed<import("./attr-value-quotes").Type, null>;
4
- 'case-sensitive-attr-name': import("packages/@markuplint/ml-core/lib").RuleSeed<import("./case-sensitive-attr-name").Value, null>;
5
- 'case-sensitive-tag-name': import("packages/@markuplint/ml-core/lib").RuleSeed<import("./case-sensitive-tag-name").Value, null>;
6
- 'character-reference': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
7
- 'class-naming': import("packages/@markuplint/ml-core/lib").RuleSeed<import("./class-naming").Value, null>;
8
- 'deprecated-attr': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
9
- 'deprecated-element': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
10
- 'disallowed-element': import("packages/@markuplint/ml-core/lib").RuleSeed<string[], null>;
11
- doctype: import("packages/@markuplint/ml-core/lib").RuleSeed<"always", {
12
- denyObsoleteType: boolean;
13
- }>;
14
- 'end-tag': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, null>;
15
- 'id-duplication': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
16
- 'ineffective-attr': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
17
- 'invalid-attr': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, {
18
- attrs?: Record<string, {
19
- enum: [string, ...string[]];
20
- } | {
21
- pattern: string;
22
- } | {
23
- type: import("packages/@markuplint/ml-spec/lib").AttributeType;
24
- } | {
25
- disallowed: true;
26
- }> | undefined;
27
- ignoreAttrNamePrefix?: string | string[] | undefined;
28
- allowToAddPropertiesForPretender?: boolean | undefined;
29
- }>;
30
- 'label-has-control': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
31
- 'landmark-roles': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, {
32
- ignoreRoles: (("banner" | "main" | "complementary" | "contentinfo") | "form" | "navigation" | "region")[];
33
- labelEachArea: boolean;
34
- }>;
35
- 'no-boolean-attr-value': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
36
- 'no-default-value': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
37
- 'no-hard-code-id': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, null>;
38
- 'no-refer-to-non-existent-id': import("packages/@markuplint/ml-core/lib").RuleSeed<import("packages/@markuplint/ml-config/src").RuleConfigValue, {
39
- ariaVersion: import("packages/@markuplint/ml-spec/lib").ARIAVersion;
40
- }>;
41
- 'no-use-event-handler-attr': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, {
42
- ignore?: string | string[] | undefined;
43
- }>;
44
- 'permitted-contents': import("packages/@markuplint/ml-core/lib").RuleSeed<import("./permitted-contents/types").TagRule[], import("./permitted-contents/types").Options>;
45
- 'require-accessible-name': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, {
46
- ariaVersion: import("packages/@markuplint/ml-spec/lib").ARIAVersion;
47
- }>;
48
- 'required-attr': import("packages/@markuplint/ml-core/lib").RuleSeed<string | (string | {
49
- name: string;
50
- value: string | string[];
51
- })[], null>;
52
- 'required-element': import("packages/@markuplint/ml-core/lib").RuleSeed<string[], {
53
- ignoreHasMutableContents: boolean;
54
- }>;
55
- 'required-h1': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, import("./required-h1").Options>;
56
- 'use-list': import("packages/@markuplint/ml-core/lib").RuleSeed<string[], {
57
- spaceNeededBullets?: string[] | undefined;
58
- }>;
59
- 'wai-aria': import("packages/@markuplint/ml-core/lib").RuleSeed<boolean, import("./wai-aria/types").Options>;
60
- };
1
+ import type { AnyRuleSeed } from '@markuplint/ml-core';
2
+ declare const _default: Record<string, AnyRuleSeed>;
61
3
  export default _default;
package/lib/index.js CHANGED
@@ -19,6 +19,7 @@ const label_has_control_1 = tslib_1.__importDefault(require("./label-has-control
19
19
  const landmark_roles_1 = tslib_1.__importDefault(require("./landmark-roles"));
20
20
  const no_boolean_attr_value_1 = tslib_1.__importDefault(require("./no-boolean-attr-value"));
21
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"));
22
23
  const no_hard_code_id_1 = tslib_1.__importDefault(require("./no-hard-code-id"));
23
24
  const no_refer_to_non_existent_id_1 = tslib_1.__importDefault(require("./no-refer-to-non-existent-id"));
24
25
  const no_use_event_handler_attr_1 = tslib_1.__importDefault(require("./no-use-event-handler-attr"));
@@ -48,6 +49,7 @@ exports.default = {
48
49
  'landmark-roles': landmark_roles_1.default,
49
50
  'no-boolean-attr-value': no_boolean_attr_value_1.default,
50
51
  'no-default-value': no_default_value_1.default,
52
+ 'no-empty-palpable-content': no_empty_palpable_content_1.default,
51
53
  'no-hard-code-id': no_hard_code_id_1.default,
52
54
  'no-refer-to-non-existent-id': no_refer_to_non_existent_id_1.default,
53
55
  'no-use-event-handler-attr': no_use_event_handler_attr_1.default,
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,17 +1,21 @@
1
1
  import type { AttributeType } from '@markuplint/ml-spec';
2
- declare type Option = {
3
- attrs?: Record<string, Rule>;
4
- ignoreAttrNamePrefix?: string | string[];
5
- allowToAddPropertiesForPretender?: boolean;
2
+ type Option = {
3
+ attrs?: Record<string, Rule>;
4
+ ignoreAttrNamePrefix?: string | string[];
5
+ allowToAddPropertiesForPretender?: boolean;
6
6
  };
7
- declare type Rule = {
8
- enum: [string, ...string[]];
9
- } | {
10
- pattern: string;
11
- } | {
12
- type: AttributeType;
13
- } | {
14
- disallowed: true;
15
- };
16
- declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Option>;
7
+ type Rule =
8
+ | {
9
+ enum: [string, ...string[]];
10
+ }
11
+ | {
12
+ pattern: string;
13
+ }
14
+ | {
15
+ type: AttributeType;
16
+ }
17
+ | {
18
+ disallowed: true;
19
+ };
20
+ declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, Option>;
17
21
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,8 +1,8 @@
1
- declare type Options = {
2
- ignoreRoles: Roles[];
3
- labelEachArea: boolean;
1
+ type Options = {
2
+ ignoreRoles: Roles[];
3
+ labelEachArea: boolean;
4
4
  };
5
- declare type TopLevelRoles = 'banner' | 'main' | 'complementary' | 'contentinfo';
6
- declare type Roles = TopLevelRoles | 'form' | 'navigation' | 'region';
7
- declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
5
+ type TopLevelRoles = 'banner' | 'main' | 'complementary' | 'contentinfo';
6
+ type Roles = TopLevelRoles | 'form' | 'navigation' | 'region';
7
+ declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, Options>;
8
8
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -0,0 +1,6 @@
1
+ type Options = {
2
+ extendsExposableElements?: boolean;
3
+ ignoreIfAriaBusy?: boolean;
4
+ };
5
+ declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, Options>;
6
+ export default _default;
@@ -0,0 +1,34 @@
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)({
6
+ defaultSeverity: 'warning',
7
+ defaultOptions: {
8
+ extendsExposableElements: true,
9
+ ignoreIfAriaBusy: true,
10
+ },
11
+ async verify({ document, report, t }) {
12
+ await document.walkOn('Element', el => {
13
+ if (!(0, ml_spec_1.isPalpableElement)(el, el.ownerMLDocument.specs, {
14
+ extendsSvg: false,
15
+ extendsExposableElements: el.rule.option.extendsExposableElements,
16
+ })) {
17
+ return;
18
+ }
19
+ if ((0, ml_spec_1.isVoidElement)(el)) {
20
+ return;
21
+ }
22
+ if (el.rule.option.ignoreIfAriaBusy && el.getAttribute('aria-busy') === 'true') {
23
+ return;
24
+ }
25
+ const isEmpty = Array.from(el.childNodes).every(node => node.is(node.TEXT_NODE) && node.isWhitespace());
26
+ if (isEmpty) {
27
+ report({
28
+ scope: el,
29
+ message: t('{0} should not {1}', t('the {0}', 'element'), 'empty'),
30
+ });
31
+ }
32
+ });
33
+ },
34
+ });
@@ -1,2 +1,2 @@
1
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
1
+ declare const _default: import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, null>;
2
2
  export default _default;
@@ -1,5 +1,8 @@
1
1
  import type { ARIAVersion } from '@markuplint/ml-spec';
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
3
- ariaVersion: ARIAVersion;
4
- }>;
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<
3
+ import('@markuplint/ml-core').RuleConfigValue,
4
+ {
5
+ ariaVersion: ARIAVersion;
6
+ }
7
+ >;
5
8
  export default _default;
@@ -1,5 +1,5 @@
1
- declare type Options = {
2
- ignore?: string | string[];
1
+ type Options = {
2
+ ignore?: string | string[];
3
3
  };
4
- declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
4
+ declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, Options>;
5
5
  export default _default;
@@ -1,3 +1,9 @@
1
1
  import type { ChildNode, Options, Result, Specs } from './types';
2
2
  import type { PermittedContentChoice } from '@markuplint/ml-spec';
3
- export declare function choice(pattern: PermittedContentChoice, elements: ChildNode[], specs: Specs, options: Options, depth: number): Result;
3
+ export declare function choice(
4
+ pattern: PermittedContentChoice,
5
+ elements: ChildNode[],
6
+ specs: Specs,
7
+ options: Options,
8
+ depth: number,
9
+ ): Result;
@@ -10,4 +10,10 @@ import type { PermittedContentPattern } from '@markuplint/ml-spec';
10
10
  * @param depth
11
11
  * @returns
12
12
  */
13
- export declare function complexBranch(pattern: PermittedContentPattern, elements: ChildNode[], specs: Specs, options: Options, depth: number): Result;
13
+ export declare function complexBranch(
14
+ pattern: PermittedContentPattern,
15
+ elements: ChildNode[],
16
+ specs: Specs,
17
+ options: Options,
18
+ depth: number,
19
+ ): Result;
@@ -1,5 +1,10 @@
1
1
  import type { ChildNode, Options, Result, Specs } from './types';
2
- import type { PermittedContentOneOrMore, PermittedContentOptional, PermittedContentRequire, PermittedContentZeroOrMore } from '@markuplint/ml-spec';
2
+ import type {
3
+ PermittedContentOneOrMore,
4
+ PermittedContentOptional,
5
+ PermittedContentRequire,
6
+ PermittedContentZeroOrMore,
7
+ } from '@markuplint/ml-spec';
3
8
  /**
4
9
  * Check count
5
10
  *
@@ -10,4 +15,14 @@ import type { PermittedContentOneOrMore, PermittedContentOptional, PermittedCont
10
15
  * @param depth
11
16
  * @returns
12
17
  */
13
- export declare function countPattern(pattern: PermittedContentOneOrMore | PermittedContentOptional | PermittedContentRequire | PermittedContentZeroOrMore, elements: readonly ChildNode[], specs: Specs, options: Options, depth: number): Result;
18
+ export declare function countPattern(
19
+ pattern:
20
+ | PermittedContentOneOrMore
21
+ | PermittedContentOptional
22
+ | PermittedContentRequire
23
+ | PermittedContentZeroOrMore,
24
+ elements: readonly ChildNode[],
25
+ specs: Specs,
26
+ options: Options,
27
+ depth: number,
28
+ ): Result;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="debug" />
2
- export declare const cmLog: import("debug").Debugger;
2
+ export declare const cmLog: import('debug').Debugger;
@@ -1,3 +1,3 @@
1
1
  import type { Options, TagRule } from './types';
2
- declare const _default: import("@markuplint/ml-core").RuleSeed<TagRule[], Options>;
2
+ declare const _default: import('@markuplint/ml-core').RuleSeed<TagRule[], Options>;
3
3
  export default _default;
@@ -1,3 +1,9 @@
1
1
  import type { ChildNode, Options, Result, Specs } from './types';
2
- export declare type SelectorResult = Result<'UNMATCHED_SELECTOR_BUT_MAY_EMPTY' | 'MISSING_NODE' | 'UNMATCHED_SELECTORS'>;
3
- export declare function matchesSelector(query: string, node: ChildNode | undefined, specs: Specs, options: Options, depth: number): SelectorResult;
2
+ export type SelectorResult = Result<'UNMATCHED_SELECTOR_BUT_MAY_EMPTY' | 'MISSING_NODE' | 'UNMATCHED_SELECTORS'>;
3
+ export declare function matchesSelector(
4
+ query: string,
5
+ node: ChildNode | undefined,
6
+ specs: Specs,
7
+ options: Options,
8
+ depth: number,
9
+ ): SelectorResult;
@@ -10,4 +10,10 @@ import type { PermittedContentPattern } from '@markuplint/ml-spec';
10
10
  * @param depth
11
11
  * @returns
12
12
  */
13
- export declare function order(contents: ReadonlyArray<PermittedContentPattern>, nodes: ReadonlyArray<ChildNode>, specs: Specs, options: Options, depth: number): Result;
13
+ export declare function order(
14
+ contents: ReadonlyArray<PermittedContentPattern>,
15
+ nodes: ReadonlyArray<ChildNode>,
16
+ specs: Specs,
17
+ options: Options,
18
+ depth: number,
19
+ ): Result;
@@ -1,4 +1,10 @@
1
1
  import type { SelectorResult } from './matches-selector';
2
2
  import type { ChildNode, Options, Specs } from './types';
3
3
  import type { PermittedContentPattern, Model } from '@markuplint/ml-spec';
4
- export declare function recursiveBranch(model: Model | PermittedContentPattern[], nodes: readonly ChildNode[], specs: Specs, options: Options, depth: number): SelectorResult;
4
+ export declare function recursiveBranch(
5
+ model: Model | PermittedContentPattern[],
6
+ nodes: readonly ChildNode[],
7
+ specs: Specs,
8
+ options: Options,
9
+ depth: number,
10
+ ): SelectorResult;