UNPKG

7.47 kBTypeScriptView Raw
1import { CSpellSettings } from '@cspell/cspell-types';
2import type { CacheOptions } from './util/cache/index.js';
3export interface LinterOptions extends Omit<BaseOptions, 'config'>, Omit<CacheOptions, 'version'> {
4 /**
5 * Display verbose information
6 */
7 verbose?: boolean;
8 /**
9 * Show extensive output.
10 */
11 debug?: boolean;
12 /**
13 * a globs to exclude files from being checked.
14 */
15 exclude?: string[] | string;
16 /**
17 * Only report the words, no line numbers or file names.
18 */
19 wordsOnly?: boolean;
20 /**
21 * unique errors per file only.
22 */
23 unique?: boolean;
24 /**
25 * root directory, defaults to `cwd`
26 */
27 root?: string;
28 /**
29 * Determine if files / directories starting with `.` should be part
30 * of the glob search.
31 * @default false
32 */
33 dot?: boolean;
34 /**
35 * Show part of a line where an issue is found.
36 * if true, it will show the default number of characters on either side.
37 * if a number, it will shat number of characters on either side.
38 */
39 showContext?: boolean | number;
40 /**
41 * Show suggestions for spelling errors.
42 */
43 showSuggestions?: boolean;
44 /**
45 * Enable filtering out files matching globs found in `.gitignore` files.
46 */
47 gitignore?: boolean;
48 /**
49 * Stop searching for a `.gitignore`s when a root is reached.
50 */
51 gitignoreRoot?: string | string[];
52 /**
53 * List of files that contains the paths to files to be spell checked.
54 * The files in the lists will be filtered against the glob patterns.
55 * - an entry of `stdin` means to read the file list from **`stdin`**
56 * The resulting files are filtered against the `files` globs found in the configuration.
57 */
58 fileList?: string[] | undefined;
59 /**
60 * List of file paths to spell check. These can be relative or absolute
61 * paths, but not Globs. Relative paths are relative to {@link LinterOptions.root}.
62 * The files are combined with the file paths read from {@link LinterOptions.fileList}.
63 * These files are filtered against the `files` globs found in the configuration.
64 */
65 files?: string[] | undefined;
66 /**
67 * Alias of {@link LinterOptions.files}.
68 */
69 file?: string[] | undefined;
70 /**
71 * Use the `files` configuration to filter the files found.
72 */
73 filterFiles?: boolean | undefined;
74 /**
75 * Files must be found and processed otherwise it is considered an error.
76 */
77 mustFindFiles?: boolean;
78 /**
79 * Stop processing and exit if an issue or error is found.
80 */
81 failFast?: boolean;
82 /**
83 * Optional list of reporters to use, overriding any specified in the
84 * configuration.
85 */
86 reporter?: string[];
87 /**
88 * Load and parse documents, but do not spell check.
89 */
90 skipValidation?: boolean;
91 /**
92 * Path to configuration file.
93 */
94 config?: string | CSpellConfigFile;
95}
96export interface TraceOptions extends BaseOptions {
97 stdin?: boolean;
98 allowCompoundWords?: boolean;
99 ignoreCase?: boolean;
100 all?: boolean;
101 onlyFound?: boolean;
102 dictionaryPath?: 'hide' | 'long' | 'short' | 'full';
103}
104export interface SuggestionOptions extends BaseOptions {
105 /**
106 * Strict case and accent checking
107 * @default true
108 */
109 strict?: boolean;
110 /**
111 * List of dictionaries to use. If specified, only that list of dictionaries will be used.
112 */
113 dictionaries?: string[] | undefined;
114 /**
115 * The number of suggestions to make.
116 * @default 8
117 */
118 numSuggestions?: number;
119 /**
120 * Max number of changes / edits to the word to get to a suggestion matching suggestion.
121 * @default 4
122 */
123 numChanges?: number;
124 /**
125 * If multiple suggestions have the same edit / change "cost", then included them even if
126 * it causes more than `numSuggestions` to be returned.
127 * @default true
128 */
129 includeTies?: boolean;
130 /**
131 * Use stdin for the input
132 */
133 useStdin?: boolean | undefined;
134 /**
135 * Use REPL interface for making suggestions.
136 */
137 repl?: boolean;
138}
139export interface LegacyOptions {
140 local?: string;
141}
142export type LegacyFixes = Pick<BaseOptions, 'locale'>;
143export interface BaseOptions {
144 /**
145 * Path to configuration file.
146 */
147 config?: string;
148 /**
149 * Programming Language ID.
150 */
151 languageId?: string;
152 /**
153 * Locale to use.
154 */
155 locale?: string;
156 /**
157 * Load the default configuration
158 * @default true
159 */
160 defaultConfiguration?: boolean;
161 /**
162 * Check In-Document CSpell directives for correctness.
163 */
164 validateDirectives?: boolean;
165 /**
166 * Return an exit code if there are issues found.
167 * @default true
168 */
169 exitCode?: boolean;
170 /**
171 * Execution flags.
172 * Used primarily for releasing experimental features.
173 * Flags are of the form key:value
174 */
175 flag?: string[];
176}
177export interface LinterCliOptions extends LinterOptions {
178 /**
179 * Show legacy output
180 */
181 legacy?: boolean;
182 /**
183 * Show summary at the end
184 */
185 summary?: boolean;
186 /**
187 * Show issues
188 */
189 issues?: boolean;
190 /**
191 * Run in silent mode.
192 * @default false
193 */
194 silent?: boolean;
195 /**
196 * Show progress
197 */
198 progress?: boolean;
199 /**
200 * issues are shown with a relative path to the root or `cwd`
201 */
202 relative?: boolean;
203 /**
204 * Files must be found or cli will exit with an error.
205 */
206 mustFindFiles?: boolean;
207 /**
208 * Generate a summary report of issues.
209 */
210 issuesSummaryReport?: boolean;
211 /**
212 * Generate a summary report of performance.
213 */
214 showPerfSummary?: boolean;
215 /**
216 * Set the template to use when reporting issues.
217 *
218 * The template is a string that can contain the following placeholders:
219 * - `$filename` - the file name
220 * - `$col` - the column number
221 * - `$row` - the row number
222 * - `$text` - the word that is misspelled
223 * - `$message` - the issues message: "unknown word", "word is misspelled", etc.
224 * - `$messageColored` - the issues message with color based upon the message type.
225 * - `$uri` - the URI of the file
226 * - `$suggestions` - suggestions for the misspelled word (if requested)
227 * - `$quickFix` - possible quick fixes for the misspelled word.
228 * - `$contextFull` - the full context of the misspelled word.
229 * - `$contextLeft` - the context to the left of the misspelled word.
230 * - `$contextRight` - the context to the right of the misspelled word.
231 *
232 * Color is supported using the following template pattern:
233 * - `{<style[.style]> <text>}` - where `<style>` is a style name and `<text>` is the text to style.
234 *
235 * Styles
236 * - `bold`, `italic`, `underline`, `strikethrough`, `dim`, `inverse`
237 * - `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`
238 *
239 * Example:
240 * @example "{green $filename}:{yellow $row}:{yellow $col} $message {red $text} $quickFix {dim $suggestions}"
241 * @since 8.12.0
242 */
243 issueTemplate?: string;
244}
245export declare function fixLegacy<T extends LegacyFixes>(opts: T & LegacyOptions): Omit<T & LegacyOptions, 'local'>;
246export interface CSpellConfigFile {
247 url: URL;
248 settings: CSpellSettings;
249}
250//# sourceMappingURL=options.d.ts.map
\No newline at end of file