mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +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
27
lib/md048.js
27
lib/md048.js
|
|
@ -11,19 +11,18 @@ module.exports = {
|
|||
"function": function MD048(params, onError) {
|
||||
const style = String(params.config.style || "consistent");
|
||||
let expectedStyle = style;
|
||||
params.tokens
|
||||
.filter((token) => token.type === "fence")
|
||||
.forEach((fenceToken) => {
|
||||
const { lineNumber, markup } = fenceToken;
|
||||
if (expectedStyle === "consistent") {
|
||||
expectedStyle = fencedCodeBlockStyleFor(markup);
|
||||
}
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
lineNumber,
|
||||
expectedStyle,
|
||||
fencedCodeBlockStyleFor(markup)
|
||||
);
|
||||
});
|
||||
const fenceTokens = params.tokens.filter((token) => token.type === "fence");
|
||||
for (const fenceToken of fenceTokens) {
|
||||
const { lineNumber, markup } = fenceToken;
|
||||
if (expectedStyle === "consistent") {
|
||||
expectedStyle = fencedCodeBlockStyleFor(markup);
|
||||
}
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
lineNumber,
|
||||
expectedStyle,
|
||||
fencedCodeBlockStyleFor(markup)
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue