mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Refactor build-config-schema.mjs slightly to reuse code.
This commit is contained in:
parent
95f82760ce
commit
9b46692b8d
1 changed files with 6 additions and 26 deletions
|
@ -50,9 +50,10 @@ const tags = {};
|
|||
|
||||
// Add rules
|
||||
for (const rule of rules) {
|
||||
const ruleName = rule.names[0];
|
||||
for (const tag of rule.tags) {
|
||||
const tagRules = tags[tag] || [];
|
||||
tagRules.push(rule.names[0]);
|
||||
tagRules.push(ruleName);
|
||||
tags[tag] = tagRules;
|
||||
}
|
||||
const scheme = {
|
||||
|
@ -62,7 +63,7 @@ for (const rule of rules) {
|
|||
"default": true
|
||||
};
|
||||
let custom = true;
|
||||
switch (rule.names[0]) {
|
||||
switch (ruleName) {
|
||||
case "MD003":
|
||||
scheme.properties = {
|
||||
"style": {
|
||||
|
@ -256,20 +257,12 @@ for (const rule of rules) {
|
|||
};
|
||||
break;
|
||||
case "MD026":
|
||||
scheme.properties = {
|
||||
"punctuation": {
|
||||
"description": "Punctuation characters",
|
||||
"type": "string",
|
||||
"default": ".,;:!。,;:!"
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "MD036":
|
||||
scheme.properties = {
|
||||
"punctuation": {
|
||||
"description": "Punctuation characters",
|
||||
"type": "string",
|
||||
"default": ".,;:!?。,;:!?"
|
||||
"default": (ruleName === "MD026") ? ".,;:!。,;:!" : ".,;:!?。,;:!?"
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
@ -458,23 +451,10 @@ for (const rule of rules) {
|
|||
};
|
||||
break;
|
||||
case "MD049":
|
||||
scheme.properties = {
|
||||
"style": {
|
||||
"description": "Emphasis style",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"consistent",
|
||||
"asterisk",
|
||||
"underscore"
|
||||
],
|
||||
"default": "consistent"
|
||||
}
|
||||
};
|
||||
break;
|
||||
case "MD050":
|
||||
scheme.properties = {
|
||||
"style": {
|
||||
"description": "Strong style",
|
||||
"description": (ruleName === "MD049") ? "Emphasis style" : "Strong style",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"consistent",
|
||||
|
@ -595,7 +575,7 @@ for (const rule of rules) {
|
|||
schema.properties[name] = scheme;
|
||||
// Using $ref causes rule aliases not to get JSDoc comments
|
||||
// schema.properties[name] = (index === 0) ? scheme : {
|
||||
// "$ref": `#/properties/${rule.names[0]}`
|
||||
// "$ref": `#/properties/${firstName}`
|
||||
// };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue