Skip to content

Commit 9c8e715

Browse files
committed
Create strict JSON Schema for configuration (standalone for ease of use) and corresponding strict TypeScript type (via extends for conciseness) (fixes #1248).
1 parent bbca3ad commit 9c8e715

10 files changed

Lines changed: 3070 additions & 1207 deletions

demo/markdownlint-browser.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,6 +3140,13 @@ module.exports = markdownlint;
31403140
* @typedef {import("./configuration").Configuration} Configuration
31413141
*/
31423142

3143+
/**
3144+
* Configuration object for linting rules strictly. For the JSON schema, see
3145+
* {@link ../schema/markdownlint-config-schema-strict.json}.
3146+
*
3147+
* @typedef {import("./configuration-strict").ConfigurationStrict} ConfigurationStrict
3148+
*/
3149+
31433150
/**
31443151
* Rule configuration object.
31453152
*

example/typescript/type-check.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,20 @@ markdownlint(options, assertLintResultsCallback);
164164
(async () => {
165165
assertLintResultsCallback(null, await markdownlint.promises.markdownlint(options));
166166
})();
167+
168+
const configuration: markdownlint.Configuration = {
169+
"custom-rule": true,
170+
"no-hard-tabs": false,
171+
"heading-style": {
172+
"style": "consistent"
173+
}
174+
};
175+
assert(configuration);
176+
const configurationStrict: markdownlint.ConfigurationStrict = {
177+
// "custom-rule": true,
178+
"no-hard-tabs": false,
179+
"heading-style": {
180+
"style": "consistent"
181+
}
182+
};
183+
assert(configurationStrict);

0 commit comments

Comments
 (0)