mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Undefined config.default should behave like true.
This commit is contained in:
parent
8a51cea593
commit
e305d22cce
2 changed files with 27 additions and 1 deletions
|
|
@ -80,7 +80,7 @@ function lintFile(file, config, callback) {
|
|||
};
|
||||
// Merge rules/tags and sanitize config
|
||||
var mergedRules = {};
|
||||
var ruleDefault = (config.default !== undefined) && !!config.default;
|
||||
var ruleDefault = (config.default === undefined) || !!config.default;
|
||||
rules.forEach(function forRule(rule) {
|
||||
mergedRules[rule.name] = ruleDefault;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -174,6 +174,32 @@ module.exports.defaultFalse = function defaultFalse(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.defaultUndefined = function defaultUndefined(test) {
|
||||
test.expect(2);
|
||||
var options = {
|
||||
"files": [
|
||||
"./test/atx_header_spacing.md",
|
||||
"./test/first_header_bad_atx.md"
|
||||
],
|
||||
"config": {}
|
||||
};
|
||||
markdownlint(options, function callback(err, actualResult) {
|
||||
test.ifError(err);
|
||||
var expectedResult = {
|
||||
"./test/atx_header_spacing.md": {
|
||||
"MD002": [ 3 ],
|
||||
"MD018": [ 1 ],
|
||||
"MD019": [ 3, 5 ]
|
||||
},
|
||||
"./test/first_header_bad_atx.md": {
|
||||
"MD002": [ 1 ]
|
||||
}
|
||||
};
|
||||
test.deepEqual(actualResult, expectedResult, "Undetected issues.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.disableRules = function disableRules(test) {
|
||||
test.expect(2);
|
||||
var options = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue