Skip to content

Commit f040039

Browse files
feat(ajv): add ajv-formats for ajvResolver (#797)
* add ajv-formats for ajvResolver * change lint command and add @biomejs/biome as dev dep
1 parent 79cd8b2 commit f040039

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

ajv/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"react-hook-form": "^7.55.0",
1515
"@hookform/resolvers": "^2.0.0",
1616
"ajv": "^8.12.0",
17-
"ajv-errors": "^3.0.0"
17+
"ajv-errors": "^3.0.0",
18+
"ajv-formats": "^2.1.1"
1819
}
1920
}

ajv/src/ajv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';
22
import Ajv, { DefinedError } from 'ajv';
33
import ajvErrors from 'ajv-errors';
4+
import addFormats from 'ajv-formats';
45
import { FieldError, appendErrors } from 'react-hook-form';
56
import { AjvError, Resolver } from './types';
67

@@ -93,6 +94,7 @@ export const ajvResolver: Resolver =
9394
);
9495

9596
ajvErrors(ajv);
97+
addFormats(ajv);
9698

9799
const validate = ajv.compile(
98100
Object.assign(

bun.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@standard-schema/utils": "^0.3.0",
88
},
99
"devDependencies": {
10+
"@biomejs/biome": "^1.8.3",
1011
"@sinclair/typebox": "^0.34.30",
1112
"@standard-schema/spec": "^1.0.0",
1213
"@testing-library/dom": "^10.4.0",
@@ -22,6 +23,7 @@
2223
"@vitejs/plugin-react": "^4.3.4",
2324
"ajv": "^8.17.1",
2425
"ajv-errors": "^3.0.0",
26+
"ajv-formats": "^2.1.1",
2527
"arktype": "2.0.4",
2628
"check-export-map": "^1.3.1",
2729
"class-transformer": "^0.5.1",
@@ -274,6 +276,24 @@
274276

275277
"@babel/types": ["@babel/types@7.27.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg=="],
276278

279+
"@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
280+
281+
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@1.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
282+
283+
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@1.9.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="],
284+
285+
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="],
286+
287+
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="],
288+
289+
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="],
290+
291+
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="],
292+
293+
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@1.9.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="],
294+
295+
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@1.9.4", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="],
296+
277297
"@csstools/color-helpers": ["@csstools/color-helpers@5.0.2", "", {}, "sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA=="],
278298

279299
"@csstools/css-calc": ["@csstools/css-calc@2.1.2", "", { "peerDependencies": { "@csstools/css-parser-algorithms": "^3.0.4", "@csstools/css-tokenizer": "^3.0.3" } }, "sha512-TklMyb3uBB28b5uQdxjReG4L80NxAqgrECqLZFQbyLekwwlcDDS8r3f07DKqeo8C4926Br0gf/ZDe17Zv4wIuw=="],
@@ -484,6 +504,8 @@
484504

485505
"ajv-errors": ["ajv-errors@3.0.0", "", { "peerDependencies": { "ajv": "^8.0.1" } }, "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ=="],
486506

507+
"ajv-formats": ["ajv-formats@2.1.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
508+
487509
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
488510

489511
"ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
"build:fluentvalidation-ts": "microbundle --cwd fluentvalidation-ts --globals @hookform/resolvers=hookformResolvers,react-hook-form=ReactHookForm",
223223
"build:standard-schema": "microbundle --cwd standard-schema --globals @hookform/resolvers=hookformResolvers,react-hook-form=ReactHookForm,@standard-schema/spec=standardSchema",
224224
"postbuild": "node ./config/node-13-exports.js && check-export-map",
225-
"lint": "bunx @biomejs/biome check --write --vcs-use-ignore-file=true .",
225+
"lint": "biome check --write --vcs-use-ignore-file=true .",
226226
"lint:types": "tsc",
227227
"test": "vitest run",
228228
"test:watch": "vitest watch",
@@ -267,6 +267,7 @@
267267
},
268268
"homepage": "https://react-hook-form.com",
269269
"devDependencies": {
270+
"@biomejs/biome": "^1.8.3",
270271
"@sinclair/typebox": "^0.34.30",
271272
"@standard-schema/spec": "^1.0.0",
272273
"@testing-library/dom": "^10.4.0",
@@ -282,6 +283,7 @@
282283
"@vitejs/plugin-react": "^4.3.4",
283284
"ajv": "^8.17.1",
284285
"ajv-errors": "^3.0.0",
286+
"ajv-formats": "^2.1.1",
285287
"arktype": "2.0.4",
286288
"check-export-map": "^1.3.1",
287289
"class-transformer": "^0.5.1",

0 commit comments

Comments
 (0)