Skip to content

Commit a7ada1c

Browse files
MichaelDeBoeyerikras
authored andcommitted
Add flow & TypeScript files to Prettier (#65)
1 parent 7209f43 commit a7ada1c

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"setupFiles": ["raf/polyfill"]
7474
},
7575
"lint-staged": {
76-
"*.{js,json,md,css}": ["prettier --write", "git add"]
76+
"*.{js*,ts,json,md,css}": ["prettier --write", "git add"]
7777
},
7878
"bundlesize": [
7979
{

src/index.d.ts

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,75 @@
11
import * as React from 'react'
2-
import { FormApi, Config, Decorator, FormState, FormSubscription, FieldSubscription } from 'final-form'
2+
import {
3+
FormApi,
4+
Config,
5+
Decorator,
6+
FormState,
7+
FormSubscription,
8+
FieldSubscription
9+
} from 'final-form'
310

411
export type ReactContext = {
512
reactFinalForm: FormApi
613
}
714

815
export type FieldRenderProps = {
916
input: {
10-
name: string,
11-
onBlur: <T>(event?: React.FocusEvent<T>) => void,
12-
onChange: <T>(event: React.ChangeEvent<T> | any) => void,
13-
onFocus: <T>(event?: React.FocusEvent<T>) => void,
17+
name: string
18+
onBlur: <T>(event?: React.FocusEvent<T>) => void
19+
onChange: <T>(event: React.ChangeEvent<T> | any) => void
20+
onFocus: <T>(event?: React.FocusEvent<T>) => void
1421
value: any
15-
},
22+
}
1623
meta: Partial<{
1724
// TODO: Make a diff of `FieldState` without all the functions
18-
active: boolean,
19-
dirty: boolean,
20-
error: boolean,
21-
initial: boolean,
22-
invalid: boolean,
23-
pristine: boolean,
24-
submitError: boolean,
25-
submitFailed: boolean,
26-
submitSucceeded: boolean,
27-
touched: boolean,
28-
valid: boolean,
25+
active: boolean
26+
dirty: boolean
27+
error: boolean
28+
initial: boolean
29+
invalid: boolean
30+
pristine: boolean
31+
submitError: boolean
32+
submitFailed: boolean
33+
submitSucceeded: boolean
34+
touched: boolean
35+
valid: boolean
2936
visited: boolean
3037
}>
3138
}
3239

3340
export type FormRenderProps = {
34-
blur: (name: string) => void,
35-
change: (name: string, value: any) => void,
36-
focus: (name: string) => void,
37-
handleSubmit: (event: React.SyntheticEvent<HTMLFormElement>) => void,
38-
initialize: (values: object) => void,
41+
blur: (name: string) => void
42+
change: (name: string, value: any) => void
43+
focus: (name: string) => void
44+
handleSubmit: (event: React.SyntheticEvent<HTMLFormElement>) => void
45+
initialize: (values: object) => void
3946
reset: () => void
4047
} & FormState
4148

4249
export type FormSpyRenderProps = FormState
4350

4451
export type RenderableProps<T> = Partial<{
45-
children: ((props: T) => React.ReactNode) | React.ReactNode,
46-
component: React.ComponentType,
52+
children: ((props: T) => React.ReactNode) | React.ReactNode
53+
component: React.ComponentType
4754
render: (props: T) => React.ReactNode
4855
}>
4956

5057
export type FormProps = {
51-
subscription?: FormSubscription,
58+
subscription?: FormSubscription
5259
decorators?: Decorator[]
5360
} & Config &
5461
RenderableProps<FormRenderProps>
5562

5663
export type FieldProps = {
57-
allowNull?: boolean,
58-
name: string,
59-
subscription?: FieldSubscription,
60-
validate?: (value: any, allValues: object) => any,
64+
allowNull?: boolean
65+
name: string
66+
subscription?: FieldSubscription
67+
validate?: (value: any, allValues: object) => any
6168
value?: any
6269
} & RenderableProps<FieldRenderProps>
6370

6471
export type FormSpyProps = {
65-
onChange?: (formState: FormState) => void,
72+
onChange?: (formState: FormState) => void
6673
subscription?: FormSubscription
6774
} & RenderableProps<FormSpyRenderProps>
6875

0 commit comments

Comments
 (0)