mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Cache all top-level calls to filterByTypes (~7% runtime reduction).
This commit is contained in:
parent
85e704f32a
commit
dfcb4529f3
47 changed files with 427 additions and 481 deletions
|
@ -3,8 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorContext } = require("../helpers");
|
||||
const { filterByPredicate, filterByTypes, getHtmlTagInfo, inHtmlFlow, parse } =
|
||||
require("../helpers/micromark.cjs");
|
||||
const { filterByPredicate, getHtmlTagInfo, inHtmlFlow, parse } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
@ -70,10 +70,7 @@ module.exports = {
|
|||
}
|
||||
)
|
||||
);
|
||||
const autoLinks = filterByTypes(
|
||||
params.parsers.micromark.tokens,
|
||||
[ "literalAutolink" ]
|
||||
);
|
||||
const autoLinks = filterByTypesCached([ "literalAutolink" ]);
|
||||
if (autoLinks.length > 0) {
|
||||
// Re-parse with correct link/image reference definition handling
|
||||
const document = params.lines.join("\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue