@markuplint/rules 2.0.0-dev.23 → 2.0.0-rc.5
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 -1
- package/lib/attr-check.js +53 -455
- package/lib/attr-duplication/index.d.ts +1 -1
- package/lib/attr-duplication/index.js +0 -2
- package/lib/attr-equal-space-after/index.js +0 -1
- package/lib/attr-equal-space-before/index.js +0 -1
- package/lib/attr-spacing/index.js +0 -1
- package/lib/attr-value-quotes/index.js +0 -1
- package/lib/case-sensitive-attr-name/index.d.ts +6 -2
- package/lib/case-sensitive-attr-name/index.js +30 -8
- package/lib/case-sensitive-tag-name/index.js +0 -1
- package/lib/character-reference/index.d.ts +1 -2
- package/lib/character-reference/index.js +0 -2
- package/lib/class-naming/index.js +23 -23
- package/lib/create-message.d.ts +5 -0
- package/lib/create-message.js +270 -0
- package/lib/debug.d.ts +3 -0
- package/lib/debug.js +6 -0
- package/lib/deprecated-attr/index.d.ts +1 -1
- package/lib/deprecated-attr/index.js +2 -5
- package/lib/deprecated-element/index.d.ts +1 -1
- package/lib/deprecated-element/index.js +1 -3
- package/lib/disallowed-element/index.d.ts +2 -0
- package/lib/disallowed-element/index.js +34 -0
- package/lib/helpers.d.ts +15 -9
- package/lib/helpers.js +63 -68
- package/lib/id-duplication/index.d.ts +1 -1
- package/lib/id-duplication/index.js +1 -3
- package/lib/index.d.ts +28 -11
- package/lib/index.js +16 -0
- package/lib/ineffective-attr/index.d.ts +2 -0
- package/lib/ineffective-attr/index.js +40 -0
- package/lib/invalid-attr/index.d.ts +4 -2
- package/lib/invalid-attr/index.js +25 -9
- package/lib/landmark-roles/index.js +1 -2
- package/lib/no-boolean-attr-value/index.d.ts +2 -0
- package/lib/no-boolean-attr-value/index.js +47 -0
- package/lib/no-default-value/index.d.ts +2 -0
- package/lib/no-default-value/index.js +38 -0
- package/lib/no-hard-code-id/index.d.ts +2 -0
- package/lib/no-hard-code-id/index.js +27 -0
- package/lib/no-refer-to-non-existent-id/index.d.ts +2 -0
- package/lib/no-refer-to-non-existent-id/index.js +110 -0
- package/lib/no-use-event-handler-attr/index.d.ts +5 -0
- package/lib/no-use-event-handler-attr/index.js +37 -0
- package/lib/permitted-contents/index.js +24 -13
- package/lib/permitted-contents/types.d.ts +8 -0
- package/lib/permitted-contents/types.js +2 -0
- package/lib/require-element/index.d.ts +2 -0
- package/lib/require-element/index.js +38 -0
- package/lib/required-attr/index.d.ts +5 -1
- package/lib/required-attr/index.js +60 -19
- package/lib/required-element/index.d.ts +5 -0
- package/lib/required-element/index.js +44 -0
- package/lib/required-h1/index.d.ts +2 -3
- package/lib/required-h1/index.js +2 -3
- package/lib/wai-aria/index.d.ts +1 -1
- package/lib/wai-aria/index.js +23 -24
- package/package.json +10 -5
- package/schema.json +24 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/primitive-check.d.ts +0 -48
- package/lib/primitive-check.js +0 -109
package/lib/primitive-check.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#signed-integers
|
|
3
|
-
*
|
|
4
|
-
* @param value
|
|
5
|
-
*/
|
|
6
|
-
export declare function intCheck(value: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#non-negative-integers
|
|
9
|
-
*
|
|
10
|
-
* @param value
|
|
11
|
-
*/
|
|
12
|
-
export declare function uintCheck(value: string): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#floating-point-numbers
|
|
15
|
-
*
|
|
16
|
-
* @param value
|
|
17
|
-
*/
|
|
18
|
-
export declare function floatCheck(value: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Non-negative integer greater than zero
|
|
21
|
-
*
|
|
22
|
-
* @param value
|
|
23
|
-
*/
|
|
24
|
-
export declare function nonZeroUintCheck(value: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* It is in the range between `from` and `to`.
|
|
27
|
-
*
|
|
28
|
-
* @param value
|
|
29
|
-
* @param from
|
|
30
|
-
* @param to
|
|
31
|
-
*/
|
|
32
|
-
export declare function range(value: string, from: number, to: number): boolean;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param value
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
export declare function splitUnit(value: string): {
|
|
39
|
-
num: string;
|
|
40
|
-
unit: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param value
|
|
45
|
-
* @param units
|
|
46
|
-
* @param numberType
|
|
47
|
-
*/
|
|
48
|
-
export declare function numberCheckWithUnit(value: string, units: string[], numberType?: 'int' | 'uint' | 'float'): boolean;
|
package/lib/primitive-check.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.numberCheckWithUnit = exports.splitUnit = exports.range = exports.nonZeroUintCheck = exports.floatCheck = exports.uintCheck = exports.intCheck = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#signed-integers
|
|
6
|
-
*
|
|
7
|
-
* @param value
|
|
8
|
-
*/
|
|
9
|
-
function intCheck(value) {
|
|
10
|
-
return /^-?[0-9]+$/.test(value);
|
|
11
|
-
}
|
|
12
|
-
exports.intCheck = intCheck;
|
|
13
|
-
/**
|
|
14
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#non-negative-integers
|
|
15
|
-
*
|
|
16
|
-
* @param value
|
|
17
|
-
*/
|
|
18
|
-
function uintCheck(value) {
|
|
19
|
-
return /^[0-9]+$/.test(value);
|
|
20
|
-
}
|
|
21
|
-
exports.uintCheck = uintCheck;
|
|
22
|
-
/**
|
|
23
|
-
* @see https://html.spec.whatwg.org/dev/common-microsyntaxes.html#floating-point-numbers
|
|
24
|
-
*
|
|
25
|
-
* @param value
|
|
26
|
-
*/
|
|
27
|
-
function floatCheck(value) {
|
|
28
|
-
return value === value.trim() && Number.isFinite(parseFloat(value));
|
|
29
|
-
}
|
|
30
|
-
exports.floatCheck = floatCheck;
|
|
31
|
-
/**
|
|
32
|
-
* Non-negative integer greater than zero
|
|
33
|
-
*
|
|
34
|
-
* @param value
|
|
35
|
-
*/
|
|
36
|
-
function nonZeroUintCheck(value) {
|
|
37
|
-
return /^[0-9]+$/.test(value) && !/^0+$/.test(value);
|
|
38
|
-
}
|
|
39
|
-
exports.nonZeroUintCheck = nonZeroUintCheck;
|
|
40
|
-
/**
|
|
41
|
-
* It is in the range between `from` and `to`.
|
|
42
|
-
*
|
|
43
|
-
* @param value
|
|
44
|
-
* @param from
|
|
45
|
-
* @param to
|
|
46
|
-
*/
|
|
47
|
-
function range(value, from, to) {
|
|
48
|
-
const num = parseFloat(value);
|
|
49
|
-
if (isNaN(num)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return from <= num && num <= to;
|
|
53
|
-
}
|
|
54
|
-
exports.range = range;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param value
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
function splitUnit(value) {
|
|
61
|
-
value = value.trim().toLowerCase();
|
|
62
|
-
const matched = value.match(/(^-?\.[0-9]+|^-?[0-9]+(?:\.[0-9]+(?:e[+-][0-9]+)?)?)([a-z]+$)/i);
|
|
63
|
-
if (!matched) {
|
|
64
|
-
return {
|
|
65
|
-
num: value,
|
|
66
|
-
unit: '',
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const [, num, unit] = matched;
|
|
70
|
-
return {
|
|
71
|
-
num,
|
|
72
|
-
unit,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
exports.splitUnit = splitUnit;
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @param value
|
|
79
|
-
* @param units
|
|
80
|
-
* @param numberType
|
|
81
|
-
*/
|
|
82
|
-
function numberCheckWithUnit(value, units, numberType = 'float') {
|
|
83
|
-
const { num, unit } = splitUnit(value);
|
|
84
|
-
if (!units.includes(unit.toLowerCase())) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
switch (numberType) {
|
|
88
|
-
case 'int': {
|
|
89
|
-
if (!intCheck(num)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'uint': {
|
|
95
|
-
if (!uintCheck(num)) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
case 'float': {
|
|
101
|
-
if (!floatCheck(num)) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
exports.numberCheckWithUnit = numberCheckWithUnit;
|