mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30: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
|
|
@ -8,6 +8,7 @@ const { URL } = require("url");
|
|||
const markdownIt = require("markdown-it");
|
||||
const rules = require("./rules");
|
||||
const shared = require("./shared");
|
||||
const cache = require("./cache");
|
||||
|
||||
const deprecatedRuleNames = [ "MD002" ];
|
||||
|
||||
|
|
@ -327,7 +328,8 @@ function lintContent(
|
|||
lines,
|
||||
frontMatterLines
|
||||
};
|
||||
shared.makeTokenCache(params);
|
||||
cache.lineMetadata(shared.getLineMetadata(params));
|
||||
cache.flattenedLists(shared.flattenLists(params));
|
||||
// Function to run for each rule
|
||||
const result = (resultVersion === 0) ? {} : [];
|
||||
function forRule(rule) {
|
||||
|
|
@ -411,10 +413,10 @@ function lintContent(
|
|||
try {
|
||||
ruleList.forEach(forRule);
|
||||
} catch (ex) {
|
||||
shared.makeTokenCache(null);
|
||||
cache.clear();
|
||||
return callback(ex);
|
||||
}
|
||||
shared.makeTokenCache(null);
|
||||
cache.clear();
|
||||
return callback(null, result);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue