Add "enabled" and "severity"/"warning" to rule in Configuration object, add corresponding documentation and tests, update demo web app (fixes #254)”.
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-22 21:39:09 -07:00
parent 87ddc2e022
commit 0f5a8c701e
20 changed files with 3792 additions and 867 deletions

View file

@ -347,6 +347,7 @@ test("getPreferredLineEnding", (t) => {
const actual = helpers.getPreferredLineEnding(input);
t.is(actual, expected, "Incorrect line ending returned.");
}
// @ts-ignore
t.is(helpers.getPreferredLineEnding("", null), "\n");
t.is(helpers.getPreferredLineEnding("", { "EOL": "\n" }), "\n");
t.is(helpers.getPreferredLineEnding("", { "EOL": "\r\n" }), "\r\n");
@ -358,29 +359,37 @@ test("expandTildePath", (t) => {
const homedir = os.homedir();
t.is(helpers.expandTildePath("", os), "");
t.is(helpers.expandTildePath("", {}), "");
// @ts-ignore
t.is(helpers.expandTildePath("", null), "");
t.is(
path.resolve(helpers.expandTildePath("~", os)),
homedir
);
// @ts-ignore
t.is(helpers.expandTildePath("~", null), "~");
t.is(helpers.expandTildePath("file", os), "file");
// @ts-ignore
t.is(helpers.expandTildePath("file", null), "file");
t.is(helpers.expandTildePath("/file", os), "/file");
// @ts-ignore
t.is(helpers.expandTildePath("/file", null), "/file");
t.is(
path.resolve(helpers.expandTildePath("~/file", os)),
path.join(homedir, "/file")
);
// @ts-ignore
t.is(helpers.expandTildePath("~/file", null), "~/file");
t.is(helpers.expandTildePath("dir/file", os), "dir/file");
// @ts-ignore
t.is(helpers.expandTildePath("dir/file", null), "dir/file");
t.is(helpers.expandTildePath("/dir/file", os), "/dir/file");
// @ts-ignore
t.is(helpers.expandTildePath("/dir/file", null), "/dir/file");
t.is(
path.resolve(helpers.expandTildePath("~/dir/file", os)),
path.join(homedir, "/dir/file")
);
// @ts-ignore
t.is(helpers.expandTildePath("~/dir/file", null), "~/dir/file");
});
@ -396,6 +405,7 @@ test("getReferenceLinkImageData().shortcuts", (t) => {
"parser": "none",
"function":
() => {
// @ts-ignore
const { shortcuts } = getReferenceLinkImageData();
t.is(shortcuts.size, 0, [ ...shortcuts.keys() ].join(", "));
}
@ -533,14 +543,14 @@ test("hasOverlap", (t) => {
test("formatLintResults", async(t) => {
t.plan(2);
t.deepEqual(formatLintResults(undefined), []);
const lintResults = await lint({ "strings": { "content": "# Heading\n<br/>" } });
const lintResults = await lint({ "strings": { "content": "# Heading\n<br/><!-- markdownlint-configure-file { \"MD033\": \"warning\" } -->" } });
t.deepEqual(
formatLintResults(lintResults),
[
"content:1:3 error MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: \"# Heading\"]",
"content:1 error MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: \"# Heading\"]",
"content:2:1 error MD033/no-inline-html Inline HTML [Element: br]",
"content:2:5 error MD047/single-trailing-newline Files should end with a single newline character"
"content:2:1 warning MD033/no-inline-html Inline HTML [Element: br]",
"content:2:64 error MD047/single-trailing-newline Files should end with a single newline character"
]
);
});