Skip to content

Commit 0cc628b

Browse files
committed
chore: apply prettier formatting
1 parent 1ac1258 commit 0cc628b

21 files changed

+156
-143
lines changed

.github/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exemptLabels:
77
- pinned
88
- security
99
# Label to use when marking an issue as stale
10-
staleLabel:
10+
staleLabel:
1111
# Comment to post when marking an issue as stale. Set to `false` to disable
1212
markComment: >
1313
This issue has been automatically marked as stale because it has not had

.github/workflows/lock-issue.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: 'Lock Issues'
1+
name: "Lock Issues"
22

33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 0,6,12,18 * * *'
6+
- cron: "0 0,6,12,18 * * *"
77

88
permissions:
99
issues: write

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm-lock.yaml

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
23
"endOfLine": "lf",
34
"semi": false,
45
"singleQuote": false,

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ React Hook Form uses prettier.
5656
If possible, enable the prettier plugin in your editor to get real-time feedback. The formatting can be run manually with the following command:
5757

5858
```shellscript
59-
pnpm run format
59+
pnpm run format:fix
6060
```
6161

6262
## License

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"eslint-plugin-react-hooks": "^4.6.0",
4747
"husky": "^8.0.3",
4848
"lint-staged": "^13.2.2",
49-
"prettier": "^2.8.8",
49+
"prettier": "^3.4.2",
5050
"typescript": "^5.1.3"
5151
},
5252
"keywords": [
@@ -58,7 +58,8 @@
5858
"analyze": "cross-env ANALYZE=true next build",
5959
"build": "next build",
6060
"dev": "next dev",
61-
"format": "prettier --write",
61+
"format": "prettier . --check",
62+
"format:fix": "prettier . --write",
6263
"lint": "next lint --fix",
6364
"now-build": "pnpm run build",
6465
"start": "next start",
@@ -67,7 +68,7 @@
6768
},
6869
"lint-staged": {
6970
"*.{ts,tsx,mdx,css,json}": [
70-
"pnpm run format"
71+
"pnpm run format:fix"
7172
]
7273
}
7374
}

pnpm-lock.yaml

Lines changed: 68 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Watcher.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ const Watcher = ({ isPlayWatch }: { isPlayWatch: boolean }) => {
7070
i === 13
7171
? "W"
7272
: i === 14
73-
? "Wa"
74-
: i === 15
75-
? "Wat"
76-
: i === 16
77-
? "Watc"
78-
: i === 17
79-
? "Watch"
80-
: i === 18
81-
? "Watchi"
82-
: i === 19
83-
? "Watchin"
84-
: i === 20
85-
? "Watching"
86-
: "Watching."
73+
? "Wa"
74+
: i === 15
75+
? "Wat"
76+
: i === 16
77+
? "Watc"
78+
: i === 17
79+
? "Watch"
80+
: i === 18
81+
? "Watchi"
82+
: i === 19
83+
? "Watchin"
84+
: i === 20
85+
? "Watching"
86+
: "Watching."
8787
)
8888
}
8989

src/components/layout.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,17 @@ a.skip-main:active {
523523
width: 1px;
524524
height: 1px;
525525
border: 1px solid transparent;
526-
box-shadow: -2px 0 0 -1px currentColor, 2px 0 0 -1px currentColor,
527-
0 -2px 0 -1px currentColor, 0 2px 0 -1px currentColor,
528-
-6px 0 0 -1px currentColor, 6px 0 0 -1px currentColor,
529-
-4px -2px 0 -1px currentColor, -4px 2px 0 -1px currentColor,
530-
4px -2px 0 -1px currentColor, 4px 2px 0 -1px currentColor;
526+
box-shadow:
527+
-2px 0 0 -1px currentColor,
528+
2px 0 0 -1px currentColor,
529+
0 -2px 0 -1px currentColor,
530+
0 2px 0 -1px currentColor,
531+
-6px 0 0 -1px currentColor,
532+
6px 0 0 -1px currentColor,
533+
-4px -2px 0 -1px currentColor,
534+
-4px 2px 0 -1px currentColor,
535+
4px -2px 0 -1px currentColor,
536+
4px 2px 0 -1px currentColor;
531537
}
532538

533539
.keyboard.icon:after {

src/components/sponsorsList.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function SponsorsList() {
1111
target="_blank"
1212
rel="noopener noreferrer"
1313
>
14-
<img src="/images/casinoreviews.png" alt="Casino Reviews"/>
14+
<img src="/images/casinoreviews.png" alt="Casino Reviews" />
1515
</a>
1616
<a
1717
href="https://www.beekai.com/"
@@ -28,16 +28,9 @@ export function SponsorsList() {
2828
target="_blank"
2929
rel="noopener noreferrer"
3030
>
31-
<img
32-
src="/images/route4me.png"
33-
alt="route4me"
34-
/>
31+
<img src="/images/route4me.png" alt="route4me" />
3532
</a>
36-
<a
37-
href="https://twicsy.com/"
38-
target="_blank"
39-
rel="noopener noreferrer"
40-
>
33+
<a href="https://twicsy.com/" target="_blank" rel="noopener noreferrer">
4134
<img
4235
className={styles.twicsy}
4336
src="/images/twicsy.png"

src/content/docs/formprovider.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ export default function App() {
3535
const methods = useForm()
3636

3737
const onSubmit = (data) => console.log(data)
38-
const { register, reset } = methods;
38+
const { register, reset } = methods
3939

4040
useEffect(() => {
4141
reset({
42-
name: 'data'
42+
name: "data",
4343
})
44-
}, [reset]); // ❌ never put `methods` as the deps
44+
}, [reset]) // ❌ never put `methods` as the deps
4545

4646
return (
4747
<FormProvider {...methods}>
4848
// pass all methods into the context
4949
<form onSubmit={methods.handleSubmit(onSubmit)}>
5050
<NestedInput />
51-
<input {...register('name')} />
51+
<input {...register("name")} />
5252
<input type="submit" />
5353
</form>
5454
</FormProvider>

src/content/docs/usecontroller/controller.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The following table contains information about properties which `Controller` pro
3535
| `field` | `onChange` | <TypeText>`(value: any) => void`</TypeText> | A function which sends the input's value to the library.<br/><br/> _It should be assigned to the `onChange` prop of the input and value should **not be `undefined`**._ <br/>This prop update [formState](/docs/useform/formstate) and you should avoid manually invoke [setValue](/docs/useform/setvalue) or other API related to field update. |
3636
| `field` | `onBlur` | <TypeText>`() => void`</TypeText> | A function which sends the input's onBlur event to the library. It should be assigned to the input's `onBlur` prop. |
3737
| `field` | `value` | <TypeText>unknown</TypeText> | The current value of the controlled component. |
38-
| `field` | `disabled` | <TypeText>boolean</TypeText> | The disabled state of the input. |
38+
| `field` | `disabled` | <TypeText>boolean</TypeText> | The disabled state of the input. |
3939
| `field` | `name` | <TypeText>string</TypeText> | Input's name being registered. |
4040
| `field` | `ref` | <TypeText>React.ref</TypeText> | A ref used to connect hook form to the input. Assign `ref` to component's input ref to allow hook form to focus the error input. |
4141
| `fieldState` | `invalid` | <TypeText>boolean</TypeText> | Invalid state for current input. |

src/content/docs/useform.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,11 @@ useForm({
154154
- There are other options for including form data:
155155

156156
```javascript
157+
// adding a hidden input
157158
<input {...register("hidden", { value: "data" })} type="hidden" />
159+
```
158160

161+
```javascript
159162
// include data onSubmit
160163
const onSubmit = (data) => {
161164
const output = {
@@ -731,7 +734,7 @@ const methods = useForm()
731734

732735
useEffect(() => {
733736
methods.reset({ ... })
734-
}, [methods.reset]}
737+
}, [methods.reset])
735738
```
736739

737740
<Admonition type="tip" >

src/content/docs/useform/form.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ By default, we will send a POST request with your form submission data as [FormD
3333

3434
All props are optional
3535

36-
| Name | Type | Description | Example |
37-
| ---------------- | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
38-
| `control` | <TypeText>`Control`</TypeText> | [`control`](/docs/useform/control) object provided by invoking `useForm`. Optional when using `FormProvider`. | <CodeArea withOutCopy rawData="<Form control={control} />"/> |
39-
| `children` | <TypeText>`React.ReactNode`</TypeText> | |
40-
| `render` | <TypeText>`Function`</TypeText> | Render prop function suitable for headless component. | <CodeArea withOutCopy rawData="<Form render={({ submit }) => <View/>} />" /> |
41-
| `onSubmit` | <TypeText>`Function`</TypeText> | Function invoked after successful validation. | <CodeArea withOutCopy rawData="<Form onSubmit={({ data }) => mutation(data)} />"/> |
42-
| `onSuccess` | <TypeText>`Function`</TypeText> | Function called after successful request to the server. | <CodeArea withOutCopy rawData="<Form onSuccess={({ response }) => {}} />" /> |
36+
| Name | Type | Description | Example |
37+
| ---------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
38+
| `control` | <TypeText>`Control`</TypeText> | [`control`](/docs/useform/control) object provided by invoking `useForm`. Optional when using `FormProvider`. | <CodeArea withOutCopy rawData="<Form control={control} />"/> |
39+
| `children` | <TypeText>`React.ReactNode`</TypeText> | |
40+
| `render` | <TypeText>`Function`</TypeText> | Render prop function suitable for headless component. | <CodeArea withOutCopy rawData="<Form render={({ submit }) => <View/>} />" /> |
41+
| `onSubmit` | <TypeText>`Function`</TypeText> | Function invoked after successful validation. | <CodeArea withOutCopy rawData="<Form onSubmit={({ data }) => mutation(data)} />"/> |
42+
| `onSuccess` | <TypeText>`Function`</TypeText> | Function called after successful request to the server. | <CodeArea withOutCopy rawData="<Form onSuccess={({ response }) => {}} />" /> |
4343
| `onError` | <TypeText>`Function`</TypeText> | Function called after failed request to the server.<br/><br/>`setError` function will be called to update errors state. `root.server` will be used as error key. | <CodeArea withOutCopy rawData="<Form onError={({ response }) => {}} />" /> |
44-
| `headers` | <TypeText>`Record<string, string>`</TypeText> | Request headers object. | <CodeArea withOutCopy rawData="<Form headers={{ accessToken: 'xxx', 'Content-Type': 'application/json' }} />"/> |
45-
| `validateStatus` | <TypeText>`(status: number) => boolean`</TypeText> | Function to validate status code. | <CodeArea withOutCopy rawData="<Form validateStatus={status => status === 200} />" /> |
44+
| `headers` | <TypeText>`Record<string, string>`</TypeText> | Request headers object. | <CodeArea withOutCopy rawData="<Form headers={{ accessToken: 'xxx', 'Content-Type': 'application/json' }} />"/> |
45+
| `validateStatus` | <TypeText>`(status: number) => boolean`</TypeText> | Function to validate status code. | <CodeArea withOutCopy rawData="<Form validateStatus={status => status === 200} />" /> |
4646

4747
<Admonition type="important" title="Rules">
4848

@@ -67,7 +67,7 @@ All props are optional
6767

6868
<Form onSubmit={onSubmit} control={control} action="/api/test" method="post">
6969
<input {...register("test", { required: true })} />
70-
</Form />
70+
</Form>
7171

7272
// Renders
7373

@@ -114,7 +114,8 @@ function App() {
114114
{" "}
115115
<input {...register("name")} />
116116
{isSubmitSuccessful && <p>Form submit successful.</p>}
117-
{errors?.root?.server && <p>Form submit failed.</p>} <button>submit</button>
117+
{errors?.root?.server && <p>Form submit failed.</p>}
118+
<button>submit</button>
118119
</Form>
119120
// Manual form submission
120121
<Form

src/content/docs/useform/handlesubmit.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ This function will receive the form data if form validation is successful.
3939
} catch (e) {
4040
// handle your error
4141
}
42-
};
42+
}
4343

44-
<form onSubmit={handleSubmit(onSubmit)} />
44+
return <form onSubmit={handleSubmit(onSubmit)} />
4545
```
4646

4747
</Admonition>

src/content/docs/useform/reset.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ Reset the entire form state, fields reference, and subscriptions. There are opti
4242
```
4343
- It's fine to run `reset` without argument as long as you have provided a `defaultValues` at useForm.
4444

45-
```javascript
46-
reset(); // update form back to default values
45+
```javascript
46+
reset() // update form back to default values
4747

48-
reset({ test: 'test' }); // update your defaultValues && form values
48+
reset({ test: "test" }) // update your defaultValues && form values
4949

50-
reset(undefined, { keepDirtyValues: true }); // reset other form state but keep defaultValues and form values
51-
```
50+
reset(undefined, { keepDirtyValues: true }) // reset other form state but keep defaultValues and form values
51+
```
5252

5353
</Admonition>
5454

src/content/docs/useform/seterror.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The function allows you to manually set one or more errors.
2222

2323
- This method will not persist the associated input error if the input passes `register`'s associated rules.
2424
```javascript
25-
register('registerInput', { minLength: 4 });
26-
setError('registerInput', { type: 'custom', message: 'custom message' });
25+
register("registerInput", { minLength: 4 })
26+
setError("registerInput", { type: "custom", message: "custom message" })
2727
// validation will pass as long as minLength requirement pass
2828
```
2929
- An error that is not associated with an input field will be persisted until cleared with `clearErrors`. This behaviour is only applicable for built-in validation at field level.

src/content/docs/useformcontext.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ import { useForm, FormProvider, useFormContext } from "react-hook-form"
3636
export default function App() {
3737
const methods = useForm()
3838
const onSubmit = (data) => console.log(data)
39-
const { register, reset } = methods;
39+
const { register, reset } = methods
4040

4141
useEffect(() => {
4242
reset({
43-
name: 'data'
43+
name: "data",
4444
})
45-
}, [reset]); // ❌ never put `methods` as the deps
45+
}, [reset]) // ❌ never put `methods` as the deps
4646

4747
return (
4848
<FormProvider {...methods}>
4949
// pass all methods into the context
5050
<form onSubmit={methods.handleSubmit(onSubmit)}>
5151
<NestedInput />
52-
<input {...register('name')} />
52+
<input {...register("name")} />
5353
<input type="submit" />
5454
</form>
5555
</FormProvider>

0 commit comments

Comments
 (0)