markdownlint 0.23.0 → 0.25.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.
@@ -8,7 +8,7 @@ export = markdownlint;
8
8
  */
9
9
  declare function markdownlint(options: Options, callback: LintCallback): void;
10
10
  declare namespace markdownlint {
11
- export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback };
11
+ export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback, ResolveConfigExtendsCallback };
12
12
  }
13
13
  /**
14
14
  * Configuration options.
@@ -52,9 +52,13 @@ type Options = {
52
52
  * Additional plugins.
53
53
  */
54
54
  markdownItPlugins?: Plugin[];
55
+ /**
56
+ * File system implementation.
57
+ */
58
+ fs?: any;
55
59
  };
56
60
  /**
57
- * Called with the result of the lint operation.
61
+ * Called with the result of the lint function.
58
62
  */
59
63
  type LintCallback = (err: Error | null, results?: LintResults) => void;
60
64
  /**
@@ -70,18 +74,21 @@ declare function markdownlintSync(options: Options): LintResults;
70
74
  * @param {string} file Configuration file name.
71
75
  * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
72
76
  * function(s).
77
+ * @param {Object} [fs] File system implementation.
73
78
  * @param {ReadConfigCallback} [callback] Callback (err, result) function.
74
79
  * @returns {void}
75
80
  */
76
- declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, callback?: ReadConfigCallback): void;
81
+ declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void;
77
82
  /**
78
83
  * Read specified configuration file synchronously.
79
84
  *
80
85
  * @param {string} file Configuration file name.
81
86
  * @param {ConfigurationParser[]} [parsers] Parsing function(s).
87
+ * @param {Object} [fs] File system implementation.
82
88
  * @returns {Configuration} Configuration object.
89
+ * @throws An Error if processing fails.
83
90
  */
84
- declare function readConfigSync(file: string, parsers?: ConfigurationParser[]): Configuration;
91
+ declare function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration;
85
92
  /**
86
93
  * Gets the (semantic) version of the library.
87
94
  *
@@ -199,9 +206,9 @@ type RuleOnErrorInfo = {
199
206
  */
200
207
  lineNumber: number;
201
208
  /**
202
- * Details about the error.
209
+ * Detail about the error.
203
210
  */
204
- details?: string;
211
+ detail?: string;
205
212
  /**
206
213
  * Context for the error.
207
214
  */
@@ -256,6 +263,10 @@ type Rule = {
256
263
  * Rule tag(s).
257
264
  */
258
265
  tags: string[];
266
+ /**
267
+ * True if asynchronous.
268
+ */
269
+ asynchronous?: boolean;
259
270
  /**
260
271
  * Rule implementation.
261
272
  */
@@ -316,6 +327,10 @@ type LintError = {
316
327
  * Fix information.
317
328
  */
318
329
  type FixInfo = {
330
+ /**
331
+ * Line number (1-based).
332
+ */
333
+ lineNumber?: number;
319
334
  /**
320
335
  * Column of the fix (1-based).
321
336
  */
@@ -334,20 +349,24 @@ type FixInfo = {
334
349
  * {@link ../schema/markdownlint-config-schema.json}.
335
350
  */
336
351
  type Configuration = {
337
- [x: string]: any;
352
+ [x: string]: RuleConfiguration;
338
353
  };
339
354
  /**
340
355
  * Rule configuration.
341
356
  */
342
- type RuleConfiguration = any;
357
+ type RuleConfiguration = boolean | any;
343
358
  /**
344
359
  * Parses a configuration string and returns a configuration object.
345
360
  */
346
361
  type ConfigurationParser = (text: string) => Configuration;
347
362
  /**
348
- * Called with the result of the readConfig operation.
363
+ * Called with the result of the readConfig function.
349
364
  */
350
365
  type ReadConfigCallback = (err: Error | null, config?: Configuration) => void;
366
+ /**
367
+ * Called with the result of the resolveConfigExtends function.
368
+ */
369
+ type ResolveConfigExtendsCallback = (err: Error | null, path?: string) => void;
351
370
  /**
352
371
  * Lint specified Markdown files.
353
372
  *
@@ -360,6 +379,7 @@ declare function markdownlintPromise(options: Options): Promise<LintResults>;
360
379
  *
361
380
  * @param {string} file Configuration file name.
362
381
  * @param {ConfigurationParser[]} [parsers] Parsing function(s).
382
+ * @param {Object} [fs] File system implementation.
363
383
  * @returns {Promise<Configuration>} Configuration object.
364
384
  */
365
- declare function readConfigPromise(file: string, parsers?: ConfigurationParser[]): Promise<Configuration>;
385
+ declare function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise<Configuration>;