cspell
Version:
A Spelling Checker for Code!
122 lines • 4.9 kB
TypeScript
import { a as SuggestionOptions, i as LinterCliOptions, n as DictionariesOptions, o as TraceOptions, r as LegacyOptions, t as BaseOptions } from "./options-CI-Jag3K.js";
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, SuggestionsForWordResult, TraceResult, TraceWordResult } from "cspell-lib";
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
interface BaseConfigOptions {
/**
* The path to the configuration file to create / update.
* If not provided, the configuration file in the current directory is updated.
* If there is none, a default file name will be used based on the format.
*/
config?: string;
/**
* The list of configuration files or dictionary packages to import.
* This can be a list of file paths, package names, or URLs.
*/
import?: string[];
/**
* The locale to use when spell checking (e.g., en, en-US, de).
*/
locale?: string;
/**
* Whether to add comments to the configuration file.
* - `true` - comments will be added to the configuration file.
* - `false` - no comments will be added.
* - `undefined` - the default behavior will be used based on the format.
*/
comments?: boolean;
/**
* Whether to remove all comments from the configuration file.
* - `true` - all comments will be removed.
* - `false` | `undefined` - no comments will be removed.
* @implies `comments: false`
*/
removeComments?: boolean;
/**
* Whether to add the schema reference to the configuration file.
* - `true` - the schema reference will be added / updated.
* - `false` - no schema reference will be added.
* - `undefined` - the schema reference will be added only if the configuration has no settings yet.
*/
schema?: boolean;
/**
* The list of dictionaries to enable in the configuration file.
* These are added to an existing configuration file or a new one.
* Existing dictionaries will not be removed.
*/
dictionary?: string[];
/**
* Whether to write the configuration to stdout instead of a file.
*/
stdout?: boolean;
}
interface InitOptions extends BaseConfigOptions {
/**
* The path where the configuration file will be written, it can be a file path or a URL.
* If not provided, the configuration file in the current directory is updated.
* If there is none, a default file name will be used based on the format.
* The default will be `cspell.config.yaml` or `cspell.json` based on the format.
* @conflicts `config` - If `config` is provided, it will be used instead of `output`.
*/
output?: string;
/**
* The format of the configuration file.
* @conflicts `config` - If `config` is provided, the format will be inferred from the file extension.
*/
format?: "yaml" | "yml" | "json" | "jsonc";
}
interface TimedSuggestionsForWordResult extends SuggestionsForWordResult {
elapsedTimeMs?: number;
}
interface ListDictionariesResult {
/**
* The name of the dictionary.
*/
name: string;
/**
* The description of the dictionary.
*/
description?: string | undefined;
/**
* The path to the dictionary file.
*/
path?: string | undefined;
/**
* True if the dictionary is enabled.
*/
enabled: boolean;
/**
* True if the dictionary is blocked.
*/
blocked: boolean;
/**
* The inline dictionaries supported by the dictionary.
*/
inline?: string[] | undefined;
/**
* the languages locales supported by the dictionary.
*/
locales?: string[] | undefined;
/**
* The file types supported by the dictionary.
*/
fileTypes?: string[] | undefined;
}
declare function listDictionaries(options: DictionariesOptions): Promise<ListDictionariesResult[]>;
/**
* The same shape as `NodeJS.ErrnoException`, declared here so the published types do not need `@types/node`.
*/
interface AppError extends Error {
errno?: number | undefined;
code?: string | undefined;
path?: string | undefined;
syscall?: string | undefined;
}
declare function lint(fileGlobs: string[], options: LinterCliOptions, reporter?: CSpellReporter): Promise<RunResult>;
declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceWordResult>;
type CheckTextResult = CheckTextInfo;
declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
declare function createInit(options: InitOptions): Promise<void>;
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
export { checkText as a, parseApplicationFeatureFlags as c, listDictionaries as d, TraceResult as i, suggestions as l, CheckTextResult as n, createInit as o, IncludeExcludeFlag as r, lint as s, AppError as t, trace as u };
//# sourceMappingURL=application-Cuobl1Eb.d.ts.map