mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +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
10
lib/md010.js
10
lib/md010.js
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addError, forEachLine, rangeFromRegExp } = require("./shared");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
const tabRe = /\t+/;
|
||||
|
||||
|
|
@ -13,11 +14,10 @@ module.exports = {
|
|||
"function": function MD010(params, onError) {
|
||||
const codeBlocks = params.config.code_blocks;
|
||||
const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
|
||||
shared.forEachLine(function forLine(line, lineIndex, inCode) {
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
if (tabRe.test(line) && (!inCode || includeCodeBlocks)) {
|
||||
shared.addError(onError, lineIndex + 1,
|
||||
"Column: " + (line.indexOf("\t") + 1), null,
|
||||
shared.rangeFromRegExp(line, tabRe));
|
||||
addError(onError, lineIndex + 1, "Column: " + (line.indexOf("\t") + 1),
|
||||
null, rangeFromRegExp(line, tabRe));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue