@markuplint/rules 3.0.0-rc.1 → 3.0.0-rc.2
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.
- package/lib/attr-check.d.ts +8 -19
- package/lib/attr-duplication/index.d.ts +1 -1
- package/lib/attr-value-quotes/index.d.ts +2 -2
- package/lib/case-sensitive-attr-name/index.d.ts +1 -1
- package/lib/case-sensitive-tag-name/index.d.ts +1 -1
- package/lib/character-reference/index.d.ts +1 -1
- package/lib/class-naming/index.d.ts +1 -1
- package/lib/create-message.d.ts +2 -12
- package/lib/deprecated-attr/index.d.ts +1 -1
- package/lib/deprecated-element/index.d.ts +1 -1
- package/lib/disallowed-element/index.d.ts +1 -1
- package/lib/doctype/index.d.ts +2 -2
- package/lib/end-tag/index.d.ts +1 -1
- package/lib/helpers.d.ts +17 -35
- package/lib/id-duplication/index.d.ts +1 -1
- package/lib/ineffective-attr/index.d.ts +1 -1
- package/lib/invalid-attr/index.d.ts +13 -17
- package/lib/invalid-attr/index.js +6 -6
- package/lib/label-has-control/index.d.ts +1 -1
- package/lib/landmark-roles/index.d.ts +3 -3
- package/lib/landmark-roles/index.js +2 -2
- package/lib/no-boolean-attr-value/index.d.ts +1 -1
- package/lib/no-default-value/index.d.ts +1 -1
- package/lib/no-empty-palpable-content/index.d.ts +3 -3
- package/lib/no-empty-palpable-content/index.js +2 -2
- package/lib/no-hard-code-id/index.d.ts +1 -1
- package/lib/no-refer-to-non-existent-id/index.d.ts +3 -6
- package/lib/no-refer-to-non-existent-id/index.js +1 -1
- package/lib/no-use-event-handler-attr/index.d.ts +2 -2
- package/lib/no-use-event-handler-attr/index.js +4 -4
- package/lib/permitted-contents/choice.d.ts +1 -7
- package/lib/permitted-contents/complex-branch.d.ts +1 -7
- package/lib/permitted-contents/count-pattern.d.ts +2 -17
- package/lib/permitted-contents/debug.d.ts +1 -1
- package/lib/permitted-contents/index.d.ts +1 -1
- package/lib/permitted-contents/index.js +4 -4
- package/lib/permitted-contents/matches-selector.d.ts +1 -7
- package/lib/permitted-contents/order.d.ts +1 -7
- package/lib/permitted-contents/recursive-branch.d.ts +1 -7
- package/lib/permitted-contents/represent-transparent-nodes.d.ts +3 -7
- package/lib/permitted-contents/start.d.ts +1 -6
- package/lib/permitted-contents/start.js +1 -1
- package/lib/permitted-contents/types.d.ts +27 -31
- package/lib/permitted-contents/utils.d.ts +21 -35
- package/lib/require-accessible-name/index.d.ts +2 -2
- package/lib/require-accessible-name/index.js +4 -4
- package/lib/required-attr/index.d.ts +3 -3
- package/lib/required-element/index.d.ts +2 -2
- package/lib/required-element/index.js +1 -1
- package/lib/required-h1/index.d.ts +3 -3
- package/lib/required-h1/index.js +2 -2
- package/lib/use-list/index.d.ts +2 -2
- package/lib/use-list/index.js +1 -1
- package/lib/wai-aria/checkings/abstract-role.js +1 -1
- package/lib/wai-aria/checkings/default-value.d.ts +3 -7
- package/lib/wai-aria/checkings/deprecated-props.d.ts +4 -8
- package/lib/wai-aria/checkings/disallowed-prop.d.ts +4 -8
- package/lib/wai-aria/checkings/implicit-props.d.ts +4 -8
- package/lib/wai-aria/checkings/implicit-role.js +1 -1
- package/lib/wai-aria/checkings/no-global-prop.d.ts +3 -7
- package/lib/wai-aria/checkings/non-existent-role.js +1 -1
- package/lib/wai-aria/checkings/permitted-roles.js +1 -1
- package/lib/wai-aria/checkings/presentational-children.js +1 -1
- package/lib/wai-aria/checkings/required-owned-elements.d.ts +3 -7
- package/lib/wai-aria/checkings/required-owned-elements.js +2 -2
- package/lib/wai-aria/checkings/required-prop.d.ts +6 -12
- package/lib/wai-aria/checkings/value.d.ts +5 -9
- package/lib/wai-aria/index.d.ts +1 -1
- package/lib/wai-aria/index.js +11 -11
- package/lib/wai-aria/types.d.ts +10 -10
- package/package.json +6 -6
- package/tsconfig.tsbuildinfo +1 -1
package/lib/attr-check.d.ts
CHANGED
|
@@ -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
3
|
type Invalid = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
invalidType: 'non-existent' | 'invalid-value';
|
|
5
|
+
message: string;
|
|
6
|
+
loc?: Loc;
|
|
7
7
|
};
|
|
8
8
|
type Loc = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
raw: string;
|
|
10
|
+
line: number;
|
|
11
|
+
col: number;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Use in rules `invalid-attr` and `wai-aria`
|
|
@@ -18,17 +18,6 @@ type Loc = {
|
|
|
18
18
|
* @param isCustomRule
|
|
19
19
|
* @param spec
|
|
20
20
|
*/
|
|
21
|
-
export declare function attrCheck(
|
|
22
|
-
|
|
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;
|
|
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;
|
|
34
23
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
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
1
|
export type Type = 'double' | 'single';
|
|
2
2
|
export type Quote = '"' | "'";
|
|
3
3
|
export type QuoteMap = {
|
|
4
|
-
|
|
4
|
+
[P in Type]: Quote;
|
|
5
5
|
};
|
|
6
|
-
declare const _default: import(
|
|
6
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<Type, null>;
|
|
7
7
|
export default _default;
|
package/lib/create-message.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
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(
|
|
5
|
-
|
|
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;
|
|
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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
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(
|
|
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(
|
|
1
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<string[], null>;
|
|
2
2
|
export default _default;
|
package/lib/doctype/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type Option = {
|
|
2
|
-
|
|
2
|
+
denyObsoleteType: boolean;
|
|
3
3
|
};
|
|
4
|
-
declare const _default: import(
|
|
4
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<"always", Option>;
|
|
5
5
|
export default _default;
|
package/lib/end-tag/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
1
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, null>;
|
|
2
2
|
export default _default;
|
package/lib/helpers.d.ts
CHANGED
|
@@ -2,10 +2,7 @@ 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>(
|
|
6
|
-
node: Element<T, R>,
|
|
7
|
-
condition: Attribute['condition'],
|
|
8
|
-
): boolean;
|
|
5
|
+
export declare function attrMatches<T extends RuleConfigValue, R>(node: Element<T, R>, condition: Attribute['condition']): boolean;
|
|
9
6
|
export declare function match(needle: string, pattern: string): boolean;
|
|
10
7
|
/**
|
|
11
8
|
* PotentialCustomElementName
|
|
@@ -23,43 +20,28 @@ export declare function match(needle: string, pattern: string): boolean;
|
|
|
23
20
|
* 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.
|
|
24
21
|
*/
|
|
25
22
|
export declare const rePCENChar: string;
|
|
26
|
-
export declare function isValidAttr(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
};
|
|
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
|
+
};
|
|
47
32
|
export declare function toNormalizedValue(value: string, spec: Attribute): string;
|
|
48
33
|
export declare function accnameMayBeMutable(el: Element<any, any>, document: Document<any, any>): boolean;
|
|
49
|
-
export declare function getOwnedLabel<V extends RuleConfigValue, O>(
|
|
50
|
-
el: Element<V, O>,
|
|
51
|
-
document: Document<V, O>,
|
|
52
|
-
): Element<V, O> | null;
|
|
34
|
+
export declare function getOwnedLabel<V extends RuleConfigValue, O>(el: Element<V, O>, document: Document<V, O>): Element<V, O> | null;
|
|
53
35
|
export declare function decodeCharRef(characterReference: string): string;
|
|
54
36
|
export declare class Collection<T> {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
37
|
+
#private;
|
|
38
|
+
constructor(...items: (T | null | undefined)[]);
|
|
39
|
+
[Symbol.iterator](): Iterator<T>;
|
|
40
|
+
add(...items: (T | null | undefined)[]): void;
|
|
41
|
+
toArray(): readonly T[];
|
|
60
42
|
}
|
|
61
43
|
type Writeable<T> = {
|
|
62
|
-
|
|
44
|
+
-readonly [P in keyof T]: T[P];
|
|
63
45
|
};
|
|
64
46
|
export declare function deepCopy<T>(value: T): Writeable<T>;
|
|
65
47
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
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(
|
|
1
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
|
|
2
2
|
export default _default;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import type { AttributeType } from '@markuplint/ml-spec';
|
|
2
2
|
type Option = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
attrs?: Record<string, Rule>;
|
|
4
|
+
ignoreAttrNamePrefix?: string | string[];
|
|
5
|
+
allowToAddPropertiesForPretender?: boolean;
|
|
6
6
|
};
|
|
7
|
-
type Rule =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| {
|
|
18
|
-
disallowed: true;
|
|
19
|
-
};
|
|
20
|
-
declare const _default: import('@markuplint/ml-core').RuleSeed<boolean, Option>;
|
|
7
|
+
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>;
|
|
21
17
|
export default _default;
|
|
@@ -11,7 +11,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
11
11
|
await document.walkOn('Attr', attr => {
|
|
12
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
13
13
|
// Default
|
|
14
|
-
const allowToAddPropertiesForPretender = (_a = attr.rule.
|
|
14
|
+
const allowToAddPropertiesForPretender = (_a = attr.rule.options.allowToAddPropertiesForPretender) !== null && _a !== void 0 ? _a : true;
|
|
15
15
|
if (attr.isDirective) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
@@ -33,16 +33,16 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
33
33
|
}
|
|
34
34
|
const valueNode = attr.valueNode;
|
|
35
35
|
const value = attr.value;
|
|
36
|
-
if (attr.rule.
|
|
37
|
-
const ignoreAttrNamePrefixes = Array.isArray(attr.rule.
|
|
38
|
-
? attr.rule.
|
|
39
|
-
: [attr.rule.
|
|
36
|
+
if (attr.rule.options.ignoreAttrNamePrefix) {
|
|
37
|
+
const ignoreAttrNamePrefixes = Array.isArray(attr.rule.options.ignoreAttrNamePrefix)
|
|
38
|
+
? attr.rule.options.ignoreAttrNamePrefix
|
|
39
|
+
: [attr.rule.options.ignoreAttrNamePrefix];
|
|
40
40
|
if (ignoreAttrNamePrefixes.some(prefix => name.indexOf(prefix) === 0)) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
let invalid = false;
|
|
45
|
-
const customRule = attr.rule.
|
|
45
|
+
const customRule = attr.rule.options.attrs ? attr.rule.options.attrs[name] : null;
|
|
46
46
|
if (customRule) {
|
|
47
47
|
if ('enum' in customRule) {
|
|
48
48
|
invalid = (0, attr_check_1.attrCheck)(t, name.toLowerCase(), value, true, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
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
1
|
type Options = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
ignoreRoles: Roles[];
|
|
3
|
+
labelEachArea: boolean;
|
|
4
4
|
};
|
|
5
5
|
type TopLevelRoles = 'banner' | 'main' | 'complementary' | 'contentinfo';
|
|
6
6
|
type Roles = TopLevelRoles | 'form' | 'navigation' | 'region';
|
|
7
|
-
declare const _default: import(
|
|
7
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
|
|
8
8
|
export default _default;
|
|
@@ -72,7 +72,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
72
72
|
if (el.rule.disabled) {
|
|
73
73
|
continue;
|
|
74
74
|
}
|
|
75
|
-
if ((_a = el.rule.
|
|
75
|
+
if ((_a = el.rule.options.ignoreRoles) === null || _a === void 0 ? void 0 : _a.includes(role)) {
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
if (el.isDescendantByUUIDList(uuidList)) {
|
|
@@ -93,7 +93,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
93
93
|
if (el.rule.disabled) {
|
|
94
94
|
continue;
|
|
95
95
|
}
|
|
96
|
-
if (!el.rule.
|
|
96
|
+
if (!el.rule.options.labelEachArea) {
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
99
|
if (!hasLabel(el)) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
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(
|
|
1
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
|
|
2
2
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type Options = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
extendsExposableElements?: boolean;
|
|
3
|
+
ignoreIfAriaBusy?: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const _default: import(
|
|
5
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
|
|
6
6
|
export default _default;
|
|
@@ -12,14 +12,14 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
12
12
|
await document.walkOn('Element', el => {
|
|
13
13
|
if (!(0, ml_spec_1.isPalpableElement)(el, el.ownerMLDocument.specs, {
|
|
14
14
|
extendsSvg: false,
|
|
15
|
-
extendsExposableElements: el.rule.
|
|
15
|
+
extendsExposableElements: el.rule.options.extendsExposableElements,
|
|
16
16
|
})) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
if ((0, ml_spec_1.isNothingContentModel)(el)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
if (el.rule.
|
|
22
|
+
if (el.rule.options.ignoreIfAriaBusy && el.getAttribute('aria-busy') === 'true') {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const isEmpty = Array.from(el.childNodes).every(node => node.is(node.TEXT_NODE) && node.isWhitespace());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import(
|
|
1
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, null>;
|
|
2
2
|
export default _default;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ARIAVersion } from '@markuplint/ml-spec';
|
|
2
|
-
declare const _default: import(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ariaVersion: ARIAVersion;
|
|
6
|
-
}
|
|
7
|
-
>;
|
|
2
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, {
|
|
3
|
+
ariaVersion: ARIAVersion;
|
|
4
|
+
}>;
|
|
8
5
|
export default _default;
|
|
@@ -69,7 +69,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const { props } = (0, ml_core_1.ariaSpecs)(document.specs, attr.rule.
|
|
72
|
+
const { props } = (0, ml_core_1.ariaSpecs)(document.specs, attr.rule.options.ariaVersion);
|
|
73
73
|
const aria = props.find(prop => prop.name === name);
|
|
74
74
|
if (aria) {
|
|
75
75
|
if (aria.value === 'ID reference' && !idList.has(value)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type Options = {
|
|
2
|
-
|
|
2
|
+
ignore?: string | string[];
|
|
3
3
|
};
|
|
4
|
-
declare const _default: import(
|
|
4
|
+
declare const _default: import("@markuplint/ml-core").RuleSeed<boolean, Options>;
|
|
5
5
|
export default _default;
|
|
@@ -10,10 +10,10 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
10
10
|
if (attr.ownerElement.elementType !== 'html') {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
const ignoreList = Array.isArray(attr.rule.
|
|
14
|
-
? attr.rule.
|
|
15
|
-
: attr.rule.
|
|
16
|
-
? [attr.rule.
|
|
13
|
+
const ignoreList = Array.isArray(attr.rule.options.ignore)
|
|
14
|
+
? attr.rule.options.ignore
|
|
15
|
+
: attr.rule.options.ignore
|
|
16
|
+
? [attr.rule.options.ignore]
|
|
17
17
|
: [];
|
|
18
18
|
const name = attr.name;
|
|
19
19
|
for (const ignore of ignoreList) {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { ChildNode, Options, Result, Specs } from './types';
|
|
2
2
|
import type { PermittedContentChoice } from '@markuplint/ml-spec';
|
|
3
|
-
export declare function choice(
|
|
4
|
-
pattern: PermittedContentChoice,
|
|
5
|
-
elements: ChildNode[],
|
|
6
|
-
specs: Specs,
|
|
7
|
-
options: Options,
|
|
8
|
-
depth: number,
|
|
9
|
-
): Result;
|
|
3
|
+
export declare function choice(pattern: PermittedContentChoice, elements: ChildNode[], specs: Specs, options: Options, depth: number): Result;
|
|
@@ -10,10 +10,4 @@ import type { PermittedContentPattern } from '@markuplint/ml-spec';
|
|
|
10
10
|
* @param depth
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
export declare function complexBranch(
|
|
14
|
-
pattern: PermittedContentPattern,
|
|
15
|
-
elements: ChildNode[],
|
|
16
|
-
specs: Specs,
|
|
17
|
-
options: Options,
|
|
18
|
-
depth: number,
|
|
19
|
-
): Result;
|
|
13
|
+
export declare function complexBranch(pattern: PermittedContentPattern, elements: ChildNode[], specs: Specs, options: Options, depth: number): Result;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { ChildNode, Options, Result, Specs } from './types';
|
|
2
|
-
import type {
|
|
3
|
-
PermittedContentOneOrMore,
|
|
4
|
-
PermittedContentOptional,
|
|
5
|
-
PermittedContentRequire,
|
|
6
|
-
PermittedContentZeroOrMore,
|
|
7
|
-
} from '@markuplint/ml-spec';
|
|
2
|
+
import type { PermittedContentOneOrMore, PermittedContentOptional, PermittedContentRequire, PermittedContentZeroOrMore } from '@markuplint/ml-spec';
|
|
8
3
|
/**
|
|
9
4
|
* Check count
|
|
10
5
|
*
|
|
@@ -15,14 +10,4 @@ import type {
|
|
|
15
10
|
* @param depth
|
|
16
11
|
* @returns
|
|
17
12
|
*/
|
|
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;
|
|
13
|
+
export declare function countPattern(pattern: PermittedContentOneOrMore | PermittedContentOptional | PermittedContentRequire | PermittedContentZeroOrMore, elements: readonly ChildNode[], specs: Specs, options: Options, depth: number): Result;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="debug" />
|
|
2
|
-
export declare const cmLog: import(
|
|
2
|
+
export declare const cmLog: import("debug").Debugger;
|
|
@@ -14,10 +14,10 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
14
14
|
if (!el.rule.value) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
if (el.rule.
|
|
17
|
+
if (el.rule.options.ignoreHasMutableChildren && el.hasMutableChildren()) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const results = (0, content_model_1.contentModel)(el, el.rule.value, el.rule.
|
|
20
|
+
const results = (0, content_model_1.contentModel)(el, el.rule.value, el.rule.options);
|
|
21
21
|
for (const { type, scope, query, hint } of results) {
|
|
22
22
|
let message = '';
|
|
23
23
|
if (hint) {
|
|
@@ -75,10 +75,10 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
75
75
|
});
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
|
-
case '
|
|
78
|
+
case 'NOTHING': {
|
|
79
79
|
report({
|
|
80
80
|
scope: el,
|
|
81
|
-
message: t('{0}
|
|
81
|
+
message: t('{0} disallows {1}', t('the {0}', 'element'), 'contents'),
|
|
82
82
|
});
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { ChildNode, Options, 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, options: Options, depth: number): SelectorResult;
|
|
@@ -10,10 +10,4 @@ import type { PermittedContentPattern } from '@markuplint/ml-spec';
|
|
|
10
10
|
* @param depth
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
export declare function order(
|
|
14
|
-
contents: ReadonlyArray<PermittedContentPattern>,
|
|
15
|
-
nodes: ReadonlyArray<ChildNode>,
|
|
16
|
-
specs: Specs,
|
|
17
|
-
options: Options,
|
|
18
|
-
depth: number,
|
|
19
|
-
): Result;
|
|
13
|
+
export declare function order(contents: ReadonlyArray<PermittedContentPattern>, nodes: ReadonlyArray<ChildNode>, specs: Specs, options: Options, depth: number): Result;
|
|
@@ -1,10 +1,4 @@
|
|
|
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
|
+
export declare function recursiveBranch(model: Model | PermittedContentPattern[], nodes: readonly ChildNode[], specs: Specs, options: Options, depth: number): SelectorResult;
|
|
@@ -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
|
-
|
|
5
|
-
|
|
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
|
};
|
|
@@ -9,9 +9,4 @@ import type { ContentModel } from '@markuplint/ml-spec';
|
|
|
9
9
|
* @param options
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
export declare function start(
|
|
13
|
-
contents: ContentModel['contents'],
|
|
14
|
-
el: Element,
|
|
15
|
-
specs: Specs,
|
|
16
|
-
options: Options,
|
|
17
|
-
): ContentModelResult[];
|
|
12
|
+
export declare function start(contents: ContentModel['contents'], el: Element, specs: Specs, options: Options): ContentModelResult[];
|