mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Remove state from shared.js, move to cache.js.
This commit is contained in:
parent
827e1acb56
commit
f614f3e1ce
17 changed files with 124 additions and 98 deletions
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addErrorDetailIf, forEachLine } = require("./shared");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD012", "no-multiple-blanks" ],
|
||||
|
|
@ -11,10 +12,10 @@ module.exports = {
|
|||
"function": function MD012(params, onError) {
|
||||
const maximum = params.config.maximum || 1;
|
||||
let count = 0;
|
||||
shared.forEachLine(function forLine(line, lineIndex, inCode) {
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
count = (inCode || line.trim().length) ? 0 : count + 1;
|
||||
if (maximum < count) {
|
||||
shared.addErrorDetailIf(onError, lineIndex + 1, maximum, count);
|
||||
addErrorDetailIf(onError, lineIndex + 1, maximum, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue