@markuplint/rules 3.4.0 → 3.5.0

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 (81) hide show
  1. package/lib/attr-check.d.ts +9 -19
  2. package/lib/attr-duplication/index.d.ts +1 -1
  3. package/lib/attr-value-quotes/index.d.ts +2 -2
  4. package/lib/case-sensitive-attr-name/index.d.ts +1 -1
  5. package/lib/case-sensitive-tag-name/index.d.ts +1 -1
  6. package/lib/character-reference/index.d.ts +1 -1
  7. package/lib/class-naming/index.d.ts +1 -1
  8. package/lib/create-message.d.ts +3 -12
  9. package/lib/deprecated-attr/index.d.ts +1 -1
  10. package/lib/deprecated-element/index.d.ts +1 -1
  11. package/lib/disallowed-element/index.d.ts +1 -1
  12. package/lib/doctype/index.d.ts +2 -2
  13. package/lib/end-tag/index.d.ts +1 -1
  14. package/lib/helpers.d.ts +18 -35
  15. package/lib/helpers.js +19 -5
  16. package/lib/id-duplication/index.d.ts +1 -1
  17. package/lib/index.d.ts +70 -3
  18. package/lib/index.js +2 -1
  19. package/lib/ineffective-attr/index.d.ts +1 -1
  20. package/lib/invalid-attr/index.d.ts +13 -17
  21. package/lib/label-has-control/index.d.ts +1 -1
  22. package/lib/landmark-roles/index.d.ts +3 -3
  23. package/lib/landmark-roles/index.js +6 -2
  24. package/lib/no-boolean-attr-value/index.d.ts +1 -1
  25. package/lib/no-default-value/index.d.ts +1 -1
  26. package/lib/no-empty-palpable-content/index.d.ts +3 -3
  27. package/lib/no-hard-code-id/index.d.ts +1 -1
  28. package/lib/no-refer-to-non-existent-id/index.d.ts +4 -7
  29. package/lib/no-use-event-handler-attr/index.d.ts +2 -2
  30. package/lib/permitted-contents/choice.d.ts +2 -7
  31. package/lib/permitted-contents/choice.js +3 -1
  32. package/lib/permitted-contents/complex-branch.d.ts +2 -7
  33. package/lib/permitted-contents/complex-branch.js +4 -2
  34. package/lib/permitted-contents/content-model.d.ts +1 -1
  35. package/lib/permitted-contents/content-model.js +6 -2
  36. package/lib/permitted-contents/count-pattern.d.ts +3 -17
  37. package/lib/permitted-contents/count-pattern.js +8 -2
  38. package/lib/permitted-contents/debug.browser.d.ts +15 -15
  39. package/lib/permitted-contents/debug.d.ts +1 -1
  40. package/lib/permitted-contents/index.d.ts +1 -1
  41. package/lib/permitted-contents/index.js +3 -1
  42. package/lib/permitted-contents/matches-selector.d.ts +2 -8
  43. package/lib/permitted-contents/matches-selector.js +3 -1
  44. package/lib/permitted-contents/order.d.ts +2 -7
  45. package/lib/permitted-contents/order.js +3 -1
  46. package/lib/permitted-contents/recursive-branch.d.ts +2 -7
  47. package/lib/permitted-contents/recursive-branch.js +5 -3
  48. package/lib/permitted-contents/represent-transparent-nodes.d.ts +3 -7
  49. package/lib/permitted-contents/represent-transparent-nodes.js +3 -1
  50. package/lib/permitted-contents/start.d.ts +2 -6
  51. package/lib/permitted-contents/start.js +3 -1
  52. package/lib/permitted-contents/transparent.d.ts +2 -2
  53. package/lib/permitted-contents/transparent.js +3 -1
  54. package/lib/permitted-contents/types.d.ts +31 -30
  55. package/lib/permitted-contents/utils.d.ts +44 -80
  56. package/lib/permitted-contents/utils.js +20 -6
  57. package/lib/placeholder-label-option/index.d.ts +1 -1
  58. package/lib/placeholder-label-option/index.js +6 -2
  59. package/lib/require-accessible-name/index.d.ts +2 -2
  60. package/lib/require-datetime/index.d.ts +2 -2
  61. package/lib/require-datetime/types.d.ts +2 -2
  62. package/lib/require-datetime/utils.d.ts +1 -1
  63. package/lib/required-attr/index.d.ts +3 -3
  64. package/lib/required-attr/index.js +1 -1
  65. package/lib/required-element/index.d.ts +2 -2
  66. package/lib/required-h1/index.d.ts +3 -3
  67. package/lib/use-list/index.d.ts +3 -3
  68. package/lib/wai-aria/checkings/default-value.d.ts +3 -7
  69. package/lib/wai-aria/checkings/deprecated-props.d.ts +4 -8
  70. package/lib/wai-aria/checkings/disallowed-prop.d.ts +4 -8
  71. package/lib/wai-aria/checkings/implicit-props.d.ts +4 -8
  72. package/lib/wai-aria/checkings/interaction-in-hidden.js +3 -1
  73. package/lib/wai-aria/checkings/no-global-prop.d.ts +3 -7
  74. package/lib/wai-aria/checkings/presentational-children.js +3 -1
  75. package/lib/wai-aria/checkings/required-owned-elements.d.ts +3 -7
  76. package/lib/wai-aria/checkings/required-owned-elements.js +4 -2
  77. package/lib/wai-aria/checkings/required-prop.d.ts +6 -12
  78. package/lib/wai-aria/checkings/value.d.ts +6 -10
  79. package/lib/wai-aria/index.d.ts +1 -1
  80. package/lib/wai-aria/types.d.ts +10 -10
  81. package/package.json +9 -8
@@ -14,7 +14,9 @@ const utils_1 = require("./utils");
14
14
  * @param depth
15
15
  * @returns
16
16
  */
17
- function countPattern(pattern, elements, specs, options, depth) {
17
+ function countPattern(pattern,
18
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
19
+ elements, specs, options, depth) {
18
20
  const ptLog = debug_1.cmLog.extend(`countPattern#${depth}`);
19
21
  const collection = new utils_1.Collection(elements);
20
22
  const { model, min, max, repeat, missingType } = (0, utils_1.normalizeModel)(pattern);
@@ -142,7 +144,11 @@ function countPattern(pattern, elements, specs, options, depth) {
142
144
  }
143
145
  exports.countPattern = countPattern;
144
146
  const cLog = debug_1.cmLog.extend('countCompereResult');
145
- function compereResult(a, b) {
147
+ function compereResult(
148
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
149
+ a,
150
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
151
+ b) {
146
152
  var _a;
147
153
  cLog('current: %s %O\nbarely: %s %O', a.type, a.hint, b === null || b === void 0 ? void 0 : b.type, b === null || b === void 0 ? void 0 : b.hint);
148
154
  if (b == null) {
@@ -1,30 +1,30 @@
1
1
  /// <reference types="debug" />
2
- export declare const cmLog: import('debug').Debugger;
2
+ export declare const cmLog: import("debug").Debugger;
3
3
  export declare const bgGreen: {
4
- (): void;
5
- bold(): void;
4
+ (): void;
5
+ bold(): void;
6
6
  };
7
7
  export declare const green: {
8
- (): void;
9
- bold(): void;
8
+ (): void;
9
+ bold(): void;
10
10
  };
11
11
  export declare const bgRed: {
12
- (): void;
13
- bold(): void;
12
+ (): void;
13
+ bold(): void;
14
14
  };
15
15
  export declare const bgBlue: {
16
- (): void;
17
- bold(): void;
16
+ (): void;
17
+ bold(): void;
18
18
  };
19
19
  export declare const blue: {
20
- (): void;
21
- bold(): void;
20
+ (): void;
21
+ bold(): void;
22
22
  };
23
23
  export declare const bgMagenta: {
24
- (): void;
25
- bold(): void;
24
+ (): void;
25
+ bold(): void;
26
26
  };
27
27
  export declare const cyan: {
28
- (): void;
29
- bold(): void;
28
+ (): void;
29
+ bold(): void;
30
30
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="debug" />
2
- export declare const cmLog: import('debug').Debugger;
2
+ export declare const cmLog: import("debug").Debugger;
3
3
  export { bgGreen, green, bgRed, bgBlue, blue, bgMagenta, cyan } from 'ansi-colors';
@@ -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: Readonly<import("@markuplint/ml-core").RuleSeed<TagRule[], Options>>;
3
3
  export default _default;
@@ -91,7 +91,9 @@ exports.default = (0, ml_core_1.createRule)({
91
91
  });
92
92
  },
93
93
  });
94
- function name(scope, t) {
94
+ function name(
95
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
96
+ scope, t) {
95
97
  if (scope.is(scope.ELEMENT_NODE)) {
96
98
  return t('the "{0}" {1}', scope.localName, 'element');
97
99
  }
@@ -1,9 +1,3 @@
1
- import type { ChildNode, Options, Result, Specs } from './types';
1
+ import type { ChildNode, Result, Specs } from './types';
2
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;
3
+ export declare function matchesSelector(query: string, node: ChildNode | undefined, specs: Specs, depth: number): SelectorResult;
@@ -4,7 +4,9 @@ exports.matchesSelector = void 0;
4
4
  const ml_spec_1 = require("@markuplint/ml-spec");
5
5
  const debug_1 = require("./debug");
6
6
  const utils_1 = require("./utils");
7
- function matchesSelector(query, node, specs, options, depth) {
7
+ function matchesSelector(query,
8
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
9
+ node, specs, depth) {
8
10
  const nodeLog = debug_1.cmLog.extend(`node#${depth}`);
9
11
  const { selector, hasText, hasCustom } = optCondition(query, specs);
10
12
  if (node == null) {
@@ -1,5 +1,6 @@
1
1
  import type { ChildNode, Options, Result, Specs } from './types';
2
2
  import type { PermittedContentPattern } from '@markuplint/ml-spec';
3
+ import type { ReadonlyDeep } from 'type-fest';
3
4
  /**
4
5
  * Check ordered array
5
6
  *
@@ -10,10 +11,4 @@ import type { PermittedContentPattern } from '@markuplint/ml-spec';
10
11
  * @param depth
11
12
  * @returns
12
13
  */
13
- export declare function order(
14
- contents: ReadonlyArray<PermittedContentPattern>,
15
- nodes: ReadonlyArray<ChildNode>,
16
- specs: Specs,
17
- options: Options,
18
- depth: number,
19
- ): Result;
14
+ export declare function order(contents: ReadonlyDeep<PermittedContentPattern[]>, nodes: readonly ChildNode[], specs: Specs, options: Options, depth: number): Result;
@@ -15,7 +15,9 @@ const utils_1 = require("./utils");
15
15
  * @param depth
16
16
  * @returns
17
17
  */
18
- function order(contents, nodes, specs, options, depth) {
18
+ function order(contents,
19
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
20
+ nodes, specs, options, depth) {
19
21
  var _a, _b, _c, _d, _e;
20
22
  const orderLog = debug_1.cmLog.extend(`order#${depth}`);
21
23
  const btLog = debug_1.cmLog.extend(`backtrack#${depth}`);
@@ -1,10 +1,5 @@
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(
5
- model: Model | PermittedContentPattern[],
6
- nodes: readonly ChildNode[],
7
- specs: Specs,
8
- options: Options,
9
- depth: number,
10
- ): SelectorResult;
4
+ import type { ReadonlyDeep } from 'type-fest';
5
+ export declare function recursiveBranch(model: ReadonlyDeep<Model | PermittedContentPattern[]>, nodes: readonly ChildNode[], specs: Specs, options: Options, depth: number): SelectorResult;
@@ -4,17 +4,19 @@ exports.recursiveBranch = void 0;
4
4
  const matches_selector_1 = require("./matches-selector");
5
5
  const order_1 = require("./order");
6
6
  const utils_1 = require("./utils");
7
- function recursiveBranch(model, nodes, specs, options, depth) {
7
+ function recursiveBranch(model,
8
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
9
+ nodes, specs, options, depth) {
8
10
  if (!(0, utils_1.isModel)(model)) {
9
11
  return (0, order_1.order)(model, nodes, specs, options, depth + 1);
10
12
  }
11
13
  if (typeof model === 'string') {
12
- return (0, matches_selector_1.matchesSelector)(model, nodes[0], specs, options, depth);
14
+ return (0, matches_selector_1.matchesSelector)(model, nodes[0], specs, depth);
13
15
  }
14
16
  const collection = new utils_1.Collection(nodes);
15
17
  let lastUnmatched = null;
16
18
  for (const query of model) {
17
- const result = (0, matches_selector_1.matchesSelector)(query, collection.unmatched[0], specs, options, depth);
19
+ const result = (0, matches_selector_1.matchesSelector)(query, collection.unmatched[0], specs, depth);
18
20
  collection.addMatched(result.matched);
19
21
  if (result.type === 'MATCHED' || result.type === 'MATCHED_ZERO') {
20
22
  return {
@@ -1,10 +1,6 @@
1
1
  import type { ChildNode, Options, Result, Specs } from './types';
2
2
  export declare const transparentMode: Map<ChildNode, true>;
3
- export declare function representTransparentNodes(
4
- nodes: ChildNode[],
5
- specs: Specs,
6
- options: Options,
7
- ): {
8
- nodes: ChildNode[];
9
- errors: Result[];
3
+ export declare function representTransparentNodes(nodes: ChildNode[], specs: Specs, options: Options): {
4
+ nodes: ChildNode[];
5
+ errors: Result[];
10
6
  };
@@ -5,7 +5,9 @@ const ml_spec_1 = require("@markuplint/ml-spec");
5
5
  const order_1 = require("./order");
6
6
  const utils_1 = require("./utils");
7
7
  exports.transparentMode = new Map();
8
- function representTransparentNodes(nodes, specs, options) {
8
+ function representTransparentNodes(
9
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
10
+ nodes, specs, options) {
9
11
  var _a;
10
12
  const result = [];
11
13
  const errors = [];
@@ -1,5 +1,6 @@
1
1
  import type { ContentModelResult, Element, Options, Specs } from './types';
2
2
  import type { ContentModel } from '@markuplint/ml-spec';
3
+ import type { ReadonlyDeep } from 'type-fest';
3
4
  /**
4
5
  * Check start
5
6
  *
@@ -9,9 +10,4 @@ import type { ContentModel } from '@markuplint/ml-spec';
9
10
  * @param options
10
11
  * @returns
11
12
  */
12
- export declare function start(
13
- contents: ContentModel['contents'],
14
- el: Element,
15
- specs: Specs,
16
- options: Options,
17
- ): ContentModelResult[];
13
+ export declare function start(contents: ReadonlyDeep<ContentModel['contents']>, el: Element, specs: Specs, options: Options): ContentModelResult[];
@@ -13,7 +13,9 @@ const utils_1 = require("./utils");
13
13
  * @param options
14
14
  * @returns
15
15
  */
16
- function start(contents, el, specs, options) {
16
+ function start(contents,
17
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
18
+ el, specs, options) {
17
19
  var _a;
18
20
  if (contents === false) {
19
21
  if (el.childNodes.length) {
@@ -1,2 +1,2 @@
1
- import type { ChildNode, Options, Result, Specs } from './types';
2
- export declare function transparent(nodes: ChildNode[], specs: Specs, options: Options, depth: number): Result;
1
+ import type { ChildNode, Result } from './types';
2
+ export declare function transparent(nodes: readonly ChildNode[]): Result;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transparent = void 0;
4
4
  const debug_1 = require("./debug");
5
5
  const transparentLog = debug_1.cmLog.extend('transparent');
6
- function transparent(nodes, specs, options, depth) {
6
+ function transparent(
7
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
8
+ nodes) {
7
9
  var _a, _b;
8
10
  if (nodes.length === 0 || ((_b = (_a = nodes[0]) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement)) {
9
11
  transparentLog('Skipped');
@@ -1,51 +1,52 @@
1
1
  import type { Element as _Element, ChildNode as _ChildNode } from '@markuplint/ml-core';
2
2
  import type { ContentModel, MLMLSpec } from '@markuplint/ml-spec';
3
+ import type { ReadonlyDeep } from 'type-fest';
3
4
  export type Element = _Element<TagRule[], Options>;
4
5
  export type ChildNode = _ChildNode<TagRule[], Options>;
5
6
  export type Specs = {
6
- cites: MLMLSpec['cites'];
7
- def: MLMLSpec['def'];
8
- specs: {
9
- name: string;
10
- contentModel: {
11
- contents: MLMLSpec['specs'][0]['contentModel']['contents'];
12
- };
13
- }[];
7
+ readonly cites: MLMLSpec['cites'];
8
+ readonly def: MLMLSpec['def'];
9
+ readonly specs: readonly {
10
+ readonly name: string;
11
+ readonly contentModel: {
12
+ readonly contents: MLMLSpec['specs'][0]['contentModel']['contents'];
13
+ };
14
+ }[];
14
15
  };
15
16
  export type ContentModelResult = {
16
- type: MatchedReason | UnmatchedReason;
17
- scope: ChildNode;
18
- query: Result['query'];
19
- hint: Result['hint'];
17
+ type: MatchedReason | UnmatchedReason;
18
+ scope: ChildNode;
19
+ query: Result['query'];
20
+ hint: Result['hint'];
20
21
  };
21
22
  export type Result<T extends string = MatchedReason> = {
22
- type: MatchedReason | UnmatchedReason | T;
23
- matched: ChildNode[];
24
- unmatched: ChildNode[];
25
- zeroMatch: boolean;
26
- query: string;
27
- hint: Hints;
23
+ type: MatchedReason | UnmatchedReason | T;
24
+ matched: ChildNode[];
25
+ unmatched: ChildNode[];
26
+ zeroMatch: boolean;
27
+ query: string;
28
+ hint: Hints;
28
29
  };
29
30
  export type Hints = {
30
- max?: number;
31
- not?: ChildNode;
32
- transparent?: Element;
33
- missing?: {
34
- barelyMatchedElements?: number;
35
- need?: string;
36
- };
31
+ max?: number;
32
+ not?: ChildNode;
33
+ transparent?: Element;
34
+ missing?: {
35
+ barelyMatchedElements?: number;
36
+ need?: string;
37
+ };
37
38
  };
38
39
  export type MatchedReason = 'MATCHED' | 'MATCHED_ZERO';
39
40
  export type UnmatchedReason = 'NOTHING' | 'UNEXPECTED_EXTRA_NODE' | 'TRANSPARENT_MODEL_DISALLOWS' | MissingNodeReason;
40
41
  export type MissingNodeReason = 'MISSING_NODE_REQUIRED' | 'MISSING_NODE_ONE_OR_MORE';
41
42
  export type RepeatSign = '' | '?' | '+' | '*' | `{${number},${number}}`;
42
43
  export type TransparentModel = {
43
- el: Element;
44
- additionalCondition: string;
44
+ el: Element;
45
+ additionalCondition: string;
45
46
  };
46
47
  export type TagRule = {
47
- tag: string;
48
- } & ContentModel;
48
+ readonly tag: string;
49
+ } & ReadonlyDeep<ContentModel>;
49
50
  export type Options = {
50
- ignoreHasMutableChildren: boolean;
51
+ readonly ignoreHasMutableChildren: boolean;
51
52
  };
@@ -1,87 +1,51 @@
1
1
  import type { ChildNode, Element, Hints, MissingNodeReason, RepeatSign, Specs } from './types';
2
- import type {
3
- PermittedContentPattern,
4
- PermittedContentChoice,
5
- PermittedContentOneOrMore,
6
- PermittedContentOptional,
7
- PermittedContentRequire,
8
- PermittedContentTransparent,
9
- PermittedContentZeroOrMore,
10
- Model,
11
- } from '@markuplint/ml-spec';
2
+ import type { PermittedContentPattern, PermittedContentChoice, PermittedContentOneOrMore, PermittedContentOptional, PermittedContentRequire, PermittedContentTransparent, PermittedContentZeroOrMore, Model } from '@markuplint/ml-spec';
3
+ import type { ReadonlyDeep } from 'type-fest';
12
4
  export declare function getChildNodesWithoutWhitespaces(el: Element): ChildNode[];
13
- export declare function isModel(model: Model | PermittedContentPattern[]): model is Model;
14
- export declare function matches(
15
- selector: string,
16
- node: ChildNode,
17
- specs: Specs,
18
- ):
19
- | {
20
- matched: boolean;
21
- not?: undefined;
22
- }
23
- | {
24
- matched: boolean;
25
- not: ChildNode | undefined;
26
- };
27
- export declare function isRequire(content: PermittedContentPattern): content is PermittedContentRequire;
28
- export declare function isOptional(content: PermittedContentPattern): content is PermittedContentOptional;
29
- export declare function isOneOrMore(content: PermittedContentPattern): content is PermittedContentOneOrMore;
30
- export declare function isZeroOrMore(content: PermittedContentPattern): content is PermittedContentZeroOrMore;
31
- export declare function isChoice(content: PermittedContentPattern): content is PermittedContentChoice;
32
- export declare function isTransparent(content: PermittedContentPattern): content is PermittedContentTransparent;
33
- export declare function normalizeModel(
34
- pattern:
35
- | PermittedContentRequire
36
- | PermittedContentOptional
37
- | PermittedContentOneOrMore
38
- | PermittedContentZeroOrMore,
39
- ): {
40
- model: PermittedContentPattern[] | Model;
41
- min: number;
42
- max: number;
43
- repeat: RepeatSign;
44
- missingType: MissingNodeReason | undefined;
5
+ 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;
45
12
  };
46
- export declare function mergeHints(
47
- a: Hints,
48
- b: Hints,
49
- ): Partial<{
50
- missing:
51
- | Partial<{
52
- barelyMatchedElements?: number | undefined;
53
- need?: string | undefined;
54
- }>
55
- | undefined;
56
- max?: number | undefined;
57
- not?:
58
- | import('packages/@markuplint/ml-core/lib').DocumentType<
59
- import('./types').TagRule[],
60
- import('./types').Options
61
- >
62
- | import('packages/@markuplint/ml-core/lib/ml-dom/node/character-data').MLCharacterData<
63
- import('./types').TagRule[],
64
- import('./types').Options,
65
- import('packages/@markuplint/ml-ast/lib').MLASTAbstractNode
66
- >
67
- | import('packages/@markuplint/ml-core/lib').Element<import('./types').TagRule[], import('./types').Options>
68
- | import('packages/@markuplint/ml-core/lib').Block<import('./types').TagRule[], import('./types').Options>
69
- | undefined;
70
- transparent?: Element | undefined;
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;
71
34
  }>;
72
35
  export declare function cleanObject<T extends Object>(object: T): Partial<T>;
73
36
  export declare class Collection {
74
- #private;
75
- constructor(origin: readonly ChildNode[]);
76
- get matched(): ChildNode[];
77
- get matchedCount(): number;
78
- get nodes(): ChildNode[];
79
- get unmatched(): ChildNode[];
80
- addMatched(nodes: ChildNode[]): boolean;
81
- back(): void;
82
- lock(): void;
83
- max(max: number): void;
84
- toString(highlightExtraNodes?: boolean): string;
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 {
85
50
  }
86
- export declare class UnsupportedError extends Error {}
87
- export declare function modelLog(model: Model | PermittedContentPattern[], repeat: RepeatSign): string;
51
+ export declare function modelLog(model: ReadonlyDeep<Model | PermittedContentPattern[]>, repeat: RepeatSign): string;
@@ -7,7 +7,9 @@ const selector_1 = require("@markuplint/selector");
7
7
  const debug_1 = require("./debug");
8
8
  const represent_transparent_nodes_1 = require("./represent-transparent-nodes");
9
9
  const getChildNodesWithoutWhitespacesCaches = new Map();
10
- function getChildNodesWithoutWhitespaces(el) {
10
+ function getChildNodesWithoutWhitespaces(
11
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
12
+ el) {
11
13
  let nodes = getChildNodesWithoutWhitespacesCaches.get(el);
12
14
  if (nodes) {
13
15
  return nodes;
@@ -36,7 +38,9 @@ function isModel(model) {
36
38
  return modelMode;
37
39
  }
38
40
  exports.isModel = isModel;
39
- function matches(selector, node, specs) {
41
+ function matches(selector,
42
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
43
+ node, specs) {
40
44
  const selectorResult = (0, selector_1.createSelector)(selector, specs).search(node);
41
45
  const matched = selectorResult.filter((r) => r.matched);
42
46
  if (matched.length) {
@@ -56,7 +60,9 @@ function matches(selector, node, specs) {
56
60
  };
57
61
  }
58
62
  exports.matches = matches;
59
- function descendants(selectorResult) {
63
+ function descendants(
64
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
65
+ selectorResult) {
60
66
  let nodes = selectorResult.nodes.slice();
61
67
  while (selectorResult.has.length) {
62
68
  for (const dep of selectorResult.has) {
@@ -151,7 +157,11 @@ function normalizeModel(pattern) {
151
157
  };
152
158
  }
153
159
  exports.normalizeModel = normalizeModel;
154
- function mergeHints(a, b) {
160
+ function mergeHints(
161
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
162
+ a,
163
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
164
+ b) {
155
165
  const missing = [a.missing, b.missing].sort((a, b) => { var _a, _b; return ((_a = b === null || b === void 0 ? void 0 : b.barelyMatchedElements) !== null && _a !== void 0 ? _a : 0) - ((_b = a === null || a === void 0 ? void 0 : a.barelyMatchedElements) !== null && _b !== void 0 ? _b : 0); })[0];
156
166
  return cleanObject({
157
167
  ...a,
@@ -171,7 +181,9 @@ function cleanObject(object) {
171
181
  }
172
182
  exports.cleanObject = cleanObject;
173
183
  class Collection {
174
- constructor(origin) {
184
+ constructor(
185
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
186
+ origin) {
175
187
  _Collection_locked.set(this, new Set());
176
188
  _Collection_matched.set(this, new Set());
177
189
  _Collection_nodes.set(this, void 0);
@@ -191,7 +203,9 @@ class Collection {
191
203
  get unmatched() {
192
204
  return Array.from(tslib_1.__classPrivateFieldGet(this, _Collection_nodes, "f")).filter(n => !tslib_1.__classPrivateFieldGet(this, _Collection_matched, "f").has(n));
193
205
  }
194
- addMatched(nodes) {
206
+ addMatched(
207
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
208
+ nodes) {
195
209
  const i = tslib_1.__classPrivateFieldGet(this, _Collection_matched, "f").size;
196
210
  for (const node of nodes) {
197
211
  if (!tslib_1.__classPrivateFieldGet(this, _Collection_nodes, "f").has(node)) {
@@ -1,2 +1,2 @@
1
- declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, null>;
1
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<boolean, undefined>>;
2
2
  export default _default;
@@ -26,7 +26,9 @@ exports.default = (0, ml_core_1.createRule)({
26
26
  * @param select
27
27
  * @returns
28
28
  */
29
- function needPlaceholderLabelOption(select) {
29
+ function needPlaceholderLabelOption(
30
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
31
+ select) {
30
32
  const hasRequired = select.hasAttribute('required');
31
33
  if (!hasRequired) {
32
34
  return false;
@@ -53,7 +55,9 @@ function needPlaceholderLabelOption(select) {
53
55
  * @param select
54
56
  * @returns
55
57
  */
56
- function hasPlaceholderLabelOption(select) {
58
+ function hasPlaceholderLabelOption(
59
+ // eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
60
+ select) {
57
61
  var _a;
58
62
  // > has a required attribute specified
59
63
  if (!select.hasAttribute('required')) {
@@ -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: 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: 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
@@ -7,5 +7,5 @@ import type { DateTime, Lang } from './types';
7
7
  * @param base Reference date for a test
8
8
  * @returns
9
9
  */
10
- export declare function parseADatetime(content: string, langs: Lang[], base?: Date): DateTime | null;
10
+ export declare function parseADatetime(content: string, langs: readonly Lang[], base?: Readonly<Date>): DateTime | null;
11
11
  export declare function getCandidateDatetimeString(content: string, langs?: Lang[]): string | null;
@@ -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: import('@markuplint/ml-core').RuleSeed<RequiredAttributes, null>;
6
+ declare const _default: Readonly<import("@markuplint/ml-core").RuleSeed<RequiredAttributes, undefined>>;
7
7
  export default _default;
@@ -55,7 +55,7 @@ exports.default = (0, ml_core_1.createRule)({
55
55
  invalid = (0, helpers_1.attrMatches)(el, spec.condition) && didntHave;
56
56
  }
57
57
  else if (spec.required) {
58
- const selector = Array.isArray(spec.required) ? spec.required.join(',') : spec.required;
58
+ const selector = typeof spec.required === 'string' ? spec.required : spec.required.join(',');
59
59
  invalid = el.matches(selector) && didntHave;
60
60
  }
61
61
  if (invalid) {