@cspell/eslint-plugin
Version:
55 lines • 2.04 kB
text/typescript
import type { UnknownWordsChoices } from 'cspell-lib';
import type { Options } from '../common/options.cjs';
export type SpellCheckOptions = Options & {
cwd: string;
};
interface ExtendedSuggestion {
/**
* The suggestion.
*/
word: string;
/**
* The word is preferred above others, except other "preferred" words.
*/
isPreferred?: boolean;
/**
* The suggested word adjusted to match the original case.
*/
wordAdjustedToMatchCase?: string;
}
export type Suggestions = ExtendedSuggestion[] | undefined;
export interface SpellCheckIssue {
/** the starting offset of the issue */
start: number;
/** the ending offset of the issue */
end: number;
/** the word that was flagged */
word: string;
/** the severity of the issue. */
severity: 'Forbidden' | 'Misspelled' | 'Unknown' | 'Hint';
/** suggestions to be presented. */
suggestions: Suggestions;
/** Indicates that there preferred suggestions. */
hasPreferredFixes: boolean;
/** Indicates that there are simple suggestions available. */
hasSimpleSuggestions: boolean;
/** The range of text in which this issue occurred. */
range: CheckTextRange;
/** The index of the range in which this issues occurred. */
rangeIdx: number;
}
export interface SpellCheckResults {
issues: SpellCheckIssue[];
errors?: Error[];
}
export type CheckTextRange = readonly [number, number];
export type SpellCheckFn = typeof spellCheck;
export type SpellCheckSyncFn = (...p: Parameters<SpellCheckFn>) => Awaited<ReturnType<SpellCheckFn>>;
export declare function spellCheck(filename: string, text: string, ranges: CheckTextRange[], options: SpellCheckOptions): Promise<SpellCheckResults>;
export type ReportTypes = Exclude<Options['report'], undefined>;
type MapReportToUnknownWordChoices = {
[key in ReportTypes]: UnknownWordsChoices;
};
export declare const mapReportToUnknownWordChoices: MapReportToUnknownWordChoices;
export {};
//# sourceMappingURL=spellCheck.d.mts.map