-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
types.ts
92 lines (78 loc) · 1.84 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
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
import type { Linter } from 'eslint'
import type { RuleMetaData } from '@typescript-eslint/utils/ts-eslint'
export interface FlatConfigItem extends Omit<Linter.FlatConfig, 'files' | 'ignores'> {
name?: string
index: number
files?: (string | string[])[]
ignores?: string[]
}
export type RuleLevel = 'off' | 'warn' | 'error'
export interface Payload {
configs: FlatConfigItem[]
rules: Record<string, RuleInfo>
meta: PayloadMeta
files?: MatchedFile[]
}
export interface ResolvedPayload extends Payload {
configsIgnoreOnly: FlatConfigItem[]
configsGeneral: FlatConfigItem[]
ruleToState: Map<string, RuleConfigStates>
globToConfigs: Map<string, FlatConfigItem[]>
/**
* Resolved data from files
* Undefined if users disabled glob matching
*/
filesResolved?: {
list: string[]
globToFiles: Map<string, Set<string>>
configToFiles: Map<number, Set<string>>
fileToGlobs: Map<string, Set<string>>
fileToConfigs: Map<string, FlatConfigItem[]>
groups: FilesGroup[]
}
}
export interface MatchedFile {
/**
* Filepath
*/
filepath: string
/**
* Matched globs, includes both positive and negative globs
*/
globs: string[]
/**
* Matched configs indexes
*/
configs: number[]
}
export interface ErrorInfo {
error: string
message?: string
}
export interface FilesGroup {
id: string
files: string[]
configs: FlatConfigItem[]
globs: Set<string>
}
export interface PayloadMeta {
wsPort?: number
lastUpdate: number
basePath: string
configPath: string
}
export interface RuleInfo extends RuleMetaData<any, any> {
name: string
plugin: string
}
export interface FiltersConfigsPage {
rule?: string
filepath?: string
}
export interface RuleConfigState {
name: string
configIndex: number
level: RuleLevel
options?: any[]
}
export type RuleConfigStates = RuleConfigState[]