@markuplint/rules 3.5.0 → 3.6.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.
- package/lib/attr-check.d.ts +19 -8
- package/lib/attr-check.js +19 -22
- package/lib/attr-duplication/index.d.ts +3 -1
- package/lib/attr-duplication/index.js +2 -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/class-naming/index.js +2 -4
- package/lib/create-message.d.ts +12 -2
- package/lib/create-message.js +5 -4
- package/lib/deprecated-attr/index.d.ts +3 -1
- package/lib/deprecated-element/index.d.ts +3 -1
- package/lib/deprecated-element/index.js +2 -2
- 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 +0 -1
- package/lib/helpers.js +8 -9
- package/lib/id-duplication/index.d.ts +3 -1
- package/lib/index.d.ts +172 -67
- package/lib/ineffective-attr/index.d.ts +3 -1
- package/lib/ineffective-attr/index.js +2 -5
- package/lib/invalid-attr/index.d.ts +17 -13
- package/lib/invalid-attr/index.js +8 -8
- package/lib/label-has-control/index.d.ts +3 -1
- package/lib/landmark-roles/index.d.ts +3 -3
- package/lib/landmark-roles/index.js +1 -1
- package/lib/no-boolean-attr-value/index.d.ts +3 -1
- package/lib/no-default-value/index.d.ts +3 -1
- package/lib/no-empty-palpable-content/index.d.ts +3 -3
- package/lib/no-hard-code-id/index.d.ts +3 -1
- package/lib/no-refer-to-non-existent-id/index.d.ts +9 -4
- package/lib/no-refer-to-non-existent-id/index.js +4 -14
- package/lib/no-use-event-handler-attr/index.d.ts +2 -2
- package/lib/permitted-contents/choice.d.ts +7 -1
- package/lib/permitted-contents/complex-branch.d.ts +7 -1
- package/lib/permitted-contents/content-model.js +1 -1
- package/lib/permitted-contents/count-pattern.d.ts +17 -2
- package/lib/permitted-contents/count-pattern.js +1 -1
- package/lib/permitted-contents/debug.browser.d.ts +15 -15
- package/lib/permitted-contents/debug.d.ts +1 -1
- package/lib/permitted-contents/index.d.ts +1 -1
- package/lib/permitted-contents/index.js +5 -10
- package/lib/permitted-contents/matches-selector.d.ts +6 -1
- package/lib/permitted-contents/matches-selector.js +1 -1
- package/lib/permitted-contents/order.d.ts +7 -1
- package/lib/permitted-contents/order.js +4 -4
- package/lib/permitted-contents/recursive-branch.d.ts +7 -1
- package/lib/permitted-contents/represent-transparent-nodes.d.ts +7 -3
- package/lib/permitted-contents/represent-transparent-nodes.js +1 -1
- package/lib/permitted-contents/start.d.ts +6 -1
- package/lib/permitted-contents/start.js +1 -1
- package/lib/permitted-contents/types.d.ts +29 -29
- package/lib/permitted-contents/utils.js +3 -3
- package/lib/placeholder-label-option/index.d.ts +1 -1
- package/lib/placeholder-label-option/index.js +5 -4
- package/lib/require-accessible-name/index.d.ts +2 -2
- package/lib/require-datetime/index.d.ts +2 -2
- package/lib/require-datetime/types.d.ts +2 -2
- package/lib/require-datetime/utils.js +3 -2
- package/lib/required-attr/index.d.ts +3 -3
- package/lib/required-attr/index.js +4 -4
- package/lib/required-element/index.d.ts +2 -2
- package/lib/required-h1/index.d.ts +3 -3
- package/lib/use-list/index.d.ts +2 -2
- package/lib/use-list/index.js +4 -3
- package/lib/wai-aria/checkings/default-value.d.ts +7 -3
- package/lib/wai-aria/checkings/deprecated-props.d.ts +8 -4
- package/lib/wai-aria/checkings/disallowed-prop.js +1 -1
- package/lib/wai-aria/checkings/implicit-props.d.ts +8 -4
- package/lib/wai-aria/checkings/implicit-props.js +3 -2
- package/lib/wai-aria/checkings/no-global-prop.d.ts +7 -3
- package/lib/wai-aria/checkings/required-owned-elements.d.ts +7 -3
- package/lib/wai-aria/checkings/required-owned-elements.js +1 -1
- package/lib/wai-aria/checkings/required-prop.d.ts +12 -6
- package/lib/wai-aria/checkings/value.d.ts +15 -6
- package/lib/wai-aria/checkings/value.js +3 -1
- package/lib/wai-aria/index.d.ts +1 -1
- package/lib/wai-aria/types.d.ts +10 -10
- package/package.json +8 -8
package/lib/attr-check.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { Translator } from '@markuplint/i18n';
|
|
|
2
2
|
import type { Attribute as AttrSpec, AttributeType } from '@markuplint/ml-spec';
|
|
3
3
|
import type { ReadonlyDeep } from 'type-fest';
|
|
4
4
|
type Invalid = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
invalidType: 'non-existent' | 'invalid-value' | 'disallowed-attr';
|
|
6
|
+
message: string;
|
|
7
|
+
loc?: Loc;
|
|
8
8
|
};
|
|
9
9
|
type Loc = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
raw: string;
|
|
11
|
+
line: number;
|
|
12
|
+
col: number;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Use in rules `invalid-attr` and `wai-aria`
|
|
@@ -19,6 +19,17 @@ type Loc = {
|
|
|
19
19
|
* @param isCustomRule
|
|
20
20
|
* @param spec
|
|
21
21
|
*/
|
|
22
|
-
export declare function attrCheck(
|
|
23
|
-
|
|
22
|
+
export declare function attrCheck(
|
|
23
|
+
t: Translator,
|
|
24
|
+
name: string,
|
|
25
|
+
value: string,
|
|
26
|
+
isCustomRule: boolean,
|
|
27
|
+
spec?: AttrSpec,
|
|
28
|
+
): Invalid | false;
|
|
29
|
+
export declare function valueCheck(
|
|
30
|
+
t: Translator,
|
|
31
|
+
name: string,
|
|
32
|
+
value: string,
|
|
33
|
+
type: ReadonlyDeep<AttributeType>,
|
|
34
|
+
): [string, Loc] | false;
|
|
24
35
|
export {};
|
package/lib/attr-check.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.valueCheck = exports.attrCheck = void 0;
|
|
4
|
+
const shared_1 = require("@markuplint/shared");
|
|
4
5
|
const types_1 = require("@markuplint/types");
|
|
5
6
|
const create_message_1 = require("./create-message");
|
|
6
7
|
const debug_1 = require("./debug");
|
|
@@ -53,35 +54,31 @@ function attrCheck(t, name, value, isCustomRule, spec) {
|
|
|
53
54
|
message: t('{0} is {1:c}', t('the "{0*}" {1}', name, 'attribute'), 'disallowed'),
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
|
-
const types =
|
|
57
|
+
const types = (0, shared_1.toNonNullableArrayFromItemOrArray)(spec.type);
|
|
57
58
|
const invalidList = types.map(type => {
|
|
58
|
-
if (!type) {
|
|
59
|
-
(0, debug_1.log)('attrCheck: %o', arguments);
|
|
60
|
-
throw new Error('type is empty in spec');
|
|
61
|
-
}
|
|
62
59
|
const invalid = valueCheck(t, name, value, type);
|
|
63
|
-
if (invalid) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
if (invalid === false) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (typeof invalid === 'string') {
|
|
64
|
+
return {
|
|
65
|
+
invalidType: 'invalid-value',
|
|
66
|
+
message: invalid,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return {
|
|
71
|
+
invalidType: 'invalid-value',
|
|
72
|
+
message: invalid[0],
|
|
73
|
+
loc: invalid[1],
|
|
74
|
+
};
|
|
77
75
|
}
|
|
78
|
-
return false;
|
|
79
76
|
});
|
|
80
|
-
if (invalidList.some(i =>
|
|
77
|
+
if (invalidList.some(i => i === false)) {
|
|
81
78
|
return false;
|
|
82
79
|
}
|
|
83
80
|
const invalid = invalidList.find(i => i);
|
|
84
|
-
return invalid
|
|
81
|
+
return invalid !== null && invalid !== void 0 ? invalid : false;
|
|
85
82
|
}
|
|
86
83
|
exports.attrCheck = attrCheck;
|
|
87
84
|
function valueCheck(t, name, value, type) {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: Readonly<
|
|
1
|
+
declare const _default: Readonly<
|
|
2
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
3
|
+
>;
|
|
2
4
|
export default _default;
|
|
@@ -5,6 +5,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
5
5
|
async verify({ document, report, t }) {
|
|
6
6
|
const message = t('{0} is {1:c}', t('the {0}', 'attribute name'), 'duplicated');
|
|
7
7
|
await document.walkOn('Element', node => {
|
|
8
|
+
var _a;
|
|
8
9
|
const attrNameStack = [];
|
|
9
10
|
for (const attr of node.getAttributeTokens()) {
|
|
10
11
|
if (attr.isDuplicatable) {
|
|
@@ -13,7 +14,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
13
14
|
const attrName = attr.name;
|
|
14
15
|
const name = node.elementType === 'html' ? attrName.toLowerCase() : attrName;
|
|
15
16
|
if (attrNameStack.includes(name)) {
|
|
16
|
-
const scope = attr.nameNode
|
|
17
|
+
const scope = (_a = attr.nameNode) !== null && _a !== void 0 ? _a : attr;
|
|
17
18
|
report({
|
|
18
19
|
scope: {
|
|
19
20
|
rule: node.rule,
|
|
@@ -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: Readonly<import(
|
|
6
|
+
declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<Type, undefined>>;
|
|
7
7
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RuleConfigValue } from '@markuplint/ml-config';
|
|
2
|
-
declare const _default: Readonly<import(
|
|
2
|
+
declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<RuleConfigValue, undefined>>;
|
|
3
3
|
export default _default;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ml_core_1 = require("@markuplint/ml-core");
|
|
4
|
+
const shared_1 = require("@markuplint/shared");
|
|
4
5
|
const helpers_1 = require("../helpers");
|
|
5
6
|
exports.default = (0, ml_core_1.createRule)({
|
|
6
7
|
defaultSeverity: 'warning',
|
|
7
8
|
defaultValue: null,
|
|
8
9
|
async verify({ document, report, t }) {
|
|
9
10
|
await document.walkOn('Element', el => {
|
|
10
|
-
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const classPatterns = (Array.isArray(el.rule.value) ? el.rule.value : [el.rule.value]).filter(className => className && typeof className === 'string');
|
|
11
|
+
const classPatterns = (0, shared_1.toNoEmptyStringArrayFromStringOrArray)(el.rule.value).filter(className => className && typeof className === 'string');
|
|
14
12
|
const attrs = el.getAttributeToken('class');
|
|
15
13
|
for (const attr of attrs) {
|
|
16
14
|
if (attr.isDynamicValue) {
|
package/lib/create-message.d.ts
CHANGED
|
@@ -2,5 +2,15 @@ import type { Translator } from '@markuplint/i18n';
|
|
|
2
2
|
import type { AttributeType } from '@markuplint/ml-spec';
|
|
3
3
|
import type { UnmatchedResult } from '@markuplint/types';
|
|
4
4
|
import type { ReadonlyDeep } from 'type-fest';
|
|
5
|
-
export declare function createMessageValueExpected(
|
|
6
|
-
|
|
5
|
+
export declare function createMessageValueExpected(
|
|
6
|
+
t: Translator,
|
|
7
|
+
baseTarget: string,
|
|
8
|
+
type: ReadonlyDeep<AttributeType>,
|
|
9
|
+
matches: UnmatchedResult,
|
|
10
|
+
): string;
|
|
11
|
+
export declare function __createMessageValueExpected(
|
|
12
|
+
t: Translator,
|
|
13
|
+
baseTarget: string,
|
|
14
|
+
expected: string | null,
|
|
15
|
+
matches: Pick<UnmatchedResult, 'partName' | 'reason' | 'raw' | 'candidate' | 'ref' | 'extra'>,
|
|
16
|
+
): string;
|
package/lib/create-message.js
CHANGED
|
@@ -22,6 +22,7 @@ function createMessageValueExpected(t, baseTarget, type, matches) {
|
|
|
22
22
|
}
|
|
23
23
|
exports.createMessageValueExpected = createMessageValueExpected;
|
|
24
24
|
function __createMessageValueExpected(t, baseTarget, expected, matches) {
|
|
25
|
+
var _a;
|
|
25
26
|
let target = baseTarget;
|
|
26
27
|
let reasonPart;
|
|
27
28
|
let expectPart;
|
|
@@ -51,7 +52,7 @@ function __createMessageValueExpected(t, baseTarget, expected, matches) {
|
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
54
|
case 'extra-token': {
|
|
54
|
-
const token = matches.partName
|
|
55
|
+
const token = (_a = matches.partName) !== null && _a !== void 0 ? _a : 'token';
|
|
55
56
|
reasonPart = t('Found {0}', t('extra {0}', token)) + ' ' + t([matches.raw]);
|
|
56
57
|
if (matches.extra) {
|
|
57
58
|
const extra = expectValueToWord(t, matches.extra, 'Any');
|
|
@@ -199,9 +200,9 @@ function __createMessageValueExpected(t, baseTarget, expected, matches) {
|
|
|
199
200
|
}
|
|
200
201
|
exports.__createMessageValueExpected = __createMessageValueExpected;
|
|
201
202
|
function createExpectedObject(type, matches, t) {
|
|
202
|
-
var _a
|
|
203
|
+
var _a;
|
|
203
204
|
const expectedObject = [];
|
|
204
|
-
if (
|
|
205
|
+
if (matches.expects && matches.expects.length > 0) {
|
|
205
206
|
expectedObject.push(...matches.expects.map(expect => {
|
|
206
207
|
return expectValueToWord(t, expect, type);
|
|
207
208
|
}));
|
|
@@ -221,7 +222,7 @@ function createExpectedObject(type, matches, t) {
|
|
|
221
222
|
? null
|
|
222
223
|
: 1 < expectedObject.length
|
|
223
224
|
? t('either {0}', t(expectedObject))
|
|
224
|
-
: (
|
|
225
|
+
: (_a = expectedObject[0]) !== null && _a !== void 0 ? _a : null;
|
|
225
226
|
return expects;
|
|
226
227
|
}
|
|
227
228
|
function expectValueToWord(t, expect, type) {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: Readonly<
|
|
1
|
+
declare const _default: Readonly<
|
|
2
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
3
|
+
>;
|
|
2
4
|
export default _default;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: Readonly<
|
|
1
|
+
declare const _default: Readonly<
|
|
2
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
3
|
+
>;
|
|
2
4
|
export default _default;
|
|
@@ -10,8 +10,8 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const spec = (0, ml_core_1.getSpec)(el, document.specs.specs);
|
|
13
|
-
if (spec && (spec.obsolete || spec.deprecated || spec.nonStandard)) {
|
|
14
|
-
const message = t('{0} is {1:c}', t('the "{0*}" {1}', el.localName, 'element'), spec.deprecated ? 'deprecated' : spec.obsolete ? 'obsolete' : 'non-standard');
|
|
13
|
+
if (spec && (spec.obsolete != null || spec.deprecated || spec.nonStandard)) {
|
|
14
|
+
const message = t('{0} is {1:c}', t('the "{0*}" {1}', el.localName, 'element'), spec.deprecated ? 'deprecated' : spec.obsolete != null ? 'obsolete' : 'non-standard');
|
|
15
15
|
report({
|
|
16
16
|
scope: el,
|
|
17
17
|
message,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: Readonly<import(
|
|
1
|
+
declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<string[], undefined>>;
|
|
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: Readonly<import(
|
|
4
|
+
declare const _default: Readonly<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: Readonly<import(
|
|
1
|
+
declare const _default: Readonly<import('@markuplint/ml-core').RuleSeed<boolean, undefined>>;
|
|
2
2
|
export default _default;
|
package/lib/helpers.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export declare function isValidAttr(t: Translator, name: string, value: string,
|
|
|
33
33
|
export declare function toNormalizedValue(value: string, spec: Attribute): string;
|
|
34
34
|
export declare function accnameMayBeMutable(el: Element<any, any>, document: Document<any, any>): boolean;
|
|
35
35
|
export declare function getOwnedLabel<V extends RuleConfigValue, O extends PlainData>(el: Element<V, O>, document: Document<V, O>): Element<V, O> | null;
|
|
36
|
-
export declare function decodeCharRef(characterReference: string): string;
|
|
37
36
|
export declare class Collection<T> {
|
|
38
37
|
#private;
|
|
39
38
|
constructor(...items: readonly (T | null | undefined)[]);
|
package/lib/helpers.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _Collection_items;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.deepCopy = exports.Collection = exports.
|
|
4
|
+
exports.deepCopy = exports.Collection = exports.getOwnedLabel = exports.accnameMayBeMutable = exports.toNormalizedValue = exports.isValidAttr = exports.rePCENChar = exports.match = exports.attrMatches = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
const structured_clone_1 = tslib_1.__importDefault(require("@ungap/structured-clone"));
|
|
8
|
-
const html_entities_1 = require("html-entities");
|
|
9
8
|
const attr_check_1 = require("./attr-check");
|
|
10
9
|
function attrMatches(
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
12
11
|
node, condition) {
|
|
13
|
-
if (
|
|
12
|
+
if (condition == null) {
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
15
|
const condSelector = typeof condition === 'string' ? condition : condition.join(',');
|
|
@@ -71,13 +70,17 @@ log) {
|
|
|
71
70
|
const spec = attrSpecs.find(s => s.name.toLowerCase() === name.toLowerCase());
|
|
72
71
|
log && log('Spec of the %s attr: %o', name, spec);
|
|
73
72
|
invalid = (0, attr_check_1.attrCheck)(t, name, value, false, spec);
|
|
74
|
-
if (
|
|
73
|
+
if (invalid === false &&
|
|
74
|
+
spec &&
|
|
75
|
+
spec.condition != null &&
|
|
76
|
+
!node.hasSpreadAttr &&
|
|
77
|
+
!attrMatches(node, spec.condition)) {
|
|
75
78
|
invalid = {
|
|
76
79
|
invalidType: 'non-existent',
|
|
77
80
|
message: t('{0} is {1}', t('the "{0*}" {1}', name, 'attribute'), 'disallowed'),
|
|
78
81
|
};
|
|
79
82
|
}
|
|
80
|
-
if (invalid && invalid.invalidType === 'invalid-value' && isDynamicValue) {
|
|
83
|
+
if (invalid !== false && invalid.invalidType === 'invalid-value' && isDynamicValue) {
|
|
81
84
|
invalid = false;
|
|
82
85
|
}
|
|
83
86
|
return invalid;
|
|
@@ -146,10 +149,6 @@ document) {
|
|
|
146
149
|
return ownedLabel;
|
|
147
150
|
}
|
|
148
151
|
exports.getOwnedLabel = getOwnedLabel;
|
|
149
|
-
function decodeCharRef(characterReference) {
|
|
150
|
-
return (0, html_entities_1.decode)(characterReference);
|
|
151
|
-
}
|
|
152
|
-
exports.decodeCharRef = decodeCharRef;
|
|
153
152
|
class Collection {
|
|
154
153
|
constructor(...items) {
|
|
155
154
|
_Collection_items.set(this, new Set());
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: Readonly<
|
|
1
|
+
declare const _default: Readonly<
|
|
2
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
3
|
+
>;
|
|
2
4
|
export default _default;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,70 +1,175 @@
|
|
|
1
1
|
declare const rules: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
2
|
+
readonly 'attr-duplication': Readonly<
|
|
3
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
4
|
+
>;
|
|
5
|
+
readonly 'attr-value-quotes': Readonly<
|
|
6
|
+
import('@markuplint/ml-core').RuleSeed<import('./attr-value-quotes').Type, undefined>
|
|
7
|
+
>;
|
|
8
|
+
readonly 'case-sensitive-attr-name': Readonly<
|
|
9
|
+
import('@markuplint/ml-core').RuleSeed<import('./case-sensitive-attr-name').Value, undefined>
|
|
10
|
+
>;
|
|
11
|
+
readonly 'case-sensitive-tag-name': Readonly<
|
|
12
|
+
import('@markuplint/ml-core').RuleSeed<import('./case-sensitive-tag-name').Value, undefined>
|
|
13
|
+
>;
|
|
14
|
+
readonly 'character-reference': Readonly<
|
|
15
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
16
|
+
>;
|
|
17
|
+
readonly 'class-naming': Readonly<
|
|
18
|
+
import('@markuplint/ml-core').RuleSeed<import('./class-naming').Value, undefined>
|
|
19
|
+
>;
|
|
20
|
+
readonly 'deprecated-attr': Readonly<
|
|
21
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
22
|
+
>;
|
|
23
|
+
readonly 'deprecated-element': Readonly<
|
|
24
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
25
|
+
>;
|
|
26
|
+
readonly 'disallowed-element': Readonly<import('@markuplint/ml-core').RuleSeed<string[], undefined>>;
|
|
27
|
+
readonly doctype: Readonly<
|
|
28
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
29
|
+
'always',
|
|
30
|
+
{
|
|
31
|
+
denyObsoleteType: boolean;
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
>;
|
|
35
|
+
readonly 'end-tag': Readonly<import('@markuplint/ml-core').RuleSeed<boolean, undefined>>;
|
|
36
|
+
readonly 'id-duplication': Readonly<
|
|
37
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
38
|
+
>;
|
|
39
|
+
readonly 'ineffective-attr': Readonly<
|
|
40
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
41
|
+
>;
|
|
42
|
+
readonly 'invalid-attr': Readonly<
|
|
43
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
44
|
+
boolean,
|
|
45
|
+
{
|
|
46
|
+
attrs?:
|
|
47
|
+
| Record<
|
|
48
|
+
string,
|
|
49
|
+
| {
|
|
50
|
+
enum: [string, ...string[]];
|
|
51
|
+
}
|
|
52
|
+
| {
|
|
53
|
+
pattern: string;
|
|
54
|
+
}
|
|
55
|
+
| {
|
|
56
|
+
type: import('packages/@markuplint/ml-spec/lib').AttributeType;
|
|
57
|
+
}
|
|
58
|
+
| {
|
|
59
|
+
disallowed: true;
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
| undefined;
|
|
63
|
+
ignoreAttrNamePrefix?: string | string[] | undefined;
|
|
64
|
+
allowToAddPropertiesForPretender?: boolean | undefined;
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
>;
|
|
68
|
+
readonly 'label-has-control': Readonly<
|
|
69
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
70
|
+
>;
|
|
71
|
+
readonly 'landmark-roles': Readonly<
|
|
72
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
73
|
+
boolean,
|
|
74
|
+
{
|
|
75
|
+
ignoreRoles: (
|
|
76
|
+
| ('banner' | 'main' | 'complementary' | 'contentinfo')
|
|
77
|
+
| 'form'
|
|
78
|
+
| 'navigation'
|
|
79
|
+
| 'region'
|
|
80
|
+
)[];
|
|
81
|
+
labelEachArea: boolean;
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
>;
|
|
85
|
+
readonly 'no-boolean-attr-value': Readonly<
|
|
86
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
87
|
+
>;
|
|
88
|
+
readonly 'no-default-value': Readonly<
|
|
89
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
90
|
+
>;
|
|
91
|
+
readonly 'no-empty-palpable-content': Readonly<
|
|
92
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
93
|
+
boolean,
|
|
94
|
+
{
|
|
95
|
+
extendsExposableElements?: boolean | undefined;
|
|
96
|
+
ignoreIfAriaBusy?: boolean | undefined;
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
>;
|
|
100
|
+
readonly 'no-hard-code-id': Readonly<
|
|
101
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
102
|
+
>;
|
|
103
|
+
readonly 'no-refer-to-non-existent-id': Readonly<
|
|
104
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
105
|
+
import('@markuplint/ml-core').RuleConfigValue,
|
|
106
|
+
{
|
|
107
|
+
ariaVersion: import('packages/@markuplint/ml-spec/lib').ARIAVersion;
|
|
108
|
+
fragmentRefersNameAttr: boolean;
|
|
109
|
+
}
|
|
110
|
+
>
|
|
111
|
+
>;
|
|
112
|
+
readonly 'no-use-event-handler-attr': Readonly<
|
|
113
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
114
|
+
boolean,
|
|
115
|
+
{
|
|
116
|
+
ignore?: string | string[] | undefined;
|
|
117
|
+
}
|
|
118
|
+
>
|
|
119
|
+
>;
|
|
120
|
+
readonly 'permitted-contents': Readonly<
|
|
121
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
122
|
+
import('./permitted-contents/types').TagRule[],
|
|
123
|
+
import('./permitted-contents/types').Options
|
|
124
|
+
>
|
|
125
|
+
>;
|
|
126
|
+
readonly 'placeholder-label-option': Readonly<import('@markuplint/ml-core').RuleSeed<boolean, undefined>>;
|
|
127
|
+
readonly 'require-accessible-name': Readonly<
|
|
128
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
129
|
+
boolean,
|
|
130
|
+
{
|
|
131
|
+
ariaVersion: import('packages/@markuplint/ml-spec/lib').ARIAVersion;
|
|
132
|
+
}
|
|
133
|
+
>
|
|
134
|
+
>;
|
|
135
|
+
readonly 'require-datetime': Readonly<
|
|
136
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
137
|
+
boolean,
|
|
138
|
+
{
|
|
139
|
+
langs?: import('./require-datetime/types').Lang[] | undefined;
|
|
140
|
+
}
|
|
141
|
+
>
|
|
142
|
+
>;
|
|
143
|
+
readonly 'required-attr': Readonly<
|
|
144
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
145
|
+
| string
|
|
146
|
+
| (
|
|
147
|
+
| string
|
|
148
|
+
| {
|
|
149
|
+
name: string;
|
|
150
|
+
value: string | string[];
|
|
151
|
+
}
|
|
152
|
+
)[],
|
|
153
|
+
undefined
|
|
154
|
+
>
|
|
155
|
+
>;
|
|
156
|
+
readonly 'required-element': Readonly<
|
|
157
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
158
|
+
string[],
|
|
159
|
+
{
|
|
160
|
+
ignoreHasMutableContents: boolean;
|
|
161
|
+
}
|
|
162
|
+
>
|
|
163
|
+
>;
|
|
164
|
+
readonly 'required-h1': Readonly<import('@markuplint/ml-core').RuleSeed<boolean, import('./required-h1').Options>>;
|
|
165
|
+
readonly 'use-list': Readonly<
|
|
166
|
+
import('@markuplint/ml-core').RuleSeed<
|
|
167
|
+
readonly string[],
|
|
168
|
+
{
|
|
169
|
+
spaceNeededBullets?: string[] | undefined;
|
|
170
|
+
}
|
|
171
|
+
>
|
|
172
|
+
>;
|
|
173
|
+
readonly 'wai-aria': Readonly<import('@markuplint/ml-core').RuleSeed<boolean, import('./wai-aria/types').Options>>;
|
|
69
174
|
};
|
|
70
175
|
export default rules;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare const _default: Readonly<
|
|
1
|
+
declare const _default: Readonly<
|
|
2
|
+
import('@markuplint/ml-core').RuleSeed<import('@markuplint/ml-core').RuleConfigValue, undefined>
|
|
3
|
+
>;
|
|
2
4
|
export default _default;
|
|
@@ -1,6 +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 shared_1 = require("@markuplint/shared");
|
|
4
5
|
exports.default = (0, ml_core_1.createRule)({
|
|
5
6
|
defaultSeverity: 'warning',
|
|
6
7
|
async verify({ document, report, t }) {
|
|
@@ -14,11 +15,7 @@ exports.default = (0, ml_core_1.createRule)({
|
|
|
14
15
|
if (!spec) {
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
const ineffectiveConditions = spec.ineffective
|
|
18
|
-
? Array.isArray(spec.ineffective)
|
|
19
|
-
? spec.ineffective
|
|
20
|
-
: [spec.ineffective]
|
|
21
|
-
: [];
|
|
18
|
+
const ineffectiveConditions = (0, shared_1.toNoEmptyStringArrayFromStringOrArray)(spec.ineffective);
|
|
22
19
|
if (ineffectiveConditions.some(selector => attr.ownerElement.matches(selector))) {
|
|
23
20
|
report({
|
|
24
21
|
scope: attr,
|