Skip to content

Commit bf94b3e

Browse files
authored
Merge pull request #24 from coji/feat/zod_v4
Feat/zod v4
2 parents 6b4cfc1 + 4b4ce3f commit bf94b3e

6 files changed

Lines changed: 61 additions & 127 deletions

File tree

app/routes/$handle+/posts.$id.edit/route.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
getTextareaProps,
55
useForm,
66
} from '@conform-to/react'
7-
import { parseWithZod } from '@conform-to/zod'
7+
import { parseWithZod } from '@conform-to/zod/v4'
88
import { ArrowLeftIcon } from 'lucide-react'
99
import { data, Form, href, Link, redirect, useNavigation } from 'react-router'
1010
import { z } from 'zod'
@@ -20,11 +20,9 @@ const schema = z.discriminatedUnion('intent', [
2020
}),
2121
z.object({
2222
intent: z.literal('update'),
23-
title: z
24-
.string({ required_error: '必須です' })
25-
.max(60, 'タイトルは60字までです。'),
23+
title: z.string({ error: '必須です' }).max(60, 'タイトルは60字までです。'),
2624
content: z
27-
.string({ required_error: '必須です' })
25+
.string({ error: '必須です' })
2826
.max(14000, '最大文字数に達しました 14000 / 14000 字'),
2927
}),
3028
])

app/routes/welcome+/create_account/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getFormProps, getInputProps, useForm } from '@conform-to/react'
2-
import { parseWithZod } from '@conform-to/zod'
2+
import { parseWithZod } from '@conform-to/zod/v4'
33
import { FrownIcon } from 'lucide-react'
44
import { Form, redirect } from 'react-router'
55
import { z } from 'zod'
@@ -12,7 +12,7 @@ import type { Route } from './+types/route'
1212

1313
const schema = z.object({
1414
handle: z
15-
.string({ required_error: 'ハンドルネームは必須です' })
15+
.string({ error: 'ハンドルネームは必須です' })
1616
.min(3, '最低3文字必要です')
1717
.max(20, '最大20文字までです')
1818
.regex(

biome.json

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
3-
"assist": { "actions": { "source": { "organizeImports": "on" } } },
4-
"vcs": {
5-
"enabled": true,
6-
"clientKind": "git",
7-
"useIgnoreFile": true
8-
},
9-
"linter": {
10-
"enabled": true,
11-
"rules": {
12-
"recommended": true,
13-
"correctness": {
14-
"noUnusedVariables": {
15-
"level": "warn",
16-
"options": {
17-
"ignoreRestSiblings": true
18-
}
19-
}
20-
}
21-
},
22-
"includes": ["**", "!**/build"]
23-
24-
}
2+
"$schema": "https://biomejs.dev/schemas/2.1.3/schema.json",
3+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
4+
"vcs": {
5+
"enabled": true,
6+
"clientKind": "git",
7+
"useIgnoreFile": true
8+
},
9+
"linter": {
10+
"enabled": true,
11+
"rules": {
12+
"recommended": true,
13+
"correctness": {
14+
"noUnusedVariables": {
15+
"level": "warn",
16+
"options": {
17+
"ignoreRestSiblings": true
18+
}
19+
}
20+
}
21+
},
22+
"includes": ["**", "!**/build"]
23+
}
2524
}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"start": "npx sirv-cli build/client/ --single"
1616
},
1717
"dependencies": {
18-
"@conform-to/react": "^1.8.2",
19-
"@conform-to/zod": "^1.8.2",
18+
"@conform-to/react": "^1.9.1",
19+
"@conform-to/zod": "^1.9.1",
2020
"@react-router/node": "7.7.1",
2121
"@tailwindcss/vite": "^4.1.11",
2222
"class-variance-authority": "^0.7.1",
@@ -39,8 +39,7 @@
3939
"sonner": "^2.0.6",
4040
"tailwind-merge": "^3.3.1",
4141
"tailwindcss-animate": "^1.0.7",
42-
"zod": "^3.25.64",
43-
"zodix": "^0.4.4"
42+
"zod": "^4.1.8"
4443
},
4544
"devDependencies": {
4645
"@biomejs/biome": "^2.1.3",

pnpm-lock.yaml

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

react-router.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export default {
44
ssr: false,
55
future: {
66
unstable_middleware: true,
7+
unstable_optimizeDeps: true,
78
},
89
} satisfies Config

0 commit comments

Comments
 (0)