@markuplint/rules 4.8.0-alpha.0 → 4.9.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.9.0](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.8.0...@markuplint/rules@4.9.0) (2024-05-12)
7
+
8
+ ### Features
9
+
10
+ - **rules:** support directive type ([2303ca7](https://github.com/markuplint/markuplint/commit/2303ca7118d1c25b336e5fca6ebb2380b63b4b2f))
11
+
12
+ # [4.8.0](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.8.0-alpha.0...@markuplint/rules@4.8.0) (2024-05-04)
13
+
14
+ **Note:** Version bump only for package @markuplint/rules
15
+
6
16
  # [4.8.0-alpha.0](https://github.com/markuplint/markuplint/compare/@markuplint/rules@4.7.0...@markuplint/rules@4.8.0-alpha.0) (2024-05-04)
7
17
 
8
18
  ### Features
@@ -1,4 +1,4 @@
1
- import { isList, isKeyword, isEnum } from '@markuplint/types';
1
+ import { isList, isKeyword, isEnum, isNumber, isDirective } from '@markuplint/types';
2
2
  export function createMessageValueExpected(t, baseTarget, type, matches) {
3
3
  let target = baseTarget;
4
4
  let listDescriptionPart;
@@ -214,9 +214,12 @@ function createExpectedObject(type, matches, t) {
214
214
  else if (isEnum(type)) {
215
215
  expectedObject.push(...type.enum);
216
216
  }
217
- else {
217
+ else if (isNumber(type)) {
218
218
  expectedObject.push(createExpectedNumber(t, type));
219
219
  }
220
+ else if (isDirective(type)) {
221
+ expectedObject.push(t('a {0}', 'directive'));
222
+ }
220
223
  const expects = expectedObject.length === 0
221
224
  ? null
222
225
  : 1 < expectedObject.length
package/lib/helpers.js CHANGED
@@ -95,7 +95,7 @@ export function toNormalizedValue(value, spec) {
95
95
  }
96
96
  }
97
97
  else {
98
- if ('token' in spec.type) {
98
+ if ('separator' in spec.type) {
99
99
  if (spec.type.caseInsensitive) {
100
100
  normalized = normalized.toLowerCase();
101
101
  }
package/lib/index.d.ts CHANGED
@@ -16,7 +16,13 @@ declare const rules: {
16
16
  readonly 'id-duplication': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
17
17
  readonly 'ineffective-attr': Readonly<import("@markuplint/ml-core").RuleSeed<import("@markuplint/ml-core").RuleConfigValue, undefined>>;
18
18
  readonly 'invalid-attr': Readonly<import("@markuplint/ml-core").RuleSeed<boolean, {
19
- allowAttrs?: (string | {
19
+ allowAttrs?: Record<string, {
20
+ enum: [string, ...string[]];
21
+ } | {
22
+ pattern: string;
23
+ } | {
24
+ type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
25
+ }> | (string | {
20
26
  name: string;
21
27
  value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
22
28
  enum: [string, ...string[]];
@@ -25,14 +31,14 @@ declare const rules: {
25
31
  } | {
26
32
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
27
33
  });
28
- })[] | Record<string, {
34
+ })[] | undefined;
35
+ disallowAttrs?: Record<string, {
29
36
  enum: [string, ...string[]];
30
37
  } | {
31
38
  pattern: string;
32
39
  } | {
33
40
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
34
- }> | undefined;
35
- disallowAttrs?: (string | {
41
+ }> | (string | {
36
42
  name: string;
37
43
  value: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType | ({
38
44
  enum: [string, ...string[]];
@@ -41,13 +47,7 @@ declare const rules: {
41
47
  } | {
42
48
  type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
43
49
  });
44
- })[] | Record<string, {
45
- enum: [string, ...string[]];
46
- } | {
47
- pattern: string;
48
- } | {
49
- type: import("packages/@markuplint/ml-spec/lib/index.js").AttributeType;
50
- }> | undefined;
50
+ })[] | undefined;
51
51
  ignoreAttrNamePrefix?: string | string[] | undefined;
52
52
  allowToAddPropertiesForPretender?: boolean | undefined;
53
53
  attrs?: Record<string, ({
@@ -73,7 +73,7 @@ export default createRule({
73
73
  message: t('Missing {0}', t('"{0*}" ID', value)),
74
74
  });
75
75
  }
76
- if (typeof spec.type !== 'string' && 'token' in spec.type && spec.type.token === 'DOMID') {
76
+ if (typeof spec.type !== 'string' && 'separator' in spec.type && spec.type.token === 'DOMID') {
77
77
  const refs = value
78
78
  .split(spec.type.separator === 'space' ? /\s/ : ',')
79
79
  .map(id => id.trim())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/rules",
3
- "version": "4.8.0-alpha.0",
3
+ "version": "4.9.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.7.1-alpha.0",
29
- "@markuplint/ml-core": "4.7.1-alpha.0",
30
- "@markuplint/ml-spec": "4.5.1-alpha.0",
31
- "@markuplint/selector": "4.6.1-alpha.0",
32
- "@markuplint/shared": "4.3.1-alpha.0",
33
- "@markuplint/types": "4.4.1-alpha.0",
28
+ "@markuplint/html-spec": "4.7.2",
29
+ "@markuplint/ml-core": "4.7.2",
30
+ "@markuplint/ml-spec": "4.6.0",
31
+ "@markuplint/selector": "4.6.2",
32
+ "@markuplint/shared": "4.4.0",
33
+ "@markuplint/types": "4.5.0",
34
34
  "@types/debug": "4.1.12",
35
35
  "@ungap/structured-clone": "1.2.0",
36
36
  "ansi-colors": "4.1.3",
37
37
  "chrono-node": "2.7.5",
38
38
  "debug": "4.3.4",
39
- "type-fest": "4.18.1"
39
+ "type-fest": "4.18.2"
40
40
  },
41
- "gitHead": "d091e2199e3dc6757c2c8edbf01fd19e8b072015"
41
+ "gitHead": "ca7dc6bf40eac4f2813e492878f889eb77751a70"
42
42
  }