Deprecate LintResults.toString() (at edit time; continue to support at run time), provide helper function formatLintResults, remove outdated grunt/gulp samples, improve typing.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled

This commit is contained in:
David Anson 2025-09-08 21:09:35 -07:00
parent 2a06f0a871
commit 616c3f2c22
18 changed files with 161 additions and 207 deletions

View file

@ -5,7 +5,7 @@ import path from "node:path";
import test from "ava";
import { characterEntities } from "character-entities";
import { gemoji } from "gemoji";
import helpers from "../helpers/helpers.cjs";
import helpers, { formatLintResults } from "../helpers/helpers.cjs";
import { lint } from "markdownlint/promise";
import { forEachInlineCodeSpan } from "../lib/markdownit.cjs";
import { getReferenceLinkImageData } from "../lib/cache.mjs";
@ -529,3 +529,17 @@ test("hasOverlap", (t) => {
t.false(helpers.hasOverlap(rangeB, rangeA), JSON.stringify({ rangeB, rangeA }));
}
});
test("formatLintResults", async(t) => {
t.plan(2);
t.deepEqual(formatLintResults(undefined), []);
const lintResults = await lint({ "strings": { "content": "# Heading <br/>" } });
t.deepEqual(
formatLintResults(lintResults),
[
"content: 1: MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: \"# Heading <br/>\"]",
"content: 1: MD033/no-inline-html Inline HTML [Element: br]",
"content: 1: MD047/single-trailing-newline Files should end with a single newline character"
]
);
});