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

@ -28,7 +28,7 @@ module.exports = {
"description": "Link and image style",
"tags": [ "images", "links" ],
"function": (params, onError) => {
const { parsers, config } = params;
const config = params.config;
const autolink = (config.autolink === undefined) || !!config.autolink;
const inline = (config.inline === undefined) || !!config.inline;
const full = (config.full === undefined) || !!config.full;
@ -39,12 +39,13 @@ module.exports = {
// Everything allowed, nothing to check
return;
}
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../helpers/micromark.cjs").Token[] */
const micromarkTokens =
// @ts-ignore
params.parsers.micromark.tokens;
const { definitions } = referenceLinkImageData();
const links = filterByTypes(
// eslint-disable-next-line dot-notation
parsers["micromark"].tokens,
[ "autolink", "image", "link" ]
);
const links = filterByTypes(micromarkTokens, [ "autolink", "image", "link" ]);
for (const link of links) {
let label = null;
let destination = null;