Incorporate markdownlint-rule-extended-ascii into tests, linting, and documentation.

This commit is contained in:
David Anson 2024-05-13 22:57:47 -07:00
parent 4a1b3550d3
commit 22f1f064fd
5 changed files with 54 additions and 15 deletions

View file

@ -343,9 +343,12 @@ test("customRulesNpmPackage", (t) => new Promise((resolve) => {
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../lib/markdownlint").Options */
const options = {
"customRules": [ require("./rules/npm") ],
"customRules": [
require("./rules/npm"),
require("markdownlint-rule-extended-ascii")
],
"strings": {
"string": "# Text\n\n---\n\nText\n"
"string": "# Text\n\n---\n\nText\n"
},
"resultVersion": 0
};
@ -353,6 +356,7 @@ test("customRulesNpmPackage", (t) => new Promise((resolve) => {
t.falsy(err);
const expectedResult = {};
expectedResult.string = {
"extended-ascii": [ 5 ],
"sample-rule": [ 3 ]
};
// @ts-ignore

View file

@ -73,16 +73,18 @@ test("simplePromise", (t) => {
});
});
const projectFiles = [
"*.md",
"doc/*.md",
"helpers/*.md",
"micromark/*.md",
"schema/*.md"
];
test("projectFiles", (t) => {
t.plan(2);
return import("globby")
.then((module) => module.globby([
"*.md",
"doc/*.md",
"helpers/*.md",
"micromark/*.md",
"schema/*.md"
]))
.then((module) => module.globby(projectFiles))
.then((files) => {
t.is(files.length, 60);
const options = {
@ -100,6 +102,34 @@ test("projectFiles", (t) => {
});
});
test("projectFilesExtendedAscii", (t) => {
t.plan(2);
return import("globby")
.then((module) => module.globby([
...projectFiles,
"!doc/Rules.md",
"!doc/md010.md",
"!doc/md026.md",
"!doc/md036.md"
]))
.then((files) => {
t.is(files.length, 56);
const options = {
files,
"config": require("../.markdownlint.json"),
"customRules": [ require("markdownlint-rule-extended-ascii") ]
};
// @ts-ignore
return markdownlint.promises.markdownlint(options).then((actual) => {
const expected = {};
for (const file of files) {
expected[file] = [];
}
t.deepEqual(actual, expected, "Issue(s) with project files.");
});
});
});
test("stringInputLineEndings", (t) => new Promise((resolve) => {
t.plan(2);
const options = {