@textlint/config-loader
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -6,2 +6,21 @@ # Change Log | ||
# [0.8.0](https://github.com/textlint/editor/compare/v0.7.1...v0.8.0) (2020-10-27) | ||
### Bug Fixes | ||
* parse ([f8fa2e2](https://github.com/textlint/editor/commit/f8fa2e231249151cc4e9091c5ef8916884cb953b)) | ||
* remove missing ([abcf4dd](https://github.com/textlint/editor/commit/abcf4dd0a31428be8f6533ff267f208c5dfb77f7)) | ||
### Features | ||
* add parseOptionsFromConfig ([8ece751](https://github.com/textlint/editor/commit/8ece7517f37317108caae8284cae4e7f844729d1)) | ||
* add test ([02eed37](https://github.com/textlint/editor/commit/02eed37a7df4830eebd0782bf4d04031648567b6)) | ||
* support "merge-config" command ([e7f734e](https://github.com/textlint/editor/commit/e7f734eb2e1e44d85592159f37d3a83ab50f7966)) | ||
# [0.7.0](https://github.com/textlint/editor/compare/v0.6.0...v0.7.0) (2020-08-05) | ||
@@ -8,0 +27,0 @@ |
@@ -90,3 +90,3 @@ import { TextlintRcConfig } from "./TextlintRcConfig"; | ||
/** | ||
* Load config file and return config object that is not loaded rule instance | ||
* Load config file and return parsed config object that is not loaded rule instance | ||
* It is just JSON present for config file. Raw data | ||
@@ -93,0 +93,0 @@ * @param options |
@@ -99,3 +99,3 @@ "use strict"; | ||
/** | ||
* Load config file and return config object that is not loaded rule instance | ||
* Load config file and return parsed config object that is not loaded rule instance | ||
* It is just JSON present for config file. Raw data | ||
@@ -102,0 +102,0 @@ * @param options |
@@ -43,2 +43,8 @@ import { TextLintModuleResolver } from "./textlint-module-resolver"; | ||
}; | ||
export declare function loadPreset(presetName: string, moduleResolver: TextLintModuleResolver): TextlintConfigDescriptor["rules"]; | ||
export declare function loadPreset({ presetName, userDefinedRuleOptions, moduleResolver }: { | ||
presetName: string; | ||
userDefinedRuleOptions: boolean | { | ||
[index: string]: boolean | {}; | ||
}; | ||
moduleResolver: TextLintModuleResolver; | ||
}): TextlintConfigDescriptor["rules"]; |
@@ -89,3 +89,4 @@ "use strict"; | ||
exports.loadRulesConfigFromPresets = loadRulesConfigFromPresets; | ||
function loadPreset(presetName, moduleResolver) { | ||
function loadPreset(_a) { | ||
var presetName = _a.presetName, userDefinedRuleOptions = _a.userDefinedRuleOptions, moduleResolver = _a.moduleResolver; | ||
var presetPackageName = moduleResolver.resolvePresetPackageName(presetName); | ||
@@ -100,3 +101,4 @@ var preset = module_interop_1.moduleInterop(require(presetPackageName.filePath)); | ||
// we should use preset.rules → some preset use different name actual rule | ||
return Object.keys(preset).map(function (ruleId) { | ||
return Object.keys(preset.rules).map(function (ruleId) { | ||
var userDefinedOptions = typeof userDefinedRuleOptions !== "boolean" ? userDefinedRuleOptions === null || userDefinedRuleOptions === void 0 ? void 0 : userDefinedRuleOptions[ruleId] : {}; | ||
var normalizedKey = utils_1.normalizeTextlintPresetSubRuleKey({ preset: presetName, rule: ruleId }); | ||
@@ -106,3 +108,4 @@ return { | ||
rule: preset.rules[ruleId], | ||
options: preset.rulesConfig[ruleId], | ||
// prefer textlintrc content than default value of preset | ||
options: userDefinedOptions !== null && userDefinedOptions !== void 0 ? userDefinedOptions : preset.rulesConfig[ruleId], | ||
filePath: "", | ||
@@ -109,0 +112,0 @@ moduleName: "" |
@@ -90,3 +90,3 @@ import { TextlintRcConfig } from "./TextlintRcConfig"; | ||
/** | ||
* Load config file and return config object that is not loaded rule instance | ||
* Load config file and return parsed config object that is not loaded rule instance | ||
* It is just JSON present for config file. Raw data | ||
@@ -93,0 +93,0 @@ * @param options |
@@ -96,3 +96,3 @@ import { rcFile } from "rc-config-loader"; | ||
/** | ||
* Load config file and return config object that is not loaded rule instance | ||
* Load config file and return parsed config object that is not loaded rule instance | ||
* It is just JSON present for config file. Raw data | ||
@@ -99,0 +99,0 @@ * @param options |
@@ -43,2 +43,8 @@ import { TextLintModuleResolver } from "./textlint-module-resolver"; | ||
}; | ||
export declare function loadPreset(presetName: string, moduleResolver: TextLintModuleResolver): TextlintConfigDescriptor["rules"]; | ||
export declare function loadPreset({ presetName, userDefinedRuleOptions, moduleResolver }: { | ||
presetName: string; | ||
userDefinedRuleOptions: boolean | { | ||
[index: string]: boolean | {}; | ||
}; | ||
moduleResolver: TextLintModuleResolver; | ||
}): TextlintConfigDescriptor["rules"]; |
@@ -83,3 +83,4 @@ // LICENSE : MIT | ||
} | ||
export function loadPreset(presetName, moduleResolver) { | ||
export function loadPreset(_a) { | ||
var presetName = _a.presetName, userDefinedRuleOptions = _a.userDefinedRuleOptions, moduleResolver = _a.moduleResolver; | ||
var presetPackageName = moduleResolver.resolvePresetPackageName(presetName); | ||
@@ -94,3 +95,4 @@ var preset = moduleInterop(require(presetPackageName.filePath)); | ||
// we should use preset.rules → some preset use different name actual rule | ||
return Object.keys(preset).map(function (ruleId) { | ||
return Object.keys(preset.rules).map(function (ruleId) { | ||
var userDefinedOptions = typeof userDefinedRuleOptions !== "boolean" ? userDefinedRuleOptions === null || userDefinedRuleOptions === void 0 ? void 0 : userDefinedRuleOptions[ruleId] : {}; | ||
var normalizedKey = normalizeTextlintPresetSubRuleKey({ preset: presetName, rule: ruleId }); | ||
@@ -100,3 +102,4 @@ return { | ||
rule: preset.rules[ruleId], | ||
options: preset.rulesConfig[ruleId], | ||
// prefer textlintrc content than default value of preset | ||
options: userDefinedOptions !== null && userDefinedOptions !== void 0 ? userDefinedOptions : preset.rulesConfig[ruleId], | ||
filePath: "", | ||
@@ -103,0 +106,0 @@ moduleName: "" |
{ | ||
"name": "@textlint/config-loader", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Config loader for textlint. .textlintrc loader", | ||
@@ -67,3 +67,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "5489aaffe93a33c9b425f30c18b30258ff605ba8" | ||
"gitHead": "12fa506ceaefceecadc3eacdbde0e28dc547ea2a" | ||
} |
Sorry, the diff of this file is not supported yet
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
118935
67
2121