-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
ValidationTypes.ts
47 lines (37 loc) · 1.35 KB
/
ValidationTypes.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
import type { MappedText, TextOffset as TextOffsetRW } from '@cspell/cspell-types';
import type { ValidationResult } from '../Models/ValidationResult';
export type TextOffsetRO = Readonly<TextOffsetRW>;
export interface ValidationOptions extends IncludeExcludeOptions {
maxNumberOfProblems?: number;
maxDuplicateProblems?: number;
minWordLength?: number;
// words to always flag as an error
flagWords?: string[];
allowCompoundWords?: boolean;
/** ignore case when checking words against dictionary or ignore words list */
ignoreCase: boolean;
}
export interface CheckOptions extends ValidationOptions {
allowCompoundWords: boolean;
ignoreCase: boolean;
}
export interface IncludeExcludeOptions {
ignoreRegExpList?: RegExp[];
includeRegExpList?: RegExp[];
}
export interface WordRangeAcc {
textOffset: TextOffsetRO;
isIncluded: boolean;
rangePos: number;
}
export type ValidationResultRO = Readonly<ValidationResult>;
export type LineValidatorFn = (line: LineSegment) => Iterable<ValidationResult>;
export interface LineSegment {
line: TextOffsetRO;
segment: TextOffsetRO;
}
export interface MappedTextValidationResult extends MappedText {
isFlagged?: boolean | undefined;
isFound?: boolean | undefined;
}
export type TextValidatorFn = (text: MappedText) => Iterable<MappedTextValidationResult>;