Deprecate LintResults.toString() (at edit time; continue to support at run time), provide helper function formatLintResults, remove outdated grunt/gulp samples, improve typing.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled

This commit is contained in:
David Anson 2025-09-08 21:09:35 -07:00
parent 2a06f0a871
commit 616c3f2c22
18 changed files with 161 additions and 207 deletions

View file

@ -63,19 +63,19 @@ export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs
* Applies the specified fix to a Markdown content line.
*
* @param {string} line Line of Markdown content.
* @param {RuleOnErrorFixInfo} fixInfo RuleOnErrorFixInfo instance.
* @param {FixInfo} fixInfo FixInfo instance.
* @param {string} [lineEnding] Line ending to use.
* @returns {string | null} Fixed content or null if deleted.
*/
export function applyFix(line: string, fixInfo: RuleOnErrorFixInfo, lineEnding?: string): string | null;
export function applyFix(line: string, fixInfo: FixInfo, lineEnding?: string): string | null;
/**
* Applies as many of the specified fixes as possible to Markdown content.
*
* @param {string} input Lines of Markdown content.
* @param {RuleOnErrorInfo[]} errors RuleOnErrorInfo instances.
* @param {LintError[]} errors LintError instances.
* @returns {string} Fixed content.
*/
export function applyFixes(input: string, errors: RuleOnErrorInfo[]): string;
export function applyFixes(input: string, errors: LintError[]): string;
/**
* Gets the (semantic) version of the library.
*
@ -320,27 +320,6 @@ export type RuleOnErrorFixInfo = {
*/
insertText?: string;
};
/**
* RuleOnErrorInfo with all optional properties present.
*/
export type RuleOnErrorFixInfoNormalized = {
/**
* Line number (1-based).
*/
lineNumber: number;
/**
* Column of the fix (1-based).
*/
editColumn: number;
/**
* Count of characters to delete.
*/
deleteCount: number;
/**
* Text to insert (after deleting).
*/
insertText: string;
};
/**
* Rule definition.
*/
@ -442,10 +421,6 @@ export type Options = {
* A markdown-it plugin.
*/
export type Plugin = any[];
/**
* Function to pretty-print lint results.
*/
export type ToStringCallback = (ruleAliases?: boolean) => string;
/**
* Lint results.
*/
@ -483,11 +458,11 @@ export type LintError = {
/**
* Column number (1-based) and length.
*/
errorRange: number[];
errorRange: number[] | null;
/**
* Fix information.
*/
fixInfo?: FixInfo;
fixInfo: FixInfo | null;
};
/**
* Fix information.
@ -510,6 +485,27 @@ export type FixInfo = {
*/
insertText?: string;
};
/**
* FixInfo with all optional properties present.
*/
export type FixInfoNormalized = {
/**
* Line number (1-based).
*/
lineNumber: number;
/**
* Column of the fix (1-based).
*/
editColumn: number;
/**
* Count of characters to delete.
*/
deleteCount: number;
/**
* Text to insert (after deleting).
*/
insertText: string;
};
/**
* Called with the result of linting a string or document.
*/