2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var shared = require("./shared");
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
"names": [ "MD005", "list-indent" ],
|
|
|
|
"description": "Inconsistent indentation for list items at the same level",
|
|
|
|
"tags": [ "bullet", "ul", "indentation" ],
|
|
|
|
"function": function MD005(params, onError) {
|
2018-03-04 23:06:31 -08:00
|
|
|
shared.flattenLists().forEach(function forList(list) {
|
2018-01-21 21:44:25 -08:00
|
|
|
var indent = shared.indentFor(list.items[0]);
|
|
|
|
list.items.forEach(function forItem(item) {
|
|
|
|
shared.addErrorDetailIf(onError, item.lineNumber, indent,
|
|
|
|
shared.indentFor(item), null,
|
|
|
|
shared.rangeFromRegExp(item.line, shared.listItemMarkerRe));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|