Skip to content

Commit d1c5823

Browse files
committed
perf(kit): replace valibot with zod
1 parent c105702 commit d1c5823

File tree

7 files changed

+50
-104
lines changed

7 files changed

+50
-104
lines changed

packages/utilities/kit/docs/@eslint-react/namespaces/LanguagePreference/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
# LanguagePreference
88

9-
## Variables
10-
11-
- [DEFAULT\_LANGUAGE\_PREFERENCE](variables/DEFAULT_LANGUAGE_PREFERENCE.md)
12-
139
## Functions
1410

1511
- [getFromContext](functions/getFromContext.md)

packages/utilities/kit/docs/@eslint-react/namespaces/LanguagePreference/functions/make.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ Get a copy of the default LanguagePreference.
1414

1515
`object`
1616

17-
### indentStyle
17+
### indentStyle?
1818

19-
> **indentStyle**: `"tab"` \| `"space"`
19+
> `optional` **indentStyle**: `"tab"` \| `"space"`
2020
21-
### indentWidth
21+
### indentWidth?
2222

23-
> **indentWidth**: `number`
23+
> `optional` **indentWidth**: `number`
2424
25-
### jsxQuoteStyle
25+
### jsxQuoteStyle?
2626

27-
> **jsxQuoteStyle**: `"single"` \| `"double"`
27+
> `optional` **jsxQuoteStyle**: `"single"` \| `"double"`
2828
29-
### quoteStyle
29+
### quoteStyle?
3030

31-
> **quoteStyle**: `"single"` \| `"double"`
31+
> `optional` **quoteStyle**: `"single"` \| `"double"`
3232
33-
### semicolons
33+
### semicolons?
3434

35-
> **semicolons**: `"always"` \| `"asNeeded"`
35+
> `optional` **semicolons**: `"always"` \| `"asNeeded"`
3636
37-
### trailingCommas
37+
### trailingCommas?
3838

39-
> **trailingCommas**: `"all"` \| `"es5"` \| `"none"`
39+
> `optional` **trailingCommas**: `"all"` \| `"es5"` \| `"none"`

packages/utilities/kit/docs/@eslint-react/namespaces/LanguagePreference/variables/DEFAULT_LANGUAGE_PREFERENCE.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

packages/utilities/kit/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
"dependencies": {
4545
"@eslint-react/eff": "workspace:*",
4646
"@typescript-eslint/utils": "^8.29.1",
47-
"ts-pattern": "^5.7.0",
48-
"valibot": "^1.0.0"
47+
"@zod/mini": "^4.0.0-beta.0",
48+
"ts-pattern": "^5.7.0"
4949
},
5050
"devDependencies": {
5151
"@local/configs": "workspace:*",

packages/utilities/kit/src/LanguagePreference/LanguagePreference.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
import type { SharedConfigurationSettings } from "@typescript-eslint/utils/ts-eslint"; // eslint-disable-line @typescript-eslint/no-unused-vars
2+
import type * as z from "@zod/mini";
23
import type { LanguagePreferenceSchema } from "./LanguagePreferenceSchema";
3-
import { type InferOutput } from "valibot";
44

55
/**
66
* @internal
77
*/
8-
export type LanguagePreference = InferOutput<typeof LanguagePreferenceSchema>;
9-
10-
/**
11-
* The default language preference.
12-
*/
13-
export const DEFAULT_LANGUAGE_PREFERENCE = {
14-
indentStyle: "space",
15-
indentWidth: 2,
16-
jsxQuoteStyle: "double",
17-
quoteStyle: "single",
18-
semicolons: "always",
19-
trailingCommas: "all",
20-
} as const satisfies LanguagePreference;
8+
export type LanguagePreference = z.infer<typeof LanguagePreferenceSchema>;
219

2210
/**
2311
* Get a copy of the default LanguagePreference.
2412
*/
2513
export function make(): LanguagePreference {
2614
return {
27-
...DEFAULT_LANGUAGE_PREFERENCE,
15+
indentStyle: "space",
16+
indentWidth: 2,
17+
jsxQuoteStyle: "double",
18+
quoteStyle: "single",
19+
semicolons: "always",
20+
trailingCommas: "all",
2821
};
2922
}
3023

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,41 @@
1-
import { literal, number, object, optional, union } from "valibot";
1+
import * as z from "@zod/mini";
22

33
/**
44
* @internal
55
*/
6-
export const LanguagePreferenceSchema = object({
7-
indentStyle: optional(
8-
union([
9-
literal("tab"),
10-
literal("space"),
6+
export const LanguagePreferenceSchema = z.object({
7+
indentStyle: z.optional(
8+
z.union([
9+
z.literal("tab"),
10+
z.literal("space"),
1111
]),
12-
"space",
1312
),
14-
indentWidth: optional(number(), 2),
15-
quoteStyle: optional(
16-
union([
17-
literal("single"),
18-
literal("double"),
13+
indentWidth: z.optional(z.number()),
14+
quoteStyle: z.optional(
15+
z.union([
16+
z.literal("single"),
17+
z.literal("double"),
1918
]),
20-
"single",
2119
),
22-
semicolons: optional(
23-
union([
24-
literal("always"),
25-
literal("asNeeded"),
20+
semicolons: z.optional(
21+
z.union([
22+
z.literal("always"),
23+
z.literal("asNeeded"),
2624
]),
27-
"always",
2825
),
29-
trailingCommas: optional(
30-
union([
31-
literal("all"),
32-
literal("es5"),
33-
literal("none"),
26+
trailingCommas: z.optional(
27+
z.union([
28+
z.literal("all"),
29+
z.literal("es5"),
30+
z.literal("none"),
3431
]),
35-
"all",
3632
),
3733

3834
// JSX specific options
39-
jsxQuoteStyle: optional(
40-
union([
41-
literal("single"),
42-
literal("double"),
35+
jsxQuoteStyle: z.optional(
36+
z.union([
37+
z.literal("single"),
38+
z.literal("double"),
4339
]),
44-
"double",
4540
),
46-
});
41+
}, {});

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)