markdownlint 0.21.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,410 +0,0 @@
1
- // @ts-check
2
-
3
- "use strict";
4
-
5
- const fs = require("fs");
6
- const path = require("path");
7
- const rules = require("../lib/rules");
8
-
9
- // Schema scaffolding
10
- const schema = {
11
- "title": "Markdownlint configuration schema",
12
- "type": "object",
13
- "properties": {
14
- "default": {
15
- "description": "Default state for all rules",
16
- "type": "boolean",
17
- "default": true
18
- },
19
- "extends": {
20
- "description": "Path to configuration file to extend",
21
- "type": "string",
22
- "default": null
23
- },
24
- "$schema": {
25
- "description": "JSON Schema URI (used by some editors)",
26
- "type": "string",
27
- "default": "https://raw.githubusercontent.com/DavidAnson/markdownlint" +
28
- "/main/schema/markdownlint-config-schema.json"
29
- }
30
- },
31
- "additionalProperties": {
32
- "type:": [
33
- "boolean",
34
- "object"
35
- ]
36
- }
37
- };
38
- const tags = {};
39
-
40
- // Add rules
41
- // eslint-disable-next-line complexity
42
- rules.forEach(function forRule(rule) {
43
- rule.tags.forEach(function forTag(tag) {
44
- const tagRules = tags[tag] || [];
45
- tagRules.push(rule.names[0]);
46
- tags[tag] = tagRules;
47
- });
48
- const scheme = {
49
- "description": rule.names.join("/") + " - " + rule.description,
50
- "type": "boolean",
51
- "default": true
52
- };
53
- let custom = true;
54
- switch (rule.names[0]) {
55
- case "MD002":
56
- scheme.properties = {
57
- "level": {
58
- "description": "Heading level",
59
- "type": "integer",
60
- "default": 1
61
- }
62
- };
63
- break;
64
- case "MD003":
65
- scheme.properties = {
66
- "style": {
67
- "description": "Heading style",
68
- "type": "string",
69
- "enum": [
70
- "consistent",
71
- "atx",
72
- "atx_closed",
73
- "setext",
74
- "setext_with_atx",
75
- "setext_with_atx_closed"
76
- ],
77
- "default": "consistent"
78
- }
79
- };
80
- break;
81
- case "MD004":
82
- scheme.properties = {
83
- "style": {
84
- "description": "List style",
85
- "type": "string",
86
- "enum": [
87
- "consistent",
88
- "asterisk",
89
- "plus",
90
- "dash",
91
- "sublist"
92
- ],
93
- "default": "consistent"
94
- }
95
- };
96
- break;
97
- case "MD007":
98
- scheme.properties = {
99
- "indent": {
100
- "description": "Spaces for indent",
101
- "type": "integer",
102
- "default": 2
103
- },
104
- "start_indented": {
105
- "description": "Whether to indent the first level of the list",
106
- "type": "boolean",
107
- "default": false
108
- }
109
- };
110
- break;
111
- case "MD009":
112
- scheme.properties = {
113
- "br_spaces": {
114
- "description": "Spaces for line break",
115
- "type": "integer",
116
- "default": 2
117
- },
118
- "list_item_empty_lines": {
119
- "description": "Allow spaces for empty lines in list items",
120
- "type": "boolean",
121
- "default": false
122
- },
123
- "strict": {
124
- "description": "Include unnecessary breaks",
125
- "type": "boolean",
126
- "default": false
127
- }
128
- };
129
- break;
130
- case "MD010":
131
- scheme.properties = {
132
- "code_blocks": {
133
- "description": "Include code blocks",
134
- "type": "boolean",
135
- "default": true
136
- }
137
- };
138
- break;
139
- case "MD012":
140
- scheme.properties = {
141
- "maximum": {
142
- "description": "Consecutive blank lines",
143
- "type": "integer",
144
- "default": 1
145
- }
146
- };
147
- break;
148
- case "MD013":
149
- scheme.properties = {
150
- "line_length": {
151
- "description": "Number of characters",
152
- "type": "integer",
153
- "default": 80
154
- },
155
- "heading_line_length": {
156
- "description": "Number of characters for headings",
157
- "type": "integer",
158
- "default": 80
159
- },
160
- "code_block_line_length": {
161
- "description": "Number of characters for code blocks",
162
- "type": "integer",
163
- "default": 80
164
- },
165
- "code_blocks": {
166
- "description": "Include code blocks",
167
- "type": "boolean",
168
- "default": true
169
- },
170
- "tables": {
171
- "description": "Include tables",
172
- "type": "boolean",
173
- "default": true
174
- },
175
- "headings": {
176
- "description": "Include headings",
177
- "type": "boolean",
178
- "default": true
179
- },
180
- "headers": {
181
- "description": "Include headings",
182
- "type": "boolean",
183
- "default": true
184
- },
185
- "strict": {
186
- "description": "Strict length checking",
187
- "type": "boolean",
188
- "default": false
189
- },
190
- "stern": {
191
- "description": "Stern length checking",
192
- "type": "boolean",
193
- "default": false
194
- }
195
- };
196
- break;
197
- case "MD022":
198
- scheme.properties = {
199
- "lines_above": {
200
- "description": "Blank lines above heading",
201
- "type": "integer",
202
- "default": 1
203
- },
204
- "lines_below": {
205
- "description": "Blank lines below heading",
206
- "type": "integer",
207
- "default": 1
208
- }
209
- };
210
- break;
211
- case "MD024":
212
- scheme.properties = {
213
- "allow_different_nesting": {
214
- "description": "Only check sibling headings",
215
- "type": "boolean",
216
- "default": false
217
- },
218
- "siblings_only": {
219
- "description": "Only check sibling headings",
220
- "type": "boolean",
221
- "default": false
222
- }
223
- };
224
- break;
225
- case "MD026":
226
- case "MD036":
227
- scheme.properties = {
228
- "punctuation": {
229
- "description": "Punctuation characters",
230
- "type": "string",
231
- "default": ".,;:!?。,;:!?"
232
- }
233
- };
234
- break;
235
- case "MD029":
236
- scheme.properties = {
237
- "style": {
238
- "description": "List style",
239
- "type": "string",
240
- "enum": [
241
- "one",
242
- "ordered",
243
- "one_or_ordered",
244
- "zero"
245
- ],
246
- "default": "one_or_ordered"
247
- }
248
- };
249
- break;
250
- case "MD030":
251
- scheme.properties = {
252
- "ul_single": {
253
- "description": "Spaces for single-line unordered list items",
254
- "type": "integer",
255
- "default": 1
256
- },
257
- "ol_single": {
258
- "description": "Spaces for single-line ordered list items",
259
- "type": "integer",
260
- "default": 1
261
- },
262
- "ul_multi": {
263
- "description": "Spaces for multi-line unordered list items",
264
- "type": "integer",
265
- "default": 1
266
- },
267
- "ol_multi": {
268
- "description": "Spaces for multi-line ordered list items",
269
- "type": "integer",
270
- "default": 1
271
- }
272
- };
273
- break;
274
- case "MD031":
275
- scheme.properties = {
276
- "list_items": {
277
- "description": "Include list items",
278
- "type": "boolean",
279
- "default": true
280
- }
281
- };
282
- break;
283
- case "MD033":
284
- scheme.properties = {
285
- "allowed_elements": {
286
- "description": "Allowed elements",
287
- "type": "array",
288
- "items": {
289
- "type": "string"
290
- },
291
- "default": []
292
- }
293
- };
294
- break;
295
- case "MD035":
296
- scheme.properties = {
297
- "style": {
298
- "description": "Horizontal rule style",
299
- "type": "string",
300
- "default": "consistent"
301
- }
302
- };
303
- break;
304
- case "MD025":
305
- case "MD041":
306
- scheme.properties = {
307
- "level": {
308
- "description": "Heading level",
309
- "type": "integer",
310
- "default": 1
311
- },
312
- "front_matter_title": {
313
- "description": "RegExp for matching title in front matter",
314
- "type": "string",
315
- "default": "^\\s*title\\s*[:=]"
316
- }
317
- };
318
- break;
319
- case "MD043":
320
- scheme.properties = {
321
- "headings": {
322
- "description": "List of headings",
323
- "type": "array",
324
- "items": {
325
- "type": "string"
326
- },
327
- "default": null
328
- },
329
- "headers": {
330
- "description": "List of headings",
331
- "type": "array",
332
- "items": {
333
- "type": "string"
334
- },
335
- "default": null
336
- }
337
- };
338
- break;
339
- case "MD044":
340
- scheme.properties = {
341
- "names": {
342
- "description": "List of proper names",
343
- "type": "array",
344
- "items": {
345
- "type": "string"
346
- },
347
- "default": null
348
- },
349
- "code_blocks": {
350
- "description": "Include code blocks",
351
- "type": "boolean",
352
- "default": true
353
- }
354
- };
355
- break;
356
- case "MD046":
357
- scheme.properties = {
358
- "style": {
359
- "description": "Block style",
360
- "type": "string",
361
- "enum": [
362
- "consistent",
363
- "fenced",
364
- "indented"
365
- ],
366
- "default": "consistent"
367
- }
368
- };
369
- break;
370
- case "MD048":
371
- scheme.properties = {
372
- "style": {
373
- "description": "Code fence syle",
374
- "type": "string",
375
- "enum": [
376
- "consistent",
377
- "backtick",
378
- "tilde"
379
- ],
380
- "default": "consistent"
381
- }
382
- };
383
- break;
384
- default:
385
- custom = false;
386
- break;
387
- }
388
- if (custom) {
389
- // @ts-ignore
390
- scheme.type = [ "boolean", "object" ];
391
- scheme.additionalProperties = false;
392
- }
393
- rule.names.forEach(function forName(name) {
394
- schema.properties[name] = scheme;
395
- });
396
- });
397
-
398
- // Add tags
399
- Object.keys(tags).forEach(function forTag(tag) {
400
- const scheme = {
401
- "description": tag + " - " + tags[tag].join(", "),
402
- "type": "boolean",
403
- "default": true
404
- };
405
- schema.properties[tag] = scheme;
406
- });
407
-
408
- // Write schema
409
- const schemaFile = path.join(__dirname, "markdownlint-config-schema.json");
410
- fs.writeFileSync(schemaFile, JSON.stringify(schema, null, " "));