@markuplint/rules 4.10.12 → 4.11.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 CHANGED
@@ -3,6 +3,16 @@
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
+ # [4.11.0](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.10.12...@markuplint/rules@4.11.0) (2025-08-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - ensure that each `clean` command correctly removes build files ([110b78e](https://github.com/markuplint/markuplint/commit/110b78e85379d29a84ca68325127344a87a570b6))
11
+
12
+ ### Features
13
+
14
+ - **rules:** improve error message for multiple required attributes ([4aa4e4f](https://github.com/markuplint/markuplint/commit/4aa4e4fe54efc05edf7e9166a7fd769127b75769))
15
+
6
16
  ## [4.10.12](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.10.11...@markuplint/rules@4.10.12) (2025-04-13)
7
17
 
8
18
  **Note:** Version bump only for package @markuplint/rules
@@ -92,7 +92,9 @@ function toDatetimeString(date) {
92
92
  }
93
93
  function parseTryMultipleLangs(content, langs, base) {
94
94
  for (const lang of langs) {
95
- const results = chrono[lang].casual.parse(content, base);
95
+ const results =
96
+ // eslint-disable-next-line import-x/namespace
97
+ chrono[lang].casual.parse(content, base);
96
98
  // Is not multiple datetime contents
97
99
  if (results.length === 0) {
98
100
  continue;
@@ -45,9 +45,10 @@ export default createRule({
45
45
  }
46
46
  for (const spec of Object.values(attributeSpecs)) {
47
47
  const didntHave = !el.hasAttribute(spec.name);
48
+ const candidate = [spec.name];
48
49
  let invalid = false;
49
50
  if (spec.requiredEither) {
50
- const candidate = [...spec.requiredEither, spec.name];
51
+ candidate.push(...spec.requiredEither);
51
52
  invalid = !candidate.some(attrName => el.hasAttribute(attrName));
52
53
  }
53
54
  else if (spec.required === true) {
@@ -57,8 +58,15 @@ export default createRule({
57
58
  const selector = typeof spec.required === 'string' ? spec.required : spec.required.join(',');
58
59
  invalid = el.matches(selector) && didntHave;
59
60
  }
61
+ candidate.sort();
60
62
  if (invalid) {
61
- const message = t('{0} expects {1}', t('the "{0*}" {1}', el.localName, 'element'), t('the "{0*}" {1}', spec.name, 'attribute'));
63
+ const expects = candidate.length === 1
64
+ ? t('the "{0*}" {1}', spec.name, 'attribute')
65
+ : t('{0} {1}', candidate
66
+ .map(attrName => t('the "{0*}"', attrName))
67
+ // eslint-disable-next-line unicorn/no-array-reduce
68
+ .reduce((a, b) => t('{0} or {1}', a, b)), t('attribute'));
69
+ const message = t('{0} expects {1}', t('the "{0*}" {1}', el.localName, 'element'), expects);
62
70
  report({
63
71
  scope: el,
64
72
  message,
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "4.10.12",
3
+ "version": "4.11.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>",
7
7
  "license": "MIT",
8
- "private": false,
9
8
  "type": "module",
10
9
  "exports": {
11
10
  ".": {
@@ -19,24 +18,24 @@
19
18
  "scripts": {
20
19
  "build": "tsc --project tsconfig.build.json",
21
20
  "dev": "tsc --watch --project tsconfig.build.json",
22
- "clean": "tsc --build --clean"
21
+ "clean": "tsc --build --clean tsconfig.build.json"
23
22
  },
24
23
  "browser": {
25
24
  "./lib/permitted-contents/debug.js": "./lib/permitted-contents/debug.browser.js"
26
25
  },
27
26
  "dependencies": {
28
- "@markuplint/html-spec": "4.14.2",
29
- "@markuplint/ml-core": "4.12.4",
30
- "@markuplint/ml-spec": "4.9.6",
31
- "@markuplint/selector": "4.7.4",
32
- "@markuplint/shared": "4.4.11",
33
- "@markuplint/types": "4.7.6",
27
+ "@markuplint/html-spec": "4.15.0",
28
+ "@markuplint/ml-core": "4.13.0",
29
+ "@markuplint/ml-spec": "4.9.7",
30
+ "@markuplint/selector": "4.7.5",
31
+ "@markuplint/shared": "4.4.12",
32
+ "@markuplint/types": "4.7.7",
34
33
  "@types/debug": "4.1.12",
35
34
  "@ungap/structured-clone": "1.3.0",
36
35
  "ansi-colors": "4.1.3",
37
- "chrono-node": "2.8.0",
38
- "debug": "4.4.0",
39
- "type-fest": "4.39.1"
36
+ "chrono-node": "2.8.4",
37
+ "debug": "4.4.1",
38
+ "type-fest": "4.41.0"
40
39
  },
41
- "gitHead": "eb36d59f7e13d4e59ff3f3c4eabb5ec06c070eb0"
40
+ "gitHead": "acbf53f7e30d7a59f850a0f279b617383266dab3"
42
41
  }