mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Refactor MD032/blanks-around-lists to remove redundant micromark flattenedChildren function.
This commit is contained in:
parent
84e664e86e
commit
96a36de713
3 changed files with 11 additions and 42 deletions
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
const { addErrorContext, blockquotePrefixRe, isBlankLine } =
|
||||
require("../helpers");
|
||||
const { filterByPredicate, flattenedChildren } =
|
||||
require("../helpers/micromark.cjs");
|
||||
const { filterByPredicate } = require("../helpers/micromark.cjs");
|
||||
|
||||
const nonContentTokens = new Set([
|
||||
"blockQuoteMarker",
|
||||
|
|
@ -59,7 +58,11 @@ module.exports = {
|
|||
|
||||
// Find the "visual" end of the list
|
||||
let endLine = list.endLine;
|
||||
for (const child of flattenedChildren(list).reverse()) {
|
||||
const flattenedChildren = filterByPredicate(
|
||||
list.children,
|
||||
() => true
|
||||
);
|
||||
for (const child of flattenedChildren.reverse()) {
|
||||
if (!nonContentTokens.has(child.type)) {
|
||||
endLine = child.endLine;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue