mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Address new TypeScript warnings in core files, improve type definitions.
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run
This commit is contained in:
parent
bd02390014
commit
7beb9fc9d0
32 changed files with 354 additions and 170 deletions
|
|
@ -26,39 +26,38 @@ export function lintSync(options: Options | null): LintResults;
|
|||
* @param {Configuration} config Configuration object.
|
||||
* @param {string} file Configuration file name.
|
||||
* @param {ConfigurationParser[] | undefined} parsers Parsing function(s).
|
||||
* @param {Object} fs File system implementation.
|
||||
* @param {FsLike} fs File system implementation.
|
||||
* @returns {Promise<Configuration>} Configuration object.
|
||||
*/
|
||||
export function extendConfigPromise(config: Configuration, file: string, parsers: ConfigurationParser[] | undefined, fs: any): Promise<Configuration>;
|
||||
export function extendConfigPromise(config: Configuration, file: string, parsers: ConfigurationParser[] | undefined, fs: FsLike): Promise<Configuration>;
|
||||
/**
|
||||
* Read specified configuration file.
|
||||
*
|
||||
* @param {string} file Configuration file name.
|
||||
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing
|
||||
* function(s).
|
||||
* @param {Object} [fs] File system implementation.
|
||||
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing function(s).
|
||||
* @param {FsLike | ReadConfigCallback} [fs] File system implementation.
|
||||
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function readConfigAsync(file: string, parsers?: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void;
|
||||
export function readConfigAsync(file: string, parsers?: ConfigurationParser[] | ReadConfigCallback, fs?: FsLike | ReadConfigCallback, callback?: ReadConfigCallback): void;
|
||||
/**
|
||||
* Read specified configuration file.
|
||||
*
|
||||
* @param {string} file Configuration file name.
|
||||
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
||||
* @param {Object} [fs] File system implementation.
|
||||
* @param {FsLike} [fs] File system implementation.
|
||||
* @returns {Promise<Configuration>} Configuration object.
|
||||
*/
|
||||
export function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise<Configuration>;
|
||||
export function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: FsLike): Promise<Configuration>;
|
||||
/**
|
||||
* Read specified configuration file.
|
||||
*
|
||||
* @param {string} file Configuration file name.
|
||||
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
|
||||
* @param {Object} [fs] File system implementation.
|
||||
* @param {FsLike} [fs] File system implementation.
|
||||
* @returns {Configuration} Configuration object.
|
||||
*/
|
||||
export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration;
|
||||
export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: FsLike): Configuration;
|
||||
/**
|
||||
* Applies the specified fix to a Markdown content line.
|
||||
*
|
||||
|
|
@ -82,6 +81,19 @@ export function applyFixes(input: string, errors: LintError[]): string;
|
|||
* @returns {string} SemVer string.
|
||||
*/
|
||||
export function getVersion(): string;
|
||||
/**
|
||||
* Result object for removeFrontMatter.
|
||||
*/
|
||||
export type RemoveFrontMatterResult = {
|
||||
/**
|
||||
* Markdown content.
|
||||
*/
|
||||
content: string;
|
||||
/**
|
||||
* Front matter lines.
|
||||
*/
|
||||
frontMatterLines: string[];
|
||||
};
|
||||
/**
|
||||
* Result object for getEffectiveConfig.
|
||||
*/
|
||||
|
|
@ -120,6 +132,27 @@ export type EnabledRulesPerLineNumberResult = {
|
|||
*/
|
||||
rulesSeverity: Map<string, "error" | "warning">;
|
||||
};
|
||||
/**
|
||||
* Node fs instance (or compatible object).
|
||||
*/
|
||||
export type FsLike = {
|
||||
/**
|
||||
* access method.
|
||||
*/
|
||||
access: (path: string, callback: (err: Error) => void) => void;
|
||||
/**
|
||||
* accessSync method.
|
||||
*/
|
||||
accessSync: (path: string) => void;
|
||||
/**
|
||||
* readFile method.
|
||||
*/
|
||||
readFile: (path: string, encoding: string, callback: (err: Error, data: string) => void) => void;
|
||||
/**
|
||||
* readFileSync method.
|
||||
*/
|
||||
readFileSync: (path: string, encoding: string) => string;
|
||||
};
|
||||
/**
|
||||
* Function to implement rule logic.
|
||||
*/
|
||||
|
|
@ -418,7 +451,7 @@ export type Options = {
|
|||
/**
|
||||
* File system implementation.
|
||||
*/
|
||||
fs?: any;
|
||||
fs?: FsLike;
|
||||
/**
|
||||
* True to catch exceptions.
|
||||
*/
|
||||
|
|
@ -467,15 +500,15 @@ export type LintError = {
|
|||
/**
|
||||
* Link to more information.
|
||||
*/
|
||||
ruleInformation: string;
|
||||
ruleInformation: string | null;
|
||||
/**
|
||||
* Detail about the error.
|
||||
*/
|
||||
errorDetail: string;
|
||||
errorDetail: string | null;
|
||||
/**
|
||||
* Context for the error.
|
||||
*/
|
||||
errorContext: string;
|
||||
errorContext: string | null;
|
||||
/**
|
||||
* Column number (1-based) and length.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue