This commit is contained in:
David Anson 2025-09-15 22:24:06 -07:00
parent e857672728
commit 56cde85f72
5 changed files with 737 additions and 286 deletions

View file

@ -1281,97 +1281,97 @@ export interface ConfigurationStrict {
/** /**
* headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043 * headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
*/ */
headings?: boolean; headings?: boolean | "error";
/** /**
* bullet : MD004, MD005, MD007, MD032 * bullet : MD004, MD005, MD007, MD032
*/ */
bullet?: boolean; bullet?: boolean | "error";
/** /**
* ul : MD004, MD005, MD007, MD030, MD032 * ul : MD004, MD005, MD007, MD030, MD032
*/ */
ul?: boolean; ul?: boolean | "error";
/** /**
* indentation : MD005, MD007, MD027 * indentation : MD005, MD007, MD027
*/ */
indentation?: boolean; indentation?: boolean | "error";
/** /**
* whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039 * whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039
*/ */
whitespace?: boolean; whitespace?: boolean | "error";
/** /**
* hard_tab : MD010 * hard_tab : MD010
*/ */
hard_tab?: boolean; hard_tab?: boolean | "error";
/** /**
* links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059 * links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059
*/ */
links?: boolean; links?: boolean | "error";
/** /**
* blank_lines : MD012, MD022, MD031, MD032, MD047 * blank_lines : MD012, MD022, MD031, MD032, MD047
*/ */
blank_lines?: boolean; blank_lines?: boolean | "error";
/** /**
* line_length : MD013 * line_length : MD013
*/ */
line_length?: boolean; line_length?: boolean | "error";
/** /**
* code : MD014, MD031, MD038, MD040, MD046, MD048 * code : MD014, MD031, MD038, MD040, MD046, MD048
*/ */
code?: boolean; code?: boolean | "error";
/** /**
* atx : MD018, MD019 * atx : MD018, MD019
*/ */
atx?: boolean; atx?: boolean | "error";
/** /**
* spaces : MD018, MD019, MD020, MD021, MD023 * spaces : MD018, MD019, MD020, MD021, MD023
*/ */
spaces?: boolean; spaces?: boolean | "error";
/** /**
* atx_closed : MD020, MD021 * atx_closed : MD020, MD021
*/ */
atx_closed?: boolean; atx_closed?: boolean | "error";
/** /**
* blockquote : MD027, MD028 * blockquote : MD027, MD028
*/ */
blockquote?: boolean; blockquote?: boolean | "error";
/** /**
* ol : MD029, MD030, MD032 * ol : MD029, MD030, MD032
*/ */
ol?: boolean; ol?: boolean | "error";
/** /**
* html : MD033 * html : MD033
*/ */
html?: boolean; html?: boolean | "error";
/** /**
* url : MD034 * url : MD034
*/ */
url?: boolean; url?: boolean | "error";
/** /**
* hr : MD035 * hr : MD035
*/ */
hr?: boolean; hr?: boolean | "error";
/** /**
* emphasis : MD036, MD037, MD049, MD050 * emphasis : MD036, MD037, MD049, MD050
*/ */
emphasis?: boolean; emphasis?: boolean | "error";
/** /**
* language : MD040 * language : MD040
*/ */
language?: boolean; language?: boolean | "error";
/** /**
* spelling : MD044 * spelling : MD044
*/ */
spelling?: boolean; spelling?: boolean | "error";
/** /**
* accessibility : MD045, MD059 * accessibility : MD045, MD059
*/ */
accessibility?: boolean; accessibility?: boolean | "error";
/** /**
* images : MD045, MD052, MD053, MD054 * images : MD045, MD052, MD053, MD054
*/ */
images?: boolean; images?: boolean | "error";
/** /**
* table : MD055, MD056, MD058, MD060 * table : MD055, MD056, MD058, MD060
*/ */
table?: boolean; table?: boolean | "error";
} }

View file

@ -652,7 +652,10 @@ for (const rule of rules) {
for (const [ tag, tagTags ] of Object.entries(tags)) { for (const [ tag, tagTags ] of Object.entries(tags)) {
const scheme = { const scheme = {
"description": `${tag} : ${tagTags.join(", ")}`, "description": `${tag} : ${tagTags.join(", ")}`,
"type": "boolean", "oneOf": [
{ "type": "boolean" },
{ "enum": [ "error" ] }
],
"default": true "default": true
}; };
schema.properties[tag] = scheme; schema.properties[tag] = scheme;

View file

@ -2896,122 +2896,338 @@
}, },
"headings": { "headings": {
"description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043", "description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"bullet": { "bullet": {
"description": "bullet : MD004, MD005, MD007, MD032", "description": "bullet : MD004, MD005, MD007, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"ul": { "ul": {
"description": "ul : MD004, MD005, MD007, MD030, MD032", "description": "ul : MD004, MD005, MD007, MD030, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"indentation": { "indentation": {
"description": "indentation : MD005, MD007, MD027", "description": "indentation : MD005, MD007, MD027",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"whitespace": { "whitespace": {
"description": "whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039", "description": "whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"hard_tab": { "hard_tab": {
"description": "hard_tab : MD010", "description": "hard_tab : MD010",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"links": { "links": {
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059", "description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"blank_lines": { "blank_lines": {
"description": "blank_lines : MD012, MD022, MD031, MD032, MD047", "description": "blank_lines : MD012, MD022, MD031, MD032, MD047",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"line_length": { "line_length": {
"description": "line_length : MD013", "description": "line_length : MD013",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"code": { "code": {
"description": "code : MD014, MD031, MD038, MD040, MD046, MD048", "description": "code : MD014, MD031, MD038, MD040, MD046, MD048",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"atx": { "atx": {
"description": "atx : MD018, MD019", "description": "atx : MD018, MD019",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"spaces": { "spaces": {
"description": "spaces : MD018, MD019, MD020, MD021, MD023", "description": "spaces : MD018, MD019, MD020, MD021, MD023",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"atx_closed": { "atx_closed": {
"description": "atx_closed : MD020, MD021", "description": "atx_closed : MD020, MD021",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"blockquote": { "blockquote": {
"description": "blockquote : MD027, MD028", "description": "blockquote : MD027, MD028",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"ol": { "ol": {
"description": "ol : MD029, MD030, MD032", "description": "ol : MD029, MD030, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"html": { "html": {
"description": "html : MD033", "description": "html : MD033",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"url": { "url": {
"description": "url : MD034", "description": "url : MD034",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"hr": { "hr": {
"description": "hr : MD035", "description": "hr : MD035",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"emphasis": { "emphasis": {
"description": "emphasis : MD036, MD037, MD049, MD050", "description": "emphasis : MD036, MD037, MD049, MD050",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"language": { "language": {
"description": "language : MD040", "description": "language : MD040",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"spelling": { "spelling": {
"description": "spelling : MD044", "description": "spelling : MD044",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"accessibility": { "accessibility": {
"description": "accessibility : MD045, MD059", "description": "accessibility : MD045, MD059",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"images": { "images": {
"description": "images : MD045, MD052, MD053, MD054", "description": "images : MD045, MD052, MD053, MD054",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"table": { "table": {
"description": "table : MD055, MD056, MD058, MD060", "description": "table : MD055, MD056, MD058, MD060",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
} }
}, },

View file

@ -2896,122 +2896,338 @@
}, },
"headings": { "headings": {
"description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043", "description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"bullet": { "bullet": {
"description": "bullet : MD004, MD005, MD007, MD032", "description": "bullet : MD004, MD005, MD007, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"ul": { "ul": {
"description": "ul : MD004, MD005, MD007, MD030, MD032", "description": "ul : MD004, MD005, MD007, MD030, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"indentation": { "indentation": {
"description": "indentation : MD005, MD007, MD027", "description": "indentation : MD005, MD007, MD027",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"whitespace": { "whitespace": {
"description": "whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039", "description": "whitespace : MD009, MD010, MD012, MD027, MD028, MD030, MD037, MD038, MD039",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"hard_tab": { "hard_tab": {
"description": "hard_tab : MD010", "description": "hard_tab : MD010",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"links": { "links": {
"description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059", "description": "links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"blank_lines": { "blank_lines": {
"description": "blank_lines : MD012, MD022, MD031, MD032, MD047", "description": "blank_lines : MD012, MD022, MD031, MD032, MD047",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"line_length": { "line_length": {
"description": "line_length : MD013", "description": "line_length : MD013",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"code": { "code": {
"description": "code : MD014, MD031, MD038, MD040, MD046, MD048", "description": "code : MD014, MD031, MD038, MD040, MD046, MD048",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"atx": { "atx": {
"description": "atx : MD018, MD019", "description": "atx : MD018, MD019",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"spaces": { "spaces": {
"description": "spaces : MD018, MD019, MD020, MD021, MD023", "description": "spaces : MD018, MD019, MD020, MD021, MD023",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"atx_closed": { "atx_closed": {
"description": "atx_closed : MD020, MD021", "description": "atx_closed : MD020, MD021",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"blockquote": { "blockquote": {
"description": "blockquote : MD027, MD028", "description": "blockquote : MD027, MD028",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"ol": { "ol": {
"description": "ol : MD029, MD030, MD032", "description": "ol : MD029, MD030, MD032",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"html": { "html": {
"description": "html : MD033", "description": "html : MD033",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"url": { "url": {
"description": "url : MD034", "description": "url : MD034",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"hr": { "hr": {
"description": "hr : MD035", "description": "hr : MD035",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"emphasis": { "emphasis": {
"description": "emphasis : MD036, MD037, MD049, MD050", "description": "emphasis : MD036, MD037, MD049, MD050",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"language": { "language": {
"description": "language : MD040", "description": "language : MD040",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"spelling": { "spelling": {
"description": "spelling : MD044", "description": "spelling : MD044",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"accessibility": { "accessibility": {
"description": "accessibility : MD045, MD059", "description": "accessibility : MD045, MD059",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"images": { "images": {
"description": "images : MD045, MD052, MD053, MD054", "description": "images : MD045, MD052, MD053, MD054",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
}, },
"table": { "table": {
"description": "table : MD055, MD056, MD058, MD060", "description": "table : MD055, MD056, MD058, MD060",
"type": "boolean", "oneOf": [
{
"type": "boolean"
},
{
"enum": [
"error"
]
}
],
"default": true "default": true
} }
}, },

View file

@ -159,7 +159,7 @@ function normalizeLintResults(results) {
Object.entries(results).map( Object.entries(results).map(
([ source, errors ]) => [ ([ source, errors ]) => [
source, errors.map( source, errors.map(
({ lineNumber, ruleNames }) => `${ruleNames[0]} ${lineNumber}` ({ lineNumber, ruleNames, severity }) => `${ruleNames[0]} ${lineNumber} ${severity}`
) )
] ]
) )
@ -167,257 +167,273 @@ function normalizeLintResults(results) {
} }
/** /**
* Gets a Configuration default value test implementation. * Gets a Configuration value test implementation.
* *
* @param {(config: Configuration) => void} setDefault Sets the value of the Configuration default value. * @param {Configuration} config Configuration object.
* @param {string[]} files List of files.
* @param {NormalizedLintResults} expected Expected result. * @param {NormalizedLintResults} expected Expected result.
* @returns {ImplementationFn} Test implementation. * @returns {ImplementationFn} Test implementation.
*/ */
function getConfigDefaultTestImplementation(setDefault, expected) { function getConfigTestImplementation(config, files, expected) {
return async(t) => { return async(t) => {
t.plan(1); t.plan(1);
const options = { const options = {
"files": [ config,
"./test/atx_heading_spacing.md", files,
"./test/first_heading_bad_atx.md"
],
"config": {},
"noInlineConfig": true "noInlineConfig": true
}; };
setDefault(options.config);
const actual = await lintPromise(options); const actual = await lintPromise(options);
t.deepEqual(normalizeLintResults(actual), expected); t.deepEqual(normalizeLintResults(actual), expected);
}; };
} }
const configDefaultTestExpectedEnabled = { const configTestFiles = [
"./test/atx_heading_spacing.md": [ "./test/atx_heading_spacing.md",
"MD018 1", "./test/first_heading_bad_atx.md"
"MD019 3", ];
"MD019 5", const configTestExpected = {
"MD041 1"
],
"./test/first_heading_bad_atx.md": [
"MD041 1"
]
};
const configDefaultTestExpectedDisabled = {
"./test/atx_heading_spacing.md": [], "./test/atx_heading_spacing.md": [],
"./test/first_heading_bad_atx.md": [] "./test/first_heading_bad_atx.md": []
}; };
const configTestExpected1 = {
"./test/atx_heading_spacing.md": [
"MD018 1 error"
],
"./test/first_heading_bad_atx.md": []
};
const configTestExpected11 = {
"./test/atx_heading_spacing.md": [
"MD041 1 error"
],
"./test/first_heading_bad_atx.md": [
"MD041 1 error"
]
};
const configTestExpected135 = {
"./test/atx_heading_spacing.md": [
"MD018 1 error",
"MD019 3 error",
"MD019 5 error"
],
"./test/first_heading_bad_atx.md": []
};
const configTestExpected3511 = {
"./test/atx_heading_spacing.md": [
"MD019 3 error",
"MD019 5 error",
"MD041 1 error"
],
"./test/first_heading_bad_atx.md": [
"MD041 1 error"
]
};
const configTestExpected13511 = {
"./test/atx_heading_spacing.md": [
"MD018 1 error",
"MD019 3 error",
"MD019 5 error",
"MD041 1 error"
],
"./test/first_heading_bad_atx.md": [
"MD041 1 error"
]
};
test("defaultTrue", getConfigDefaultTestImplementation( test("defaultUnset", getConfigTestImplementation(
(config) => (config.default = true), {},
configDefaultTestExpectedEnabled configTestFiles,
configTestExpected13511
)); ));
test("defaultFalse", getConfigDefaultTestImplementation( test("defaultTrue", getConfigTestImplementation(
(config) => (config.default = false), { "default": true },
configDefaultTestExpectedDisabled configTestFiles,
configTestExpected13511
)); ));
test("defaultError", getConfigDefaultTestImplementation( test("defaultFalse", getConfigTestImplementation(
(config) => (config.default = "error"), { "default": false },
configDefaultTestExpectedEnabled configTestFiles,
configTestExpected
)); ));
test("defaultWarning", getConfigDefaultTestImplementation( test("defaultTruthy", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
(config) => (config.default = "warning"), { "default": 1 },
configDefaultTestExpectedEnabled configTestFiles,
configTestExpected13511
)); ));
test("defaultOff", getConfigDefaultTestImplementation( test("defaultFalsy", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
(config) => (config.default = "off"), { "default": 0 },
configDefaultTestExpectedEnabled configTestFiles,
configTestExpected
)); ));
test("defaultUnset", getConfigDefaultTestImplementation( test("defaultError", getConfigTestImplementation(
() => {}, { "default": "error" },
configDefaultTestExpectedEnabled configTestFiles,
configTestExpected13511
)); ));
test("disableRules", (t) => new Promise((resolve) => { test("defaultWarning", getConfigTestImplementation(
t.plan(2); // @ts-ignore
const options = { { "default": "warning" },
"files": [ configTestFiles,
"./test/atx_heading_spacing.md", configTestExpected13511
"./test/no_first_line_heading.md" ));
],
"config": {
"default": true,
"MD019": false,
"first-line-h1": false
},
"resultVersion": 0
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD018": [ 1 ]
},
"./test/no_first_line_heading.md": {}
};
// @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
resolve();
});
}));
test("enableRules", (t) => new Promise((resolve) => { test("defaultOff", getConfigTestImplementation(
t.plan(2); // @ts-ignore
const options = { { "default": "off" },
"files": [ configTestFiles,
"./test/atx_heading_spacing.md", configTestExpected13511
"./test/first_heading_bad_atx.md" ));
],
"config": {
"MD041": true,
"default": false,
"no-multiple-space-atx": true
},
"noInlineConfig": true,
"resultVersion": 0
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD019": [ 3, 5 ],
"MD041": [ 1 ]
},
"./test/first_heading_bad_atx.md": {
"MD041": [ 1 ]
}
};
// @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
resolve();
});
}));
test("enableRulesMixedCase", (t) => new Promise((resolve) => { test("disableRules", getConfigTestImplementation(
t.plan(2); {
const options = { "default": true,
"files": [ "MD019": false,
"./test/atx_heading_spacing.md", "first-line-h1": false,
"./test/first_heading_bad_atx.md" "extra": false
], },
"config": { configTestFiles,
"Md041": true, configTestExpected1
"DeFaUlT": false, ));
"nO-mUlTiPlE-sPaCe-AtX": true
},
"noInlineConfig": true,
"resultVersion": 0
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD019": [ 3, 5 ],
"MD041": [ 1 ]
},
"./test/first_heading_bad_atx.md": {
"MD041": [ 1 ]
}
};
// @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
resolve();
});
}));
test("disableTag", (t) => new Promise((resolve) => { test("disableRulesFalsy", getConfigTestImplementation(
t.plan(2); {
const options = { "default": true,
"files": [
"./test/atx_heading_spacing.md",
"./test/first_heading_bad_atx.md"
],
"config": {
"default": true,
"spaces": false
},
"noInlineConfig": true,
"resultVersion": 0
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD041": [ 1 ]
},
"./test/first_heading_bad_atx.md": {
"MD041": [ 1 ]
}
};
// @ts-ignore // @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues."); "MD019": 0,
resolve(); // @ts-ignore
}); "first-line-h1": 0,
})); "extra": 0
},
configTestFiles,
configTestExpected1
));
test("enableTag", (t) => new Promise((resolve) => { test("enableRules", getConfigTestImplementation(
t.plan(2); {
const options = { "MD041": true,
"files": [ "default": false,
"./test/atx_heading_spacing.md", "no-multiple-space-atx": true,
"./test/first_heading_bad_atx.md" "extra": true
], },
"config": { configTestFiles,
"default": false, configTestExpected3511
"spaces": true, ));
"notatag": true
},
"resultVersion": 0
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD018": [ 1 ],
"MD019": [ 3, 5 ]
},
"./test/first_heading_bad_atx.md": {}
};
// @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
resolve();
});
}));
test("enableTagMixedCase", (t) => new Promise((resolve) => { test("enableRulesMixedCase", getConfigTestImplementation(
t.plan(2); {
const options = { "Md041": true,
"files": [ "DeFaUlT": false,
"./test/atx_heading_spacing.md", "nO-mUlTiPlE-sPaCe-AtX": true,
"./test/first_heading_bad_atx.md" "ExTrA": true
], },
"config": { configTestFiles,
"DeFaUlT": false, configTestExpected3511
"SpAcEs": true, ));
"NoTaTaG": true
}, test("enableRulesTruthy", getConfigTestImplementation(
"resultVersion": 0 {
};
lintAsync(options, function callback(err, actualResult) {
t.falsy(err);
const expectedResult = {
"./test/atx_heading_spacing.md": {
"MD018": [ 1 ],
"MD019": [ 3, 5 ]
},
"./test/first_heading_bad_atx.md": {}
};
// @ts-ignore // @ts-ignore
t.deepEqual(actualResult, expectedResult, "Undetected issues."); "MD041": 1,
resolve(); "default": false,
}); // @ts-ignore
})); "no-multiple-space-atx": 1,
"extra": 1
},
configTestFiles,
configTestExpected3511
));
test("enableRulesString", getConfigTestImplementation(
{
"MD041": "error",
"default": false,
"no-multiple-space-atx": "error",
"extra": "error"
},
configTestFiles,
configTestExpected3511
));
test("enableRulesEmptyObject", getConfigTestImplementation(
{
"MD041": {},
"default": false,
// @ts-ignore
"no-multiple-space-atx": {},
"extra": {}
},
configTestFiles,
configTestExpected3511
));
test("disableTag", getConfigTestImplementation(
{
"default": true,
"spaces": false,
"extra": false
},
configTestFiles,
configTestExpected11
));
test("disableTagFalsy", getConfigTestImplementation(
{
"default": true,
// @ts-ignore
"spaces": 0,
"extra": 0
},
configTestFiles,
configTestExpected11
));
test("enableTag", getConfigTestImplementation(
{
"default": false,
"spaces": true,
"extra": true
},
configTestFiles,
configTestExpected135
));
test("enableTagMixedCase", getConfigTestImplementation(
{
"DeFaUlT": false,
"SpAcEs": true,
"ExTrA": true
},
configTestFiles,
configTestExpected135
));
test("enableTagTruthy", getConfigTestImplementation(
{
"default": false,
// @ts-ignore
"spaces": 1,
"extra": 1
},
configTestFiles,
configTestExpected135
));
test("enableTagString", getConfigTestImplementation(
{
"default": false,
"spaces": "error",
"extra": "error"
},
configTestFiles,
configTestExpected135
));
test("styleFiles", async(t) => { test("styleFiles", async(t) => {
t.plan(8); t.plan(8);