markdownlint 0.37.4 → 0.39.0
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 +20 -0
- package/CONTRIBUTING.md +2 -3
- package/README.md +175 -87
- package/doc/Rules.md +273 -47
- package/doc/md001.md +14 -0
- package/doc/md009.md +8 -9
- package/doc/md010.md +6 -0
- package/doc/md027.md +8 -0
- package/doc/md029.md +2 -0
- package/doc/md033.md +7 -1
- package/doc/md038.md +23 -11
- package/doc/md041.md +31 -16
- package/doc/md043.md +22 -4
- package/doc/md045.md +9 -1
- package/doc/md051.md +17 -0
- package/doc/md052.md +12 -0
- package/doc/md053.md +3 -3
- package/doc/md055.md +1 -1
- package/doc/md056.md +1 -1
- package/doc/md059.md +33 -0
- package/doc/md060.md +70 -0
- package/helpers/README.md +2 -2
- package/helpers/helpers.cjs +174 -20
- package/helpers/micromark-helpers.cjs +37 -7
- package/helpers/package.json +1 -1
- package/lib/cache.mjs +25 -7
- package/lib/configuration-strict.d.ts +1494 -292
- package/lib/constants.mjs +6 -5
- package/lib/defer-require.cjs +2 -0
- package/lib/exports.d.mts +2 -2
- package/lib/exports.mjs +2 -2
- package/lib/markdownit.cjs +8 -14
- package/lib/markdownlint.d.mts +136 -52
- package/lib/markdownlint.mjs +469 -409
- package/lib/md001.mjs +6 -2
- package/lib/md004.mjs +7 -18
- package/lib/md007.mjs +2 -1
- package/lib/md009.mjs +9 -5
- package/lib/md010.mjs +1 -1
- package/lib/md022.mjs +5 -2
- package/lib/md025.mjs +23 -15
- package/lib/md027.mjs +11 -1
- package/lib/md029.mjs +25 -14
- package/lib/md031.mjs +0 -1
- package/lib/md032.mjs +3 -1
- package/lib/md033.mjs +28 -20
- package/lib/md034.mjs +2 -1
- package/lib/md036.mjs +16 -4
- package/lib/md037.mjs +10 -7
- package/lib/md038.mjs +52 -71
- package/lib/md041.mjs +54 -16
- package/lib/md042.mjs +4 -2
- package/lib/md043.mjs +4 -2
- package/lib/md044.mjs +1 -1
- package/lib/md045.mjs +3 -1
- package/lib/md046.mjs +6 -6
- package/lib/md051.mjs +13 -5
- package/lib/md052.mjs +2 -1
- package/lib/md053.mjs +1 -1
- package/lib/md054.mjs +7 -5
- package/lib/md055.mjs +7 -6
- package/lib/md056.mjs +1 -1
- package/lib/md059.mjs +71 -0
- package/lib/md060.mjs +121 -0
- package/lib/micromark-parse.mjs +17 -3
- package/lib/node-imports-browser.mjs +2 -0
- package/lib/parse-configuration.mjs +47 -0
- package/lib/rules.mjs +5 -1
- package/package.json +32 -30
- package/schema/.markdownlint.jsonc +97 -62
- package/schema/.markdownlint.yaml +86 -57
- package/schema/markdownlint-config-schema-strict.json +4713 -1436
- package/schema/markdownlint-config-schema.json +4713 -1436
package/lib/constants.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
/** @type {string[]} */
|
|
3
4
|
export const deprecatedRuleNames = [];
|
|
4
5
|
export const fixableRuleNames = [
|
|
5
6
|
"MD004", "MD005", "MD007", "MD009", "MD010", "MD011",
|
|
6
7
|
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
|
|
7
|
-
"MD022", "MD023", "MD026", "MD027", "
|
|
8
|
-
"MD032", "MD034", "MD037", "MD038", "MD039",
|
|
9
|
-
"MD047", "MD049", "MD050", "MD051", "MD053",
|
|
10
|
-
"MD058"
|
|
8
|
+
"MD022", "MD023", "MD026", "MD027", "MD029", "MD030",
|
|
9
|
+
"MD031", "MD032", "MD034", "MD037", "MD038", "MD039",
|
|
10
|
+
"MD044", "MD047", "MD049", "MD050", "MD051", "MD053",
|
|
11
|
+
"MD054", "MD058"
|
|
11
12
|
];
|
|
12
13
|
export const homepage = "https://github.com/DavidAnson/markdownlint";
|
|
13
|
-
export const version = "0.
|
|
14
|
+
export const version = "0.39.0";
|
package/lib/defer-require.cjs
CHANGED
package/lib/exports.d.mts
CHANGED
|
@@ -3,10 +3,12 @@ export type Configuration = import("./markdownlint.mjs").Configuration;
|
|
|
3
3
|
export type ConfigurationParser = import("./markdownlint.mjs").ConfigurationParser;
|
|
4
4
|
export type ConfigurationStrict = import("./markdownlint.mjs").ConfigurationStrict;
|
|
5
5
|
export type FixInfo = import("./markdownlint.mjs").FixInfo;
|
|
6
|
+
export type FixInfoNormalized = import("./markdownlint.mjs").FixInfoNormalized;
|
|
6
7
|
export type LintCallback = import("./markdownlint.mjs").LintCallback;
|
|
7
8
|
export type LintContentCallback = import("./markdownlint.mjs").LintContentCallback;
|
|
8
9
|
export type LintError = import("./markdownlint.mjs").LintError;
|
|
9
10
|
export type LintResults = import("./markdownlint.mjs").LintResults;
|
|
11
|
+
export type MarkdownItFactory = import("./markdownlint.mjs").MarkdownItFactory;
|
|
10
12
|
export type MarkdownItToken = import("./markdownlint.mjs").MarkdownItToken;
|
|
11
13
|
export type MarkdownParsers = import("./markdownlint.mjs").MarkdownParsers;
|
|
12
14
|
export type MicromarkToken = import("./markdownlint.mjs").MicromarkToken;
|
|
@@ -22,8 +24,6 @@ export type RuleConfiguration = import("./markdownlint.mjs").RuleConfiguration;
|
|
|
22
24
|
export type RuleFunction = import("./markdownlint.mjs").RuleFunction;
|
|
23
25
|
export type RuleOnError = import("./markdownlint.mjs").RuleOnError;
|
|
24
26
|
export type RuleOnErrorFixInfo = import("./markdownlint.mjs").RuleOnErrorFixInfo;
|
|
25
|
-
export type RuleOnErrorFixInfoNormalized = import("./markdownlint.mjs").RuleOnErrorFixInfoNormalized;
|
|
26
27
|
export type RuleOnErrorInfo = import("./markdownlint.mjs").RuleOnErrorInfo;
|
|
27
28
|
export type RuleParams = import("./markdownlint.mjs").RuleParams;
|
|
28
|
-
export type ToStringCallback = import("./markdownlint.mjs").ToStringCallback;
|
|
29
29
|
export { applyFix, applyFixes, getVersion } from "./markdownlint.mjs";
|
package/lib/exports.mjs
CHANGED
|
@@ -7,10 +7,12 @@ export { resolveModule } from "./resolve-module.cjs";
|
|
|
7
7
|
/** @typedef {import("./markdownlint.mjs").ConfigurationParser} ConfigurationParser */
|
|
8
8
|
/** @typedef {import("./markdownlint.mjs").ConfigurationStrict} ConfigurationStrict */
|
|
9
9
|
/** @typedef {import("./markdownlint.mjs").FixInfo} FixInfo */
|
|
10
|
+
/** @typedef {import("./markdownlint.mjs").FixInfoNormalized} FixInfoNormalized */
|
|
10
11
|
/** @typedef {import("./markdownlint.mjs").LintCallback} LintCallback */
|
|
11
12
|
/** @typedef {import("./markdownlint.mjs").LintContentCallback} LintContentCallback */
|
|
12
13
|
/** @typedef {import("./markdownlint.mjs").LintError} LintError */
|
|
13
14
|
/** @typedef {import("./markdownlint.mjs").LintResults} LintResults */
|
|
15
|
+
/** @typedef {import("./markdownlint.mjs").MarkdownItFactory} MarkdownItFactory */
|
|
14
16
|
/** @typedef {import("./markdownlint.mjs").MarkdownItToken} MarkdownItToken */
|
|
15
17
|
/** @typedef {import("./markdownlint.mjs").MarkdownParsers} MarkdownParsers */
|
|
16
18
|
/** @typedef {import("./markdownlint.mjs").MicromarkToken} MicromarkToken */
|
|
@@ -26,7 +28,5 @@ export { resolveModule } from "./resolve-module.cjs";
|
|
|
26
28
|
/** @typedef {import("./markdownlint.mjs").RuleFunction} RuleFunction */
|
|
27
29
|
/** @typedef {import("./markdownlint.mjs").RuleOnError} RuleOnError */
|
|
28
30
|
/** @typedef {import("./markdownlint.mjs").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
|
|
29
|
-
/** @typedef {import("./markdownlint.mjs").RuleOnErrorFixInfoNormalized} RuleOnErrorFixInfoNormalized */
|
|
30
31
|
/** @typedef {import("./markdownlint.mjs").RuleOnErrorInfo} RuleOnErrorInfo */
|
|
31
32
|
/** @typedef {import("./markdownlint.mjs").RuleParams} RuleParams */
|
|
32
|
-
/** @typedef {import("./markdownlint.mjs").ToStringCallback} ToStringCallback */
|
package/lib/markdownit.cjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
const { newLineRe } = require("../helpers");
|
|
6
6
|
|
|
7
7
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
|
8
|
+
/** @typedef {import("markdownlint").MarkdownIt} MarkdownIt */
|
|
8
9
|
/** @typedef {import("markdownlint").MarkdownItToken} MarkdownItToken */
|
|
9
|
-
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
|
10
10
|
/** @typedef {import("markdownlint").Plugin} Plugin */
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -97,7 +97,7 @@ function freezeToken(token) {
|
|
|
97
97
|
/**
|
|
98
98
|
* Annotate tokens with line/lineNumber and freeze them.
|
|
99
99
|
*
|
|
100
|
-
* @param {
|
|
100
|
+
* @param {import("markdown-it").Token[]} tokens Array of markdown-it tokens.
|
|
101
101
|
* @param {string[]} lines Lines of Markdown content.
|
|
102
102
|
* @returns {void}
|
|
103
103
|
*/
|
|
@@ -127,6 +127,7 @@ function annotateAndFreezeTokens(tokens, lines) {
|
|
|
127
127
|
}
|
|
128
128
|
// Annotate children with lineNumber
|
|
129
129
|
if (token.children) {
|
|
130
|
+
/** @type {number[]} */
|
|
130
131
|
const codeSpanExtraLines = [];
|
|
131
132
|
if (token.children.some((child) => child.type === "code_inline")) {
|
|
132
133
|
forEachInlineCodeSpan(token.content, (code) => {
|
|
@@ -140,7 +141,7 @@ function annotateAndFreezeTokens(tokens, lines) {
|
|
|
140
141
|
if ((child.type === "softbreak") || (child.type === "hardbreak")) {
|
|
141
142
|
lineNumber++;
|
|
142
143
|
} else if (child.type === "code_inline") {
|
|
143
|
-
lineNumber += codeSpanExtraLines.shift();
|
|
144
|
+
lineNumber += codeSpanExtraLines.shift() || 0;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
}
|
|
@@ -152,21 +153,14 @@ function annotateAndFreezeTokens(tokens, lines) {
|
|
|
152
153
|
/**
|
|
153
154
|
* Gets an array of markdown-it tokens for the input.
|
|
154
155
|
*
|
|
155
|
-
* @param {
|
|
156
|
+
* @param {MarkdownIt} markdownIt Instance of the markdown-it parser.
|
|
156
157
|
* @param {string} content Markdown content.
|
|
157
158
|
* @param {string[]} lines Lines of Markdown content.
|
|
158
|
-
* @returns {MarkdownItToken} Array of markdown-it tokens.
|
|
159
|
+
* @returns {MarkdownItToken[]} Array of markdown-it tokens.
|
|
159
160
|
*/
|
|
160
|
-
function getMarkdownItTokens(
|
|
161
|
-
const
|
|
162
|
-
const md = markdownit({ "html": true });
|
|
163
|
-
for (const plugin of markdownItPlugins) {
|
|
164
|
-
// @ts-ignore
|
|
165
|
-
md.use(...plugin);
|
|
166
|
-
}
|
|
167
|
-
const tokens = md.parse(content, {});
|
|
161
|
+
function getMarkdownItTokens(markdownIt, content, lines) {
|
|
162
|
+
const tokens = markdownIt.parse(content, {});
|
|
168
163
|
annotateAndFreezeTokens(tokens, lines);
|
|
169
|
-
// @ts-ignore
|
|
170
164
|
return tokens;
|
|
171
165
|
};
|
|
172
166
|
|
package/lib/markdownlint.d.mts
CHANGED
|
@@ -26,62 +26,133 @@ export function lintSync(options: Options | null): LintResults;
|
|
|
26
26
|
* @param {Configuration} config Configuration object.
|
|
27
27
|
* @param {string} file Configuration file name.
|
|
28
28
|
* @param {ConfigurationParser[] | undefined} parsers Parsing function(s).
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {FsLike} fs File system implementation.
|
|
30
30
|
* @returns {Promise<Configuration>} Configuration object.
|
|
31
31
|
*/
|
|
32
|
-
export function extendConfigPromise(config: Configuration, file: string, parsers: ConfigurationParser[] | undefined, fs:
|
|
32
|
+
export function extendConfigPromise(config: Configuration, file: string, parsers: ConfigurationParser[] | undefined, fs: FsLike): Promise<Configuration>;
|
|
33
33
|
/**
|
|
34
34
|
* Read specified configuration file.
|
|
35
35
|
*
|
|
36
36
|
* @param {string} file Configuration file name.
|
|
37
|
-
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing
|
|
38
|
-
*
|
|
39
|
-
* @param {Object} [fs] File system implementation.
|
|
37
|
+
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing function(s).
|
|
38
|
+
* @param {FsLike | ReadConfigCallback} [fs] File system implementation.
|
|
40
39
|
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
|
|
41
40
|
* @returns {void}
|
|
42
41
|
*/
|
|
43
|
-
export function readConfigAsync(file: string, parsers?: ConfigurationParser[] | ReadConfigCallback, fs?:
|
|
42
|
+
export function readConfigAsync(file: string, parsers?: ConfigurationParser[] | ReadConfigCallback, fs?: FsLike | ReadConfigCallback, callback?: ReadConfigCallback): void;
|
|
44
43
|
/**
|
|
45
44
|
* Read specified configuration file.
|
|
46
45
|
*
|
|
47
46
|
* @param {string} file Configuration file name.
|
|
48
47
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
49
|
-
* @param {
|
|
48
|
+
* @param {FsLike} [fs] File system implementation.
|
|
50
49
|
* @returns {Promise<Configuration>} Configuration object.
|
|
51
50
|
*/
|
|
52
|
-
export function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?:
|
|
51
|
+
export function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: FsLike): Promise<Configuration>;
|
|
53
52
|
/**
|
|
54
53
|
* Read specified configuration file.
|
|
55
54
|
*
|
|
56
55
|
* @param {string} file Configuration file name.
|
|
57
56
|
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
|
58
|
-
* @param {
|
|
57
|
+
* @param {FsLike} [fs] File system implementation.
|
|
59
58
|
* @returns {Configuration} Configuration object.
|
|
60
59
|
*/
|
|
61
|
-
export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?:
|
|
60
|
+
export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: FsLike): Configuration;
|
|
62
61
|
/**
|
|
63
62
|
* Applies the specified fix to a Markdown content line.
|
|
64
63
|
*
|
|
65
64
|
* @param {string} line Line of Markdown content.
|
|
66
|
-
* @param {
|
|
65
|
+
* @param {FixInfo} fixInfo FixInfo instance.
|
|
67
66
|
* @param {string} [lineEnding] Line ending to use.
|
|
68
67
|
* @returns {string | null} Fixed content or null if deleted.
|
|
69
68
|
*/
|
|
70
|
-
export function applyFix(line: string, fixInfo:
|
|
69
|
+
export function applyFix(line: string, fixInfo: FixInfo, lineEnding?: string): string | null;
|
|
71
70
|
/**
|
|
72
71
|
* Applies as many of the specified fixes as possible to Markdown content.
|
|
73
72
|
*
|
|
74
73
|
* @param {string} input Lines of Markdown content.
|
|
75
|
-
* @param {
|
|
74
|
+
* @param {LintError[]} errors LintError instances.
|
|
76
75
|
* @returns {string} Fixed content.
|
|
77
76
|
*/
|
|
78
|
-
export function applyFixes(input: string, errors:
|
|
77
|
+
export function applyFixes(input: string, errors: LintError[]): string;
|
|
79
78
|
/**
|
|
80
79
|
* Gets the (semantic) version of the library.
|
|
81
80
|
*
|
|
82
81
|
* @returns {string} SemVer string.
|
|
83
82
|
*/
|
|
84
83
|
export function getVersion(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Result object for removeFrontMatter.
|
|
86
|
+
*/
|
|
87
|
+
export type RemoveFrontMatterResult = {
|
|
88
|
+
/**
|
|
89
|
+
* Markdown content.
|
|
90
|
+
*/
|
|
91
|
+
content: string;
|
|
92
|
+
/**
|
|
93
|
+
* Front matter lines.
|
|
94
|
+
*/
|
|
95
|
+
frontMatterLines: string[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Result object for getEffectiveConfig.
|
|
99
|
+
*/
|
|
100
|
+
export type GetEffectiveConfigResult = {
|
|
101
|
+
/**
|
|
102
|
+
* Effective configuration.
|
|
103
|
+
*/
|
|
104
|
+
effectiveConfig: Configuration;
|
|
105
|
+
/**
|
|
106
|
+
* Rules enabled.
|
|
107
|
+
*/
|
|
108
|
+
rulesEnabled: Map<string, boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Rules severity.
|
|
111
|
+
*/
|
|
112
|
+
rulesSeverity: Map<string, "error" | "warning">;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Result object for getEnabledRulesPerLineNumber.
|
|
116
|
+
*/
|
|
117
|
+
export type EnabledRulesPerLineNumberResult = {
|
|
118
|
+
/**
|
|
119
|
+
* Effective configuration.
|
|
120
|
+
*/
|
|
121
|
+
effectiveConfig: Configuration;
|
|
122
|
+
/**
|
|
123
|
+
* Enabled rules per line number.
|
|
124
|
+
*/
|
|
125
|
+
enabledRulesPerLineNumber: Map<string, boolean>[];
|
|
126
|
+
/**
|
|
127
|
+
* Enabled rule list.
|
|
128
|
+
*/
|
|
129
|
+
enabledRuleList: Rule[];
|
|
130
|
+
/**
|
|
131
|
+
* Rules severity.
|
|
132
|
+
*/
|
|
133
|
+
rulesSeverity: Map<string, "error" | "warning">;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Node fs instance (or compatible object).
|
|
137
|
+
*/
|
|
138
|
+
export type FsLike = {
|
|
139
|
+
/**
|
|
140
|
+
* access method.
|
|
141
|
+
*/
|
|
142
|
+
access: (path: string, callback: (err: Error) => void) => void;
|
|
143
|
+
/**
|
|
144
|
+
* accessSync method.
|
|
145
|
+
*/
|
|
146
|
+
accessSync: (path: string) => void;
|
|
147
|
+
/**
|
|
148
|
+
* readFile method.
|
|
149
|
+
*/
|
|
150
|
+
readFile: (path: string, encoding: string, callback: (err: Error, data: string) => void) => void;
|
|
151
|
+
/**
|
|
152
|
+
* readFileSync method.
|
|
153
|
+
*/
|
|
154
|
+
readFileSync: (path: string, encoding: string) => string;
|
|
155
|
+
};
|
|
85
156
|
/**
|
|
86
157
|
* Function to implement rule logic.
|
|
87
158
|
*/
|
|
@@ -303,27 +374,6 @@ export type RuleOnErrorFixInfo = {
|
|
|
303
374
|
*/
|
|
304
375
|
insertText?: string;
|
|
305
376
|
};
|
|
306
|
-
/**
|
|
307
|
-
* RuleOnErrorInfo with all optional properties present.
|
|
308
|
-
*/
|
|
309
|
-
export type RuleOnErrorFixInfoNormalized = {
|
|
310
|
-
/**
|
|
311
|
-
* Line number (1-based).
|
|
312
|
-
*/
|
|
313
|
-
lineNumber: number;
|
|
314
|
-
/**
|
|
315
|
-
* Column of the fix (1-based).
|
|
316
|
-
*/
|
|
317
|
-
editColumn: number;
|
|
318
|
-
/**
|
|
319
|
-
* Count of characters to delete.
|
|
320
|
-
*/
|
|
321
|
-
deleteCount: number;
|
|
322
|
-
/**
|
|
323
|
-
* Text to insert (after deleting).
|
|
324
|
-
*/
|
|
325
|
-
insertText: string;
|
|
326
|
-
};
|
|
327
377
|
/**
|
|
328
378
|
* Rule definition.
|
|
329
379
|
*/
|
|
@@ -357,6 +407,23 @@ export type Rule = {
|
|
|
357
407
|
*/
|
|
358
408
|
function: RuleFunction;
|
|
359
409
|
};
|
|
410
|
+
/**
|
|
411
|
+
* Method used by the markdown-it parser to parse input.
|
|
412
|
+
*/
|
|
413
|
+
export type MarkdownItParse = (src: string, env: any) => any[];
|
|
414
|
+
/**
|
|
415
|
+
* Instance of the markdown-it parser.
|
|
416
|
+
*/
|
|
417
|
+
export type MarkdownIt = {
|
|
418
|
+
/**
|
|
419
|
+
* Method to parse input.
|
|
420
|
+
*/
|
|
421
|
+
parse: MarkdownItParse;
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Gets an instance of the markdown-it parser. Any plugins should already have been loaded.
|
|
425
|
+
*/
|
|
426
|
+
export type MarkdownItFactory = () => MarkdownIt | Promise<MarkdownIt>;
|
|
360
427
|
/**
|
|
361
428
|
* Configuration options.
|
|
362
429
|
*/
|
|
@@ -384,23 +451,19 @@ export type Options = {
|
|
|
384
451
|
/**
|
|
385
452
|
* File system implementation.
|
|
386
453
|
*/
|
|
387
|
-
fs?:
|
|
454
|
+
fs?: FsLike;
|
|
388
455
|
/**
|
|
389
456
|
* True to catch exceptions.
|
|
390
457
|
*/
|
|
391
458
|
handleRuleFailures?: boolean;
|
|
392
459
|
/**
|
|
393
|
-
*
|
|
460
|
+
* Function to create a markdown-it parser.
|
|
394
461
|
*/
|
|
395
|
-
|
|
462
|
+
markdownItFactory?: MarkdownItFactory;
|
|
396
463
|
/**
|
|
397
464
|
* True to ignore HTML directives.
|
|
398
465
|
*/
|
|
399
466
|
noInlineConfig?: boolean;
|
|
400
|
-
/**
|
|
401
|
-
* Results object version.
|
|
402
|
-
*/
|
|
403
|
-
resultVersion?: number;
|
|
404
467
|
/**
|
|
405
468
|
* Strings to lint.
|
|
406
469
|
*/
|
|
@@ -413,11 +476,7 @@ export type Options = {
|
|
|
413
476
|
*/
|
|
414
477
|
export type Plugin = any[];
|
|
415
478
|
/**
|
|
416
|
-
*
|
|
417
|
-
*/
|
|
418
|
-
export type ToStringCallback = (ruleAliases?: boolean) => string;
|
|
419
|
-
/**
|
|
420
|
-
* Lint results (for resultVersion 3).
|
|
479
|
+
* Lint results.
|
|
421
480
|
*/
|
|
422
481
|
export type LintResults = {
|
|
423
482
|
[x: string]: LintError[];
|
|
@@ -441,23 +500,27 @@ export type LintError = {
|
|
|
441
500
|
/**
|
|
442
501
|
* Link to more information.
|
|
443
502
|
*/
|
|
444
|
-
ruleInformation: string;
|
|
503
|
+
ruleInformation: string | null;
|
|
445
504
|
/**
|
|
446
505
|
* Detail about the error.
|
|
447
506
|
*/
|
|
448
|
-
errorDetail: string;
|
|
507
|
+
errorDetail: string | null;
|
|
449
508
|
/**
|
|
450
509
|
* Context for the error.
|
|
451
510
|
*/
|
|
452
|
-
errorContext: string;
|
|
511
|
+
errorContext: string | null;
|
|
453
512
|
/**
|
|
454
513
|
* Column number (1-based) and length.
|
|
455
514
|
*/
|
|
456
|
-
errorRange: number[];
|
|
515
|
+
errorRange: number[] | null;
|
|
457
516
|
/**
|
|
458
517
|
* Fix information.
|
|
459
518
|
*/
|
|
460
|
-
fixInfo
|
|
519
|
+
fixInfo: FixInfo | null;
|
|
520
|
+
/**
|
|
521
|
+
* Severity of the error.
|
|
522
|
+
*/
|
|
523
|
+
severity: "error" | "warning";
|
|
461
524
|
};
|
|
462
525
|
/**
|
|
463
526
|
* Fix information.
|
|
@@ -480,6 +543,27 @@ export type FixInfo = {
|
|
|
480
543
|
*/
|
|
481
544
|
insertText?: string;
|
|
482
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* FixInfo with all optional properties present.
|
|
548
|
+
*/
|
|
549
|
+
export type FixInfoNormalized = {
|
|
550
|
+
/**
|
|
551
|
+
* Line number (1-based).
|
|
552
|
+
*/
|
|
553
|
+
lineNumber: number;
|
|
554
|
+
/**
|
|
555
|
+
* Column of the fix (1-based).
|
|
556
|
+
*/
|
|
557
|
+
editColumn: number;
|
|
558
|
+
/**
|
|
559
|
+
* Count of characters to delete.
|
|
560
|
+
*/
|
|
561
|
+
deleteCount: number;
|
|
562
|
+
/**
|
|
563
|
+
* Text to insert (after deleting).
|
|
564
|
+
*/
|
|
565
|
+
insertText: string;
|
|
566
|
+
};
|
|
483
567
|
/**
|
|
484
568
|
* Called with the result of linting a string or document.
|
|
485
569
|
*/
|