@markuplint/rules 4.9.3 → 4.10.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/CHANGELOG.md +22 -2
- package/lib/create-message.js +1 -1
- package/lib/heading-levels/index.js +1 -1
- package/lib/helpers.js +1 -1
- package/lib/no-empty-palpable-content/index.js +11 -6
- package/lib/permitted-contents/count-pattern.js +1 -2
- package/lib/permitted-contents/debug.js +0 -2
- package/lib/permitted-contents/start.js +1 -1
- package/lib/permitted-contents/utils.d.ts +1 -1
- package/lib/permitted-contents/utils.js +1 -1
- package/lib/wai-aria/checkings/required-prop.js +1 -1
- package/package.json +11 -11
- package/.eslintrc +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,37 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [4.10.0](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.4...@markuplint/rules@4.10.0) (2024-09-23)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* **
|
|
11
|
+
* **rules:** excluded cases where the element is palpable from the `no-empty-palpable-content` rule ([6071c51](https://github.com/markuplint/markuplint/commit/6071c5133b7c5d52d8e052ac9f39fb5b10c38b8e))
|
|
12
|
+
* **rules:** fix the message of the `heading-levels` rule and add to translate in Japanese ([ec57e1e](https://github.com/markuplint/markuplint/commit/ec57e1e5ff4549ee5574928ad20fd461d87974a5))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **types:** avoid parsing and simply accept any value when the CSS includes `var()` ([5817693](https://github.com/markuplint/markuplint/commit/5817693cfcd1a253c627db323505e4b515f69395))
|
|
12
18
|
|
|
13
19
|
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
|
|
23
|
+
## [4.9.4](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.3...@markuplint/rules@4.9.4) (2024-09-02)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @markuplint/rules
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [4.9.3](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.2...@markuplint/rules@4.9.3) (2024-06-25)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
- **ml-core:** `localName` returns lowercase when using case-sensitive parser for tag names ([b1acadd](https://github.com/markuplint/markuplint/commit/b1acaddfd6bf939ee809f6419ce85a701033ca4f))
|
|
36
|
+
|
|
17
37
|
## [4.9.2](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.9.1...@markuplint/rules@4.9.2) (2024-06-09)
|
|
18
38
|
|
|
19
39
|
### Bug Fixes
|
package/lib/create-message.js
CHANGED
|
@@ -224,7 +224,7 @@ function createExpectedObject(type, matches, t) {
|
|
|
224
224
|
? null
|
|
225
225
|
: 1 < expectedObject.length
|
|
226
226
|
? t('either {0}', t(expectedObject))
|
|
227
|
-
: expectedObject[0] ?? null;
|
|
227
|
+
: (expectedObject[0] ?? null);
|
|
228
228
|
return expects;
|
|
229
229
|
}
|
|
230
230
|
function expectValueToWord(t, expect, type) {
|
package/lib/helpers.js
CHANGED
|
@@ -67,7 +67,7 @@ node, attrSpecs,
|
|
|
67
67
|
log) {
|
|
68
68
|
let invalid = false;
|
|
69
69
|
const spec = attrSpecs.find(s => s.name.toLowerCase() === name.toLowerCase());
|
|
70
|
-
log
|
|
70
|
+
log?.('Spec of the %s attr: %o', name, spec);
|
|
71
71
|
invalid = attrCheck(t, name, value, false, spec);
|
|
72
72
|
if (invalid === false &&
|
|
73
73
|
spec &&
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { createRule } from '@markuplint/ml-core';
|
|
2
2
|
import { isNothingContentModel, isPalpableElement } from '@markuplint/ml-spec';
|
|
3
3
|
import meta from './meta.js';
|
|
4
|
+
const allowedElements = new Set([
|
|
5
|
+
// These elements are possibly empty because it to be filled by user interaction.
|
|
6
|
+
'textarea',
|
|
7
|
+
'output',
|
|
8
|
+
// Since the element itself is palpable, there is no need to determine whether its content is empty.
|
|
9
|
+
'audio',
|
|
10
|
+
'canvas',
|
|
11
|
+
'video',
|
|
12
|
+
'img',
|
|
13
|
+
]);
|
|
4
14
|
export default createRule({
|
|
5
15
|
meta: meta,
|
|
6
16
|
defaultSeverity: 'warning',
|
|
@@ -10,12 +20,7 @@ export default createRule({
|
|
|
10
20
|
},
|
|
11
21
|
async verify({ document, report, t }) {
|
|
12
22
|
await document.walkOn('Element', el => {
|
|
13
|
-
|
|
14
|
-
* Exception
|
|
15
|
-
*
|
|
16
|
-
* - The `textarea` element is possibly empty because a user inputs it.
|
|
17
|
-
*/
|
|
18
|
-
if (el.localName === 'textarea') {
|
|
23
|
+
if (allowedElements.has(el.localName)) {
|
|
19
24
|
return;
|
|
20
25
|
}
|
|
21
26
|
if (!isPalpableElement(el, el.ownerMLDocument.specs, {
|
|
@@ -22,7 +22,6 @@ childNodes, specs, options, depth) {
|
|
|
22
22
|
let prevResult = null;
|
|
23
23
|
let barelyResult = null;
|
|
24
24
|
let loopCount = 0;
|
|
25
|
-
// eslint-disable-next-line no-constant-condition
|
|
26
25
|
while (true) {
|
|
27
26
|
loopCount++;
|
|
28
27
|
ptLog('Check#%s: %s', loopCount, collection);
|
|
@@ -88,7 +87,7 @@ childNodes, specs, options, depth) {
|
|
|
88
87
|
result.type === 'MISSING_NODE_ONE_OR_MORE' ||
|
|
89
88
|
result.type === 'TRANSPARENT_MODEL_DISALLOWS'
|
|
90
89
|
? result.type
|
|
91
|
-
: missingType ?? 'MISSING_NODE_REQUIRED';
|
|
90
|
+
: (missingType ?? 'MISSING_NODE_REQUIRED');
|
|
92
91
|
ptLog('%s(in %s); Needs %s', resultType, missingType, result.query);
|
|
93
92
|
return compereResult({
|
|
94
93
|
type: resultType,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import color from 'ansi-colors';
|
|
2
2
|
import { log } from '../debug.js';
|
|
3
3
|
export const cmLog = log.extend('content-model');
|
|
4
|
-
/* eslint-disable import/no-named-as-default-member */
|
|
5
4
|
export const bgGreen = color.bgGreen;
|
|
6
5
|
export const green = color.green;
|
|
7
6
|
export const bgRed = color.bgRed;
|
|
@@ -9,4 +8,3 @@ export const bgBlue = color.bgBlue;
|
|
|
9
8
|
export const blue = color.blue;
|
|
10
9
|
export const bgMagenta = color.bgMagenta;
|
|
11
10
|
export const cyan = color.cyan;
|
|
12
|
-
/* eslint-enable import/no-named-as-default-member */
|
|
@@ -55,7 +55,7 @@ el, specs, options) {
|
|
|
55
55
|
type: result.type,
|
|
56
56
|
scope: result.type === 'MISSING_NODE_REQUIRED' || result.type === 'MISSING_NODE_ONE_OR_MORE'
|
|
57
57
|
? el
|
|
58
|
-
: result.unmatched[0] ?? el,
|
|
58
|
+
: (result.unmatched[0] ?? el),
|
|
59
59
|
query: result.query,
|
|
60
60
|
hint: result.hint,
|
|
61
61
|
},
|
|
@@ -31,7 +31,7 @@ export declare function mergeHints(a: Readonly<Hints>, b: Readonly<Hints>): Part
|
|
|
31
31
|
not?: ChildNode;
|
|
32
32
|
transparent?: import("./types.js").Element;
|
|
33
33
|
}>;
|
|
34
|
-
export declare function cleanObject<T extends
|
|
34
|
+
export declare function cleanObject<T extends object>(object: T): Partial<T>;
|
|
35
35
|
export declare class Collection {
|
|
36
36
|
#private;
|
|
37
37
|
constructor(origin: readonly ChildNode[]);
|
|
@@ -17,7 +17,7 @@ export const checkingRequiredProp = ({ el, role, propSpecs }) => t => {
|
|
|
17
17
|
const elAriaSpec = getARIA(el.ownerMLDocument.specs, el.localName, el.namespaceURI, el.rule.options.version, el.matches.bind(el));
|
|
18
18
|
const alt = elAriaSpec?.properties === false
|
|
19
19
|
? null
|
|
20
|
-
: elAriaSpec?.properties?.without?.find(p => p.name === requiredProp)?.alt ?? null;
|
|
20
|
+
: (elAriaSpec?.properties?.without?.find(p => p.name === requiredProp)?.alt ?? null);
|
|
21
21
|
if (alt?.method === 'set-attr' && el.hasAttribute(alt.target)) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/rules",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "Built-in rules of markuplint",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"./lib/permitted-contents/debug.js": "./lib/permitted-contents/debug.browser.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@markuplint/html-spec": "4.
|
|
29
|
-
"@markuplint/ml-core": "4.
|
|
30
|
-
"@markuplint/ml-spec": "4.
|
|
31
|
-
"@markuplint/selector": "4.6.
|
|
32
|
-
"@markuplint/shared": "4.4.
|
|
33
|
-
"@markuplint/types": "4.
|
|
28
|
+
"@markuplint/html-spec": "4.9.1",
|
|
29
|
+
"@markuplint/ml-core": "4.9.0",
|
|
30
|
+
"@markuplint/ml-spec": "4.7.0",
|
|
31
|
+
"@markuplint/selector": "4.6.7",
|
|
32
|
+
"@markuplint/shared": "4.4.5",
|
|
33
|
+
"@markuplint/types": "4.6.0",
|
|
34
34
|
"@types/debug": "4.1.12",
|
|
35
35
|
"@ungap/structured-clone": "1.2.0",
|
|
36
36
|
"ansi-colors": "4.1.3",
|
|
37
|
-
"chrono-node": "2.7.
|
|
38
|
-
"debug": "4.3.
|
|
39
|
-
"type-fest": "4.
|
|
37
|
+
"chrono-node": "2.7.7",
|
|
38
|
+
"debug": "4.3.7",
|
|
39
|
+
"type-fest": "4.26.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "05d2eabfcc41b67847c24049f12dd2b9f5ca6485"
|
|
42
42
|
}
|