Remove state from shared.js, move to cache.js.

This commit is contained in:
David Anson 2019-04-10 21:26:59 -07:00
parent 827e1acb56
commit f614f3e1ce
17 changed files with 124 additions and 98 deletions

View file

@ -2,7 +2,9 @@
"use strict";
const shared = require("./shared");
const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
require("./shared");
const { flattenedLists } = require("./cache");
module.exports = {
"names": [ "MD006", "ul-start-left" ],
@ -10,11 +12,11 @@ module.exports = {
"Consider starting bulleted lists at the beginning of the line",
"tags": [ "bullet", "ul", "indentation" ],
"function": function MD006(params, onError) {
shared.flattenLists().forEach(function forList(list) {
flattenedLists().forEach((list) => {
if (list.unordered && !list.nesting) {
shared.addErrorDetailIf(onError, list.open.lineNumber,
addErrorDetailIf(onError, list.open.lineNumber,
0, list.indent, null, null,
shared.rangeFromRegExp(list.open.line, shared.listItemMarkerRe));
rangeFromRegExp(list.open.line, listItemMarkerRe));
}
});
}