This repository has been archived by the owner on May 27, 2019. It is now read-only.
/
types.d.ts
143 lines (123 loc) · 3.31 KB
/
types.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
declare module '*.css' {
const locals: {
[key: string]: string
}
export default locals
}
declare module 'stylelint' {
export type FormatterType = 'json' | 'string' | 'verbose'
export type SyntaxType = 'scss' | 'less' | 'sugarss'
export interface Config {
extends: string | string[]
rules: {
[key: string]: any
}
}
export interface LinterOptions {
code?: string
codeFilename?: string
config?: Config
configBasedir?: string
configFile?: string
configOverrides?: Config
cache?: boolean
cacheLocation?: string
files?: string | string[]
fix?: boolean
formatter?: FormatterType
ignoreDisables?: boolean
reportNeedlessDisables?: boolean
ignorePath?: boolean
syntax?: SyntaxType
customSyntax?: string
}
export interface LinterResult {
errored: boolean
output: string
postcssResults: any[]
results: LintResult[]
}
export interface Warning {
line: number
column: number
rule: string
severity: 'error' | 'warning'
text: string
}
export interface LintResult {
source: string
errored: boolean | undefined
ignored: boolean | undefined
warnings: Warning[]
deprecations: string[]
invalidOptionWarnings: any[]
}
export namespace formatters {
function json(results: LintResult[]): string
function string(results: LintResult[]): string
function verbose(results: LintResult[]): string
}
export function lint(options?: LinterOptions): Promise<LinterResult>
}
declare module 'danger-plugin-eslint' {
export default () => any
}
declare module 'preact-router' {
import preact from 'preact'
export function route(url: string, replace?: boolean): boolean
export function route(options: { url: string; replace?: boolean }): boolean
export function getCurrentUrl(): string
export interface Location {
pathname: string
search: string
}
export interface CustomHistory {
listen(callback: (location: Location) => void): () => void
location: Location
push(path: string): void
replace(path: string): void
}
export interface RoutableProps {
path?: string
default?: boolean
}
export interface RouterOnChangeArgs {
router: Router
url: string
previous?: string
active: preact.VNode[]
current: preact.VNode
}
export interface RouterProps extends RoutableProps {
history?: CustomHistory
static?: boolean
url?: string
onChange?: (args: RouterOnChangeArgs) => void
}
export class Router extends preact.Component<RouterProps, {}> {
canRoute(url: string): boolean
getMatchingChildren(
children: preact.VNode[],
url: string,
invoke: boolean
): preact.VNode[]
routeTo(url: string): boolean
render(props: RouterProps): preact.VNode
}
export const subscribers: Array<(url: string) => void>
export interface RouteProps<Props> extends RoutableProps {
component: preact.AnyComponent<Props>
}
export function Route(
props: ({ default: boolean } | { path: string }) & {
component: AnyComponent<{ [key: string]: string }>
}
): preact.VNode
export function Link(
props: { activeClassName?: string } & JSX.HTMLAttributes
): preact.VNode
declare module 'preact' {
export interface Attributes extends RoutableProps {}
}
export default Router
}