Fix bug in detailed error message for MD030/list-marker-space when no space present (fixes #57).

This commit is contained in:
David Anson 2017-05-06 21:56:24 -07:00
parent 942f0600d2
commit da529ac286
3 changed files with 52 additions and 1 deletions

View file

@ -758,7 +758,7 @@ module.exports = [
list.items.forEach(function forItem(item) {
var match = /^[\s>]*\S+(\s+)/.exec(item.line);
errors.addDetailIf(item.lineNumber,
expectedSpaces, !match || match[1].length);
expectedSpaces, (match ? match[1].length : 0));
});
});
}

View file

@ -0,0 +1,13 @@
#
-
1.
- a
1. a
- a
1. a

View file

@ -0,0 +1,38 @@
[
{
"lineNumber": 3,
"ruleName": "MD030",
"ruleAlias": "list-marker-space",
"ruleDescription": "Spaces after list markers",
"errorDetail": "Expected: 1; Actual: 0",
"errorContext": null,
"errorRange": null
},
{
"lineNumber": 5,
"ruleName": "MD030",
"ruleAlias": "list-marker-space",
"ruleDescription": "Spaces after list markers",
"errorDetail": "Expected: 1; Actual: 0",
"errorContext": null,
"errorRange": null
},
{
"lineNumber": 11,
"ruleName": "MD030",
"ruleAlias": "list-marker-space",
"ruleDescription": "Spaces after list markers",
"errorDetail": "Expected: 1; Actual: 2",
"errorContext": null,
"errorRange": [1, 3]
},
{
"lineNumber": 13,
"ruleName": "MD030",
"ruleAlias": "list-marker-space",
"ruleDescription": "Spaces after list markers",
"errorDetail": "Expected: 1; Actual: 2",
"errorContext": null,
"errorRange": [1, 4]
}
]