Generate TypeScript declaration for Configuration object from JSON schema (refs #1004, refs #1014).

This commit is contained in:
David Anson 2023-11-08 19:49:02 -08:00
parent b3f0e529cf
commit d4bfb633bb
7 changed files with 2192 additions and 73 deletions

1268
lib/configuration.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -358,12 +358,10 @@ type FixInfo = {
*/
type LintContentCallback = (error: Error | null, result?: LintError[]) => void;
/**
* Configuration object for linting rules. For a detailed schema, see
* Configuration object for linting rules. For the JSON schema, see
* {@link ../schema/markdownlint-config-schema.json}.
*/
type Configuration = {
[x: string]: RuleConfiguration;
};
type Configuration = import("./configuration").Configuration;
/**
* Rule configuration.
*/

View file

@ -317,6 +317,7 @@ function getEffectiveConfig(ruleList, config, aliasToRuleNames) {
(key) => key.toUpperCase() === "DEFAULT"
);
const ruleDefault = (defaultKey.length === 0) || !!config[defaultKey[0]];
/** @type {Configuration} */
const effectiveConfig = {};
for (const rule of ruleList) {
const ruleName = rule.names[0].toUpperCase();
@ -1436,10 +1437,10 @@ module.exports = markdownlint;
*/
/**
* Configuration object for linting rules. For a detailed schema, see
* Configuration object for linting rules. For the JSON schema, see
* {@link ../schema/markdownlint-config-schema.json}.
*
* @typedef {Object.<string, RuleConfiguration>} Configuration
* @typedef {import("./configuration").Configuration} Configuration
*/
/**