-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
67 lines (55 loc) · 1.68 KB
/
types.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
import {Conflicts, Duplicates, DuplicatesConfig, Indentation, PatternConfig, PatternMismatch, PrettifyOptions} from '@lib';
export type Mode = 'off' | 'warn' | 'error';
export type Li18ntOption<T> = [Mode, T?]
export interface Li18ntOptions {
prettified: Indentation | PrettifyOptions;
duplicates: boolean | DuplicatesConfig;
conflicts: boolean;
naming: PatternConfig;
}
export interface Li18ntResult {
prettified: string[];
duplicates: Duplicates[];
conflicts: Conflicts;
naming: PatternMismatch[][];
}
export type PartialLi18ntResult<T extends Partial<Li18ntOptions>> = {
[P in keyof T]: T[P] extends undefined ?
never : P extends keyof Li18ntResult ?
Li18ntResult[P] : never
}
export type CLIRules = {
prettified: Li18ntOption<PrettifyOptions>;
duplicates: Li18ntOption<DuplicatesConfig>;
conflicts: Li18ntOption<boolean>;
naming: Li18ntOption<PatternConfig>;
}
export interface CLIOptions {
rules: CLIRules;
fix?: boolean;
debug?: boolean;
quiet?: boolean;
config?: string;
skipInvalid?: boolean;
report?: boolean;
}
export interface SourceFile {
content: JSONObject;
source: string;
filePath: string;
name: string;
}
export interface CLIModuleArguments<Config> {
files: SourceFile[];
cmd: CLIOptions;
rule: Li18ntOption<Config>;
}
export interface CLIModule<Config = undefined> {
(args: CLIModuleArguments<Config>): boolean;
}
export type PropertyPath = (string | number)[];
export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
export type JSONArray = JSONValue[] | JSONObject[];
export interface JSONObject {
[key: string]: JSONValue;
}