mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-02-09 23:24:20 +01:00
Add "severity"/"error" to rule in Configuration object, add corresponding documentation, resolve some new type-checking issues.
This commit is contained in:
parent
5c52efb4bb
commit
87ddc2e022
13 changed files with 4030 additions and 688 deletions
|
|
@ -6,14 +6,20 @@ import yaml from "js-yaml";
|
|||
import { __dirname, importWithTypeJson } from "../test/esm-helpers.mjs";
|
||||
const configSchema = await importWithTypeJson(import.meta, "../schema/markdownlint-config-schema.json");
|
||||
|
||||
/** @type {Object<string, any>} */
|
||||
const configExample = {};
|
||||
for (const rule in configSchema.properties) {
|
||||
if (/^(?:MD\d{3}|default|extends)$/.test(rule)) {
|
||||
const properties = configSchema.properties[rule];
|
||||
configExample[rule + "-description"] = properties.description;
|
||||
configExample[rule] = properties.default;
|
||||
const subproperties = properties.oneOf?.at(-1).properties;
|
||||
if (subproperties) {
|
||||
const subproperties = Object.fromEntries(
|
||||
Object.entries(
|
||||
properties.oneOf?.at(-1).properties || []
|
||||
).filter(([ key ]) => key !== "severity")
|
||||
);
|
||||
if (Object.keys(subproperties).length > 0) {
|
||||
/** @type {Object<string, any>} */
|
||||
const ruleExample = {};
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (const property in subproperties) {
|
||||
|
|
@ -26,6 +32,13 @@ for (const rule in configSchema.properties) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms comments to use the specified prefix.
|
||||
*
|
||||
* @param {string} input Markdown input.
|
||||
* @param {string} commentPrefix Comment prefix.
|
||||
* @returns {string} Transformed input.
|
||||
*/
|
||||
const transformComments = (input, commentPrefix) => (
|
||||
commentPrefix +
|
||||
" Example markdownlint configuration with all properties set to their default value\n" +
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue