1 |
|
2 | import * as minimatch from 'minimatch';
|
3 | import * as cspell from 'cspell-lib';
|
4 | import { TraceResult, CheckTextInfo } from 'cspell-lib';
|
5 | export { TraceResult, IncludeExcludeFlag } from 'cspell-lib';
|
6 | import { GlobMatcher } from 'cspell-glob';
|
7 | export interface CSpellApplicationOptions extends BaseOptions {
|
8 | |
9 |
|
10 |
|
11 | verbose?: boolean;
|
12 | |
13 |
|
14 |
|
15 | debug?: boolean;
|
16 | |
17 |
|
18 |
|
19 | exclude?: string;
|
20 | |
21 |
|
22 |
|
23 | wordsOnly?: boolean;
|
24 | |
25 |
|
26 |
|
27 | unique?: boolean;
|
28 | |
29 |
|
30 |
|
31 | root?: string;
|
32 | }
|
33 | export interface TraceOptions extends BaseOptions {
|
34 | }
|
35 | export interface BaseOptions {
|
36 | config?: string;
|
37 | languageId?: string;
|
38 | local?: string;
|
39 | }
|
40 | export interface AppError extends NodeJS.ErrnoException {
|
41 | }
|
42 | export interface RunResult {
|
43 | files: number;
|
44 | filesWithIssues: Set<string>;
|
45 | issues: number;
|
46 | }
|
47 | export interface Issue extends cspell.TextDocumentOffset {
|
48 | }
|
49 | export interface GlobSrcInfo {
|
50 | matcher: GlobMatcher;
|
51 | source: string;
|
52 | }
|
53 | export declare type MessageType = 'Debug' | 'Info' | 'Progress';
|
54 | export declare type MessageTypeLookup = {
|
55 | [key in MessageType]: key;
|
56 | };
|
57 | export declare const MessageTypes: MessageTypeLookup;
|
58 | export interface MessageEmitter {
|
59 | (message: string, msgType: MessageType): void;
|
60 | }
|
61 | export interface DebugEmitter {
|
62 | (message: string): void;
|
63 | }
|
64 | export interface ErrorEmitter {
|
65 | (message: string, error: Error): Promise<void>;
|
66 | }
|
67 | export interface SpellingErrorEmitter {
|
68 | (issue: Issue): void;
|
69 | }
|
70 | export interface Emitters {
|
71 | issue: SpellingErrorEmitter;
|
72 | info: MessageEmitter;
|
73 | debug: DebugEmitter;
|
74 | error: ErrorEmitter;
|
75 | }
|
76 | interface GlobOptions extends minimatch.IOptions {
|
77 | cwd?: string;
|
78 | root?: string;
|
79 | }
|
80 | export declare class CSpellApplicationConfiguration {
|
81 | readonly files: string[];
|
82 | readonly options: CSpellApplicationOptions;
|
83 | readonly emitters: Emitters;
|
84 | readonly info: MessageEmitter;
|
85 | readonly debug: DebugEmitter;
|
86 | readonly logIssue: SpellingErrorEmitter;
|
87 | readonly uniqueFilter: (issue: Issue) => boolean;
|
88 | readonly local: string;
|
89 | readonly configGlob: string;
|
90 | readonly configGlobOptions: minimatch.IOptions;
|
91 | readonly excludes: GlobSrcInfo[];
|
92 | readonly root: string;
|
93 | constructor(files: string[], options: CSpellApplicationOptions, emitters: Emitters);
|
94 | }
|
95 | export declare function lint(files: string[], options: CSpellApplicationOptions, emitters: Emitters): Promise<RunResult>;
|
96 | export declare function trace(words: string[], options: TraceOptions): Promise<TraceResult[]>;
|
97 | export interface CheckTextResult extends CheckTextInfo {
|
98 | }
|
99 | export declare function checkText(filename: string, options: BaseOptions): Promise<CheckTextResult>;
|
100 | export declare function createInit(_: CSpellApplicationOptions): Promise<void>;
|
101 |
|
102 |
|
103 |
|
104 |
|
105 | declare function findFiles(globPatterns: string[], options: GlobOptions): Promise<string[]>;
|
106 | interface PatternRoot {
|
107 | pattern: string;
|
108 | root: string;
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | declare function normalizePattern(pat: string, root: string): PatternRoot;
|
120 | declare function _globP(pattern: string, options: GlobOptions): Promise<string[]>;
|
121 | export declare const _testing_: {
|
122 | _globP: typeof _globP;
|
123 | findFiles: typeof findFiles;
|
124 | normalizePattern: typeof normalizePattern;
|
125 | };
|