mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-02-18 19:28:05 +01:00
wip
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
This commit is contained in:
parent
6e243fa35b
commit
0241a979c4
10 changed files with 3298 additions and 58 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" +
|
||||
|
|
|
|||
|
|
@ -74,17 +74,17 @@ for (const rule of rules) {
|
|||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
// "severity": {
|
||||
// "description": "Rule severity",
|
||||
// "type": "string",
|
||||
// "enum": [
|
||||
// "error"
|
||||
// ],
|
||||
// "default": "error"
|
||||
// }
|
||||
"severity": {
|
||||
"description": "Rule severity",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"error"
|
||||
],
|
||||
"default": "error"
|
||||
}
|
||||
}
|
||||
};
|
||||
let custom = true;
|
||||
scheme.oneOf.push(subscheme);
|
||||
/* eslint-disable camelcase */
|
||||
switch (ruleName) {
|
||||
case "MD001":
|
||||
|
|
@ -638,13 +638,9 @@ for (const rule of rules) {
|
|||
};
|
||||
break;
|
||||
default:
|
||||
custom = false;
|
||||
break;
|
||||
}
|
||||
/* eslint-enable camelcase */
|
||||
if (custom) {
|
||||
scheme.oneOf.push(subscheme);
|
||||
}
|
||||
for (const name of rule.names) {
|
||||
schema.properties[name] = scheme;
|
||||
// Using $ref causes rule aliases not to get JSDoc comments
|
||||
|
|
|
|||
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