-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
options.ts
105 lines (97 loc) · 2.37 KB
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
export interface Options extends Check {
/**
* Number of spelling suggestions to make.
* @default 8
*/
numSuggestions: number;
/**
* Generate suggestions
* @default true
*/
generateSuggestions: boolean;
/**
* Output debug logs
* @default false
*/
debugMode?: boolean;
}
export interface Check {
/**
* Ignore import and require names
* @default true
*/
ignoreImports?: boolean;
/**
* Ignore the properties of imported variables, structures, and types.
*
* Example:
* ```
* import { example } from 'third-party';
*
* const msg = example.property; // `property` is not spell checked.
* ```
*
* @default true
*/
ignoreImportProperties?: boolean;
/**
* Spell check identifiers (variables names, function names, class names, etc.)
* @default true
*/
checkIdentifiers?: boolean;
/**
* Spell check strings
* @default true
*/
checkStrings?: boolean;
/**
* Spell check template strings
* @default true
*/
checkStringTemplates?: boolean;
/**
* Spell check comments
* @default true
*/
checkComments?: boolean;
/**
* Specify a path to a custom word list file
*/
customWordListFile?: CustomWordListFilePath | CustomWordListFile | undefined;
}
/**
* Specify a path to a custom word list file
*/
export type CustomWordListFilePath = string;
export interface CustomWordListFile {
/**
* Path to word list file.
* File format: 1 word per line
*/
path: CustomWordListFilePath;
/**
* **Experimental**: Provide a fix option to add words to the file.
*
* Note: this does not yet work perfectly.
*/
addWords: boolean;
}
export const defaultCheckOptions: Required<Check> = {
checkComments: true,
checkIdentifiers: true,
checkStrings: true,
checkStringTemplates: true,
customWordListFile: undefined,
ignoreImportProperties: true,
ignoreImports: true,
};
export const defaultOptions: Required<Options> = {
...defaultCheckOptions,
numSuggestions: 8,
generateSuggestions: true,
debugMode: false,
};
export function normalizeOptions(opts: Options | undefined): Required<Options> {
const options: Required<Options> = Object.assign({}, defaultOptions, opts || {});
return options;
}