@markuplint/ml-config 4.0.0-alpha.2 → 4.0.0-alpha.4
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/merge-config.js +5 -3
- package/lib/utils.js +3 -3
- package/package.json +7 -7
package/lib/merge-config.js
CHANGED
|
@@ -48,10 +48,10 @@ export function mergeRule(a, b) {
|
|
|
48
48
|
deleteUndefProp(res);
|
|
49
49
|
return res;
|
|
50
50
|
}
|
|
51
|
-
const severity = oB.severity ?? (
|
|
51
|
+
const severity = oB.severity ?? (isRuleConfigValue(oA) ? undefined : oA.severity);
|
|
52
52
|
const value = oB.value ?? (isRuleConfigValue(oA) ? oA : oA.value);
|
|
53
|
-
const options = mergeObject(
|
|
54
|
-
const reason = oB.reason ?? (
|
|
53
|
+
const options = mergeObject(isRuleConfigValue(oA) ? undefined : oA.options, oB.options);
|
|
54
|
+
const reason = oB.reason ?? (isRuleConfigValue(oA) ? undefined : oA.reason);
|
|
55
55
|
const res = {
|
|
56
56
|
severity,
|
|
57
57
|
value,
|
|
@@ -107,7 +107,9 @@ function concatArray(a, b, uniquely = false, comparePropName) {
|
|
|
107
107
|
}
|
|
108
108
|
newArray.splice(existedIndex, 1, merged);
|
|
109
109
|
}
|
|
110
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
110
111
|
a?.forEach(concat);
|
|
112
|
+
// eslint-disable-next-line unicorn/no-array-for-each
|
|
111
113
|
b?.forEach(concat);
|
|
112
114
|
return newArray.length === 0 ? undefined : newArray;
|
|
113
115
|
}
|
package/lib/utils.js
CHANGED
|
@@ -49,7 +49,7 @@ export function exchangeValueOnRule(rule, data) {
|
|
|
49
49
|
const exchangedValue = exchangeValue(result.reason, data);
|
|
50
50
|
result = {
|
|
51
51
|
...result,
|
|
52
|
-
reason: exchangedValue
|
|
52
|
+
reason: exchangedValue == null ? undefined : `${exchangedValue}`,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
deleteUndefProp(result);
|
|
@@ -141,9 +141,9 @@ function exchangeOption(optionValue, data) {
|
|
|
141
141
|
return optionValue.map(v => exchangeOption(v, data));
|
|
142
142
|
}
|
|
143
143
|
const result = {};
|
|
144
|
-
Object.keys(optionValue)
|
|
144
|
+
for (const key of Object.keys(optionValue)) {
|
|
145
145
|
result[key] = exchangeOption(optionValue[key], data);
|
|
146
|
-
}
|
|
146
|
+
}
|
|
147
147
|
return result;
|
|
148
148
|
}
|
|
149
149
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-config",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.4",
|
|
4
4
|
"description": "JSON Schema and TypeScript types of markuplint configure JSON",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"clean": "tsc --build --clean"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@markuplint/ml-ast": "4.0.0-alpha.
|
|
28
|
-
"@markuplint/selector": "4.0.0-alpha.
|
|
29
|
-
"@markuplint/shared": "4.0.0-alpha.
|
|
30
|
-
"@types/mustache": "^4.2.
|
|
27
|
+
"@markuplint/ml-ast": "4.0.0-alpha.4",
|
|
28
|
+
"@markuplint/selector": "4.0.0-alpha.4",
|
|
29
|
+
"@markuplint/shared": "4.0.0-alpha.4",
|
|
30
|
+
"@types/mustache": "^4.2.4",
|
|
31
31
|
"deepmerge": "^4.3.1",
|
|
32
32
|
"is-plain-object": "^5.0.0",
|
|
33
33
|
"mustache": "^4.2.0",
|
|
34
|
-
"type-fest": "^4.
|
|
34
|
+
"type-fest": "^4.5.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "991b3aef77fde42c79343ee8c807257a35c589d7"
|
|
37
37
|
}
|