mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Update customRulesParamsAreFrozen test to cover all parser variations.
This commit is contained in:
parent
d22c1f19ef
commit
a63972a666
1 changed files with 33 additions and 19 deletions
|
|
@ -1788,17 +1788,7 @@ test("customRulesAsyncThrowsInSyncContext", (t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("customRulesParamsAreFrozen", (t) => {
|
test("customRulesParamsAreFrozen", (t) => {
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
const assertParamsFrozen = (params) => {
|
||||||
/** @type import("../lib/markdownlint").Options */
|
|
||||||
const options = {
|
|
||||||
"customRules": [
|
|
||||||
{
|
|
||||||
"names": [ "name" ],
|
|
||||||
"description": "description",
|
|
||||||
"tags": [ "tag" ],
|
|
||||||
"parser": "none",
|
|
||||||
"function":
|
|
||||||
(params) => {
|
|
||||||
const pending = [ params ];
|
const pending = [ params ];
|
||||||
let current = null;
|
let current = null;
|
||||||
while ((current = pending.shift())) {
|
while ((current = pending.shift())) {
|
||||||
|
|
@ -1814,7 +1804,31 @@ test("customRulesParamsAreFrozen", (t) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
|
/** @type import("../lib/markdownlint").Options */
|
||||||
|
const options = {
|
||||||
|
"customRules": [
|
||||||
|
{
|
||||||
|
"names": [ "none" ],
|
||||||
|
"description": "description",
|
||||||
|
"tags": [ "tag" ],
|
||||||
|
"parser": "none",
|
||||||
|
"function": assertParamsFrozen
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"names": [ "markdownit" ],
|
||||||
|
"description": "description",
|
||||||
|
"tags": [ "tag" ],
|
||||||
|
"parser": "markdownit",
|
||||||
|
"function": assertParamsFrozen
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"names": [ "micromark" ],
|
||||||
|
"description": "description",
|
||||||
|
"tags": [ "tag" ],
|
||||||
|
"parser": "micromark",
|
||||||
|
"function": assertParamsFrozen
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"files": [ "README.md" ]
|
"files": [ "README.md" ]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue