forked from todogroup/repolinter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
111 lines (103 loc) · 2.76 KB
/
index.d.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
106
107
108
109
110
111
declare class FileSystem {
targetDir: string
filterPaths: string[]
static fileExists (file: string): Promise<boolean>
relativeFileExists (file: string): Promise<boolean>
getFilterFiles (): string[]
getFilterDirectories (): string[]
findFirst (
globs: string | string[],
nocase?: boolean
): Promise<undefined | string>
findFirstFile (
globs: string | string[],
nocase?: boolean
): Promise<undefined | string>
findAllFiles (
globs: string | string[],
nocase?: boolean
): Promise<undefined | string[]>
glob (globs: string | string[], options: any): Promise<string[]>
findAll (
globs: string | string[],
nocase?: boolean
): Promise<undefined | string[]>
isBinaryFile (relativeFile: string): Promise<boolean>
shouldInclude (path: string): boolean
getFileContents (relativeFile: string): Promise<string | undefined>
setFileContents (relativeFile: string, contents: string): Promise<any>
getFileLines (relativeFile: string, lineCount: number): Promise<string>
}
declare class Result {
message?: string
targets: Array<{
path?: string
pattern?: string
passed: boolean
message?: string
}>
passed: boolean
}
declare class RuleInfo {
name: string
level: 'off' | 'error' | 'warning'
where: string[]
ruleType: string
ruleConfig: any
fixType?: string
fixConfig?: any
policyInfo?: string
policyUrl?: string
sequentialOnly?: boolean
}
declare class FormatResult {
status: string
runMessage?: string
lintResult?: Result
fixResult?: Result
ruleInfo: RuleInfo
}
declare class LintResult {
params: {
targetDir: string
filterPaths: string[]
rulesetPath?: string
ruleset: any
}
passed: boolean
errored: boolean
errMsg?: string
results: FormatResult[]
targets: { [key: string]: Result }
formatOptions?: { [key: string]: any }
}
declare interface Formatter {
formatOutput(output: LintResult, dryRun: boolean): string
}
export declare function lint (
targetDir: string,
filterPaths?: string[],
ruleset?: any,
dryRun?: boolean
): Promise<LintResult>
export declare function runRuleset (
ruleset: RuleInfo[],
targets: boolean | { [key: string]: Result },
dryRun: boolean
): Promise<FormatResult[]>
export declare function determineTargets (
axiomconfig: any,
fs: FileSystem
): Promise<{ [key: string]: Result }>
export declare function validateConfig (
config: any
): Promise<{ passed: boolean; error?: string }>
export declare function parseConfig (config: any): RuleInfo[]
export declare function shouldRuleRun (
validTargets: string[],
ruleAxioms: string[]
): string[]
export declare const defaultFormatter: Formatter
export declare const jsonFormatter: Formatter
export declare const markdownFormatter: Formatter
export declare const resultFormatter: Formatter