Convert markdownlint library to an ECMAScript module, replace markdownlint-micromark with micromark, stop publishing (large) markdownlint-browser.js, see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for guidance.

This commit is contained in:
David Anson 2024-11-28 20:36:44 -08:00
parent 191226f070
commit 1e71f6f44e
140 changed files with 1087 additions and 10428 deletions

View file

@ -2,9 +2,9 @@
import fs from "node:fs/promises";
import test from "ava";
import { newLineRe } from "../helpers/helpers.js";
import { newLineRe } from "../helpers/helpers.cjs";
import { filterByPredicate, filterByTypes } from "../helpers/micromark-helpers.cjs";
import { getEvents, parse } from "../helpers/micromark-parse.cjs";
import { getEvents, parse } from "../helpers/micromark-parse.mjs";
const testContent = new Promise((resolve, reject) => {
fs
@ -49,8 +49,7 @@ test("getEvents/filterByPredicate", async(t) => {
test("filterByTypes, htmlFlow false", async(t) => {
t.plan(7);
const tokens = await testTokens;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../micromark/micromark.cjs").TokenType[] */
/** @type {import("micromark-util-types").TokenType[]} */
const types = [ "atxHeadingText", "codeText", "htmlText", "setextHeadingText" ];
const filtered = filterByTypes(tokens, types);
// Using flat tokens
@ -67,8 +66,7 @@ test("filterByTypes, htmlFlow false", async(t) => {
test("filterByTypes, htmlFlow true", async(t) => {
t.plan(9);
const tokens = await testTokens;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../micromark/micromark.cjs").TokenType[] */
/** @type {import("micromark-util-types").TokenType[]} */
const types = [ "atxHeadingText", "codeText", "htmlText", "setextHeadingText" ];
// Using flat tokens
const filtered = filterByTypes(tokens, types, true);