markdownlint 0.41.0 → 0.41.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.
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/doc/Rules.md +11 -1
- package/doc/md029.md +11 -1
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +10 -3
- package/helpers/micromark-helpers.cjs +1 -2
- package/helpers/shared.cjs +1 -1
- package/lib/cache.mjs +1 -0
- package/lib/configuration-strict.d.ts +108 -108
- package/lib/constants.mjs +1 -1
- package/lib/markdownlint.mjs +5 -2
- package/lib/md004.mjs +1 -0
- package/lib/md005.mjs +1 -1
- package/lib/md019-md021.mjs +1 -0
- package/lib/md022.mjs +1 -0
- package/lib/md024.mjs +1 -1
- package/lib/md029.mjs +34 -22
- package/lib/md032.mjs +5 -4
- package/lib/md037.mjs +1 -2
- package/lib/md051.mjs +1 -0
- package/lib/micromark-parse.mjs +2 -1
- package/lib/resolve-module.cjs +3 -2
- package/package.json +14 -12
- package/schema/.markdownlint.jsonc +53 -53
- package/schema/.markdownlint.yaml +75 -75
- package/schema/markdownlint-config-schema-strict.json +110 -110
- package/schema/markdownlint-config-schema.json +110 -110
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -970,7 +970,7 @@ All of which return an object like:
|
|
|
970
970
|
{ "lineNumber": 3,
|
|
971
971
|
"ruleNames": [ "MD010", "no-hard-tabs" ],
|
|
972
972
|
"ruleDescription": "Hard tabs",
|
|
973
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
973
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md",
|
|
974
974
|
"errorDetail": "Column: 17",
|
|
975
975
|
"errorContext": null,
|
|
976
976
|
"errorRange": [ 17, 1 ],
|
|
@@ -979,7 +979,7 @@ All of which return an object like:
|
|
|
979
979
|
{ "lineNumber": 1,
|
|
980
980
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
981
981
|
"ruleDescription": "No space after hash on atx style heading",
|
|
982
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
982
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md",
|
|
983
983
|
"errorDetail": null,
|
|
984
984
|
"errorContext": "#bad.md",
|
|
985
985
|
"errorRange": [ 1, 2 ],
|
|
@@ -988,7 +988,7 @@ All of which return an object like:
|
|
|
988
988
|
{ "lineNumber": 3,
|
|
989
989
|
"ruleNames": [ "MD018", "no-missing-space-atx" ],
|
|
990
990
|
"ruleDescription": "No space after hash on atx style heading",
|
|
991
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
991
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md",
|
|
992
992
|
"errorDetail": null,
|
|
993
993
|
"errorContext": "#This file fails\tsome rules.",
|
|
994
994
|
"errorRange": [ 1, 2 ],
|
|
@@ -997,7 +997,7 @@ All of which return an object like:
|
|
|
997
997
|
{ "lineNumber": 1,
|
|
998
998
|
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
|
|
999
999
|
"ruleDescription": "First line in a file should be a top-level heading",
|
|
1000
|
-
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
1000
|
+
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md",
|
|
1001
1001
|
"errorDetail": null,
|
|
1002
1002
|
"errorContext": "#bad.md",
|
|
1003
1003
|
"errorRange": null,
|
package/doc/Rules.md
CHANGED
|
@@ -1110,7 +1110,8 @@ Example invalid list for all styles:
|
|
|
1110
1110
|
3. Done.
|
|
1111
1111
|
```
|
|
1112
1112
|
|
|
1113
|
-
This rule supports 0-prefixing
|
|
1113
|
+
This rule supports 0-prefixing list items for uniform indentation and will
|
|
1114
|
+
preserve that when fixing:
|
|
1114
1115
|
|
|
1115
1116
|
```markdown
|
|
1116
1117
|
...
|
|
@@ -1118,7 +1119,16 @@ This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
|
1118
1119
|
09. Item
|
|
1119
1120
|
10. Item
|
|
1120
1121
|
11. Item
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
When list items appear to be right-aligned, fixes will maintain that alignment:
|
|
1125
|
+
|
|
1126
|
+
```markdown
|
|
1121
1127
|
...
|
|
1128
|
+
8. Item
|
|
1129
|
+
9. Item
|
|
1130
|
+
10. Item
|
|
1131
|
+
11. Item
|
|
1122
1132
|
```
|
|
1123
1133
|
|
|
1124
1134
|
Note: This rule will report violations for cases like the following where an
|
package/doc/md029.md
CHANGED
|
@@ -55,7 +55,8 @@ Example invalid list for all styles:
|
|
|
55
55
|
3. Done.
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
This rule supports 0-prefixing
|
|
58
|
+
This rule supports 0-prefixing list items for uniform indentation and will
|
|
59
|
+
preserve that when fixing:
|
|
59
60
|
|
|
60
61
|
```markdown
|
|
61
62
|
...
|
|
@@ -63,7 +64,16 @@ This rule supports 0-prefixing ordered list items for uniform indentation:
|
|
|
63
64
|
09. Item
|
|
64
65
|
10. Item
|
|
65
66
|
11. Item
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
When list items appear to be right-aligned, fixes will maintain that alignment:
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
66
72
|
...
|
|
73
|
+
8. Item
|
|
74
|
+
9. Item
|
|
75
|
+
10. Item
|
|
76
|
+
11. Item
|
|
67
77
|
```
|
|
68
78
|
|
|
69
79
|
Note: This rule will report violations for cases like the following where an
|
package/helpers/README.md
CHANGED
|
@@ -22,8 +22,8 @@ be useful to custom rule authors and may avoid duplicating code.
|
|
|
22
22
|
*None* - The entire body of code is tested to 100% coverage by the core
|
|
23
23
|
`markdownlint` project, so there are no additional tests here.
|
|
24
24
|
|
|
25
|
-
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
25
|
+
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/CustomRules.md
|
|
26
26
|
[jsdoc]: https://wikipedia.org/wiki/JSDoc
|
|
27
27
|
[markdown]: https://wikipedia.org/wiki/Markdown
|
|
28
28
|
[markdownlint]: https://github.com/DavidAnson/markdownlint
|
|
29
|
-
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.41.
|
|
29
|
+
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/Rules.md
|
package/helpers/helpers.cjs
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/* eslint-disable unicorn/comment-content */
|
|
6
6
|
|
|
7
|
+
const micromark = require("./micromark-helpers.cjs");
|
|
7
8
|
const { newlineRe, nextLinesRe } = require("./shared.cjs");
|
|
8
9
|
|
|
9
10
|
module.exports.newLineRe = newlineRe;
|
|
@@ -20,6 +21,7 @@ module.exports.nextLinesRe = nextLinesRe;
|
|
|
20
21
|
// Regular expression for matching common front matter (YAML and TOML)
|
|
21
22
|
// @ts-ignore
|
|
22
23
|
module.exports.frontMatterRe =
|
|
24
|
+
// eslint-disable-next-line unicorn/prefer-unicode-code-point-escapes
|
|
23
25
|
/((^---[^\S\r\n\u2028\u2029]*$[\s\S]+?^---\s*)|(^\+\+\+[^\S\r\n\u2028\u2029]*$[\s\S]+?^(\+\+\+|\.\.\.)\s*)|(^\{[^\S\r\n\u2028\u2029]*$[\s\S]+?^\}\s*))(\r\n|\r|\n|$)/m;
|
|
24
26
|
|
|
25
27
|
// Regular expression for matching the start of inline disable/enable comments
|
|
@@ -178,6 +180,7 @@ const startsWithPipeRe = /^ *\|/;
|
|
|
178
180
|
const notCrLfRe = /[^\r\n]/g;
|
|
179
181
|
const notSpaceCrLfRe = /[^ \r\n]/g;
|
|
180
182
|
const trailingSpaceRe = / +[\r\n]/g;
|
|
183
|
+
// eslint-disable-next-line unicorn/no-unsafe-string-replacement
|
|
181
184
|
const replaceTrailingSpace = (/** @type {string} */ s) => s.replace(notCrLfRe, safeCommentCharacter);
|
|
182
185
|
module.exports.clearHtmlCommentText = function clearHtmlCommentText(/** @type {string} */ text) {
|
|
183
186
|
let i = 0;
|
|
@@ -207,7 +210,9 @@ module.exports.clearHtmlCommentText = function clearHtmlCommentText(/** @type {s
|
|
|
207
210
|
// If a valid block/inline comment...
|
|
208
211
|
if (isValid) {
|
|
209
212
|
const clearedContent = content
|
|
213
|
+
// eslint-disable-next-line unicorn/no-unsafe-string-replacement
|
|
210
214
|
.replace(notSpaceCrLfRe, safeCommentCharacter)
|
|
215
|
+
// eslint-disable-next-line unicorn/no-unsafe-string-replacement
|
|
211
216
|
.replace(trailingSpaceRe, replaceTrailingSpace);
|
|
212
217
|
text =
|
|
213
218
|
text.slice(0, i + htmlCommentBegin.length) +
|
|
@@ -222,6 +227,7 @@ module.exports.clearHtmlCommentText = function clearHtmlCommentText(/** @type {s
|
|
|
222
227
|
|
|
223
228
|
// Escapes a string for use in a RegExp
|
|
224
229
|
module.exports.escapeForRegExp = function escapeForRegExp(/** @type {string} */ str) {
|
|
230
|
+
// eslint-disable-next-line unicorn/prefer-regexp-escape
|
|
225
231
|
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
226
232
|
};
|
|
227
233
|
|
|
@@ -552,6 +558,7 @@ module.exports.getPreferredLineEnding = getPreferredLineEnding;
|
|
|
552
558
|
*/
|
|
553
559
|
function expandTildePath(file, os) {
|
|
554
560
|
const homedir = os && os.homedir && os.homedir();
|
|
561
|
+
// eslint-disable-next-line unicorn/no-unsafe-string-replacement
|
|
555
562
|
return homedir ? file.replace(/^~($|\/|\\)/, `${homedir}$1`) : file;
|
|
556
563
|
}
|
|
557
564
|
module.exports.expandTildePath = expandTildePath;
|
|
@@ -630,8 +637,8 @@ function convertLintErrorsVersion2To0(errors) {
|
|
|
630
637
|
function copyAndTransformResults(results, transform) {
|
|
631
638
|
/** @type {Object.<string, LintErrors>} */
|
|
632
639
|
const newResults = {};
|
|
633
|
-
for (const key of Object.
|
|
634
|
-
const arr =
|
|
640
|
+
for (const [ key, value ] of Object.entries(results)) {
|
|
641
|
+
const arr = value.map((r) => ({ ...r }));
|
|
635
642
|
newResults[key] = transform(arr);
|
|
636
643
|
}
|
|
637
644
|
// @ts-ignore
|
|
@@ -17,8 +17,7 @@ const { flatTokensSymbol, htmlFlowSymbol, newlineRe } = require("./shared.cjs");
|
|
|
17
17
|
* @returns {boolean} True iff the token is within an htmlFlow type.
|
|
18
18
|
*/
|
|
19
19
|
function inHtmlFlow(token) {
|
|
20
|
-
|
|
21
|
-
return Boolean(token[htmlFlowSymbol]);
|
|
20
|
+
return Object.hasOwn(token, htmlFlowSymbol);
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
/**
|
package/helpers/shared.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
|
-
// Symbol for
|
|
5
|
+
// Symbol for identifying the flat tokens array from micromark parse
|
|
6
6
|
module.exports.flatTokensSymbol = Symbol("flat-tokens");
|
|
7
7
|
|
|
8
8
|
// Symbol for identifying the htmlFlow token from micromark parse
|