@markuplint/ml-config
Advanced tools
Comparing version 2.0.0-dev.36 to 2.0.0-dev.2021116.0
@@ -1,2 +0,3 @@ | ||
import type { Config } from './types'; | ||
import type { Config, Nullable, AnyRule } from './types'; | ||
export declare function mergeConfig(a: Config, b: Config): Config; | ||
export declare function mergeRule(a: Nullable<AnyRule>, b: AnyRule): AnyRule; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mergeConfig = void 0; | ||
exports.mergeRule = exports.mergeConfig = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -112,2 +112,9 @@ const deepmerge_1 = (0, tslib_1.__importDefault)(require("deepmerge")); | ||
function mergeRule(a, b) { | ||
// Particular behavior: | ||
// | ||
// If the right-side value is false, return false. | ||
// In short; The `false` makes the rule to be disabled absolutely. | ||
if (b === false || (!isRuleConfigValue(b) && b.value === false)) { | ||
return false; | ||
} | ||
if (a === undefined) { | ||
@@ -134,2 +141,3 @@ return b; | ||
const option = mergeObject(!isRuleConfigValue(a) ? a.option : undefined, b.option); | ||
const reason = b.reason || (!isRuleConfigValue(a) ? a.reason : undefined); | ||
const res = { | ||
@@ -139,2 +147,3 @@ severity, | ||
option, | ||
reason, | ||
}; | ||
@@ -144,2 +153,3 @@ deleteUndefProp(res); | ||
} | ||
exports.mergeRule = mergeRule; | ||
function isRuleConfigValue(v) { | ||
@@ -146,0 +156,0 @@ switch (typeof v) { |
@@ -65,2 +65,9 @@ "use strict"; | ||
} | ||
if (rule.reason != null) { | ||
const exchangedValue = exchangeValue(rule.reason, data); | ||
rule = { | ||
...rule, | ||
reason: exchangedValue ? `${exchangedValue}` : undefined, | ||
}; | ||
} | ||
return rule; | ||
@@ -67,0 +74,0 @@ } |
{ | ||
"name": "@markuplint/ml-config", | ||
"version": "2.0.0-dev.36+6a10aede", | ||
"version": "2.0.0-dev.2021116.0", | ||
"description": "JSON Schema and TypeScript types of markuplint configure JSON", | ||
@@ -26,3 +26,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
}, | ||
"gitHead": "6a10aede7385e2e97d0ba2c272a2e8c08e5429fd" | ||
"gitHead": "9a97f1e837bd86d72bd3980b0fb11245c6b3e8f7" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
53562
480
0