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 declare type TraceOptions = BaseOptions;
|
34 | export interface BaseOptions {
|
35 | config?: string;
|
36 | languageId?: string;
|
37 | local?: string;
|
38 | }
|
39 | export declare type AppError = NodeJS.ErrnoException;
|
40 | export interface RunResult {
|
41 | files: number;
|
42 | filesWithIssues: Set<string>;
|
43 | issues: number;
|
44 | errors: number;
|
45 | }
|
46 | export declare type Issue = cspell.TextDocumentOffset;
|
47 | export interface GlobSrcInfo {
|
48 | matcher: GlobMatcher;
|
49 | source: string;
|
50 | }
|
51 | export declare type MessageType = 'Debug' | 'Info' | 'Progress';
|
52 | export declare type MessageTypeLookup = {
|
53 | [key in MessageType]: key;
|
54 | };
|
55 | export declare const MessageTypes: MessageTypeLookup;
|
56 | export interface MessageEmitter {
|
57 | (message: string, msgType: MessageType): void;
|
58 | }
|
59 | export interface DebugEmitter {
|
60 | (message: string): void;
|
61 | }
|
62 | export interface ErrorEmitterVoid {
|
63 | (message: string, error: Error): void;
|
64 | }
|
65 | export interface ErrorEmitterPromise {
|
66 | (message: string, error: Error): Promise<void>;
|
67 | }
|
68 | declare type ErrorEmitter = ErrorEmitterVoid | ErrorEmitterPromise;
|
69 | export interface SpellingErrorEmitter {
|
70 | (issue: Issue): void;
|
71 | }
|
72 | export interface Emitters {
|
73 | issue: SpellingErrorEmitter;
|
74 | info: MessageEmitter;
|
75 | debug: DebugEmitter;
|
76 | error: ErrorEmitter;
|
77 | }
|
78 | interface GlobOptions extends minimatch.IOptions {
|
79 | cwd?: string;
|
80 | root?: string;
|
81 | }
|
82 | export declare class CSpellApplicationConfiguration {
|
83 | readonly files: string[];
|
84 | readonly options: CSpellApplicationOptions;
|
85 | readonly emitters: Emitters;
|
86 | readonly info: MessageEmitter;
|
87 | readonly debug: DebugEmitter;
|
88 | readonly logIssue: SpellingErrorEmitter;
|
89 | readonly uniqueFilter: (issue: Issue) => boolean;
|
90 | readonly local: string;
|
91 | readonly configFile: string | undefined;
|
92 | readonly configGlob: string;
|
93 | readonly configGlobOptions: minimatch.IOptions;
|
94 | readonly excludes: GlobSrcInfo[];
|
95 | readonly root: string;
|
96 | constructor(files: string[], options: CSpellApplicationOptions, emitters: Emitters);
|
97 | }
|
98 | export declare function lint(files: string[], options: CSpellApplicationOptions, emitters: Emitters): Promise<RunResult>;
|
99 | export declare function trace(words: string[], options: TraceOptions): Promise<TraceResult[]>;
|
100 | export declare type CheckTextResult = CheckTextInfo;
|
101 | export declare function checkText(filename: string, options: BaseOptions): Promise<CheckTextResult>;
|
102 | export declare function createInit(_: CSpellApplicationOptions): Promise<void>;
|
103 | /**
|
104 | * Looks for matching glob patterns or stdin
|
105 | * @param globPatterns patterns or stdin
|
106 | */
|
107 | declare function findFiles(globPatterns: string[], options: GlobOptions): Promise<string[]>;
|
108 | interface PatternRoot {
|
109 | pattern: string;
|
110 | root: string;
|
111 | }
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | declare function normalizePattern(pat: string, root: string): PatternRoot;
|
122 | declare function _globP(pattern: string, options: GlobOptions): Promise<string[]>;
|
123 | export declare const _testing_: {
|
124 | _globP: typeof _globP;
|
125 | findFiles: typeof findFiles;
|
126 | normalizePattern: typeof normalizePattern;
|
127 | };
|