Use @type to provide typing for all instances of params.parsers.micromark.tokens.

This commit is contained in:
David Anson 2024-02-28 21:01:23 -08:00
parent aee8c2d1d3
commit 828ae3541a
23 changed files with 284 additions and 160 deletions

View file

@ -42,12 +42,16 @@ module.exports = {
"description": "Lists should be surrounded by blank lines",
"tags": [ "bullet", "ul", "ol", "blank_lines" ],
"function": function MD032(params, onError) {
const { lines, parsers } = params;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../helpers/micromark.cjs").Token[] */
const micromarkTokens =
// @ts-ignore
params.parsers.micromark.tokens;
const { lines } = params;
// For every top-level list...
const topLevelLists = filterByPredicate(
// eslint-disable-next-line dot-notation
parsers["micromark"].tokens,
micromarkTokens,
isList,
(token) => (
(isList(token) || (token.type === "htmlFlow")) ? [] : token.children