mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Enable ESLint rule unicorn/no-array-for-each, auto-fix all violations, manually address new issues for ~4% time reduction measured via profile-fixture.mjs on Apple Silicon M1.
This commit is contained in:
parent
15efcb4282
commit
b6471fba31
34 changed files with 414 additions and 389 deletions
|
|
@ -14,15 +14,15 @@ module.exports = {
|
|||
let inLink = false;
|
||||
let linkText = "";
|
||||
let emptyLink = false;
|
||||
token.children.forEach(function forChild(child) {
|
||||
for (const child of token.children) {
|
||||
if (child.type === "link_open") {
|
||||
inLink = true;
|
||||
linkText = "";
|
||||
child.attrs.forEach(function forAttr(attr) {
|
||||
for (const attr of child.attrs) {
|
||||
if (attr[0] === "href" && (!attr[1] || (attr[1] === "#"))) {
|
||||
emptyLink = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (child.type === "link_close") {
|
||||
inLink = false;
|
||||
if (emptyLink) {
|
||||
|
|
@ -43,7 +43,7 @@ module.exports = {
|
|||
} else if (inLink) {
|
||||
linkText += child.content;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue