Skip to content

Commit 5dde691

Browse files
authored
Update biome to v2, zod to v4, all other deps as well (#50)
# Description Updated all the deps ## Type of change Please mark relevant options with an `x` in the brackets. - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Algorithm update - updates algorithm documentation/questions/answers etc. - [ ] Other (please describe): # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Integration tests - [ ] Unit tests - [ ] Manual tests - [ ] No tests required # Reviewer checklist Mark everything that needs to be checked before merging the PR. - [ ] Check if the UI is working as expected and is satisfactory - [ ] Check if the code is well documented - [ ] Check if the behavior is what is expected - [ ] Check if the code is well tested - [ ] Check if the code is readable and well formatted - [ ] Additional checks (document below if any) # Screenshots (if appropriate): # Questions (if appropriate):
1 parent c8a1bdc commit 5dde691

16 files changed

+1614
-1936
lines changed

app/entry.server.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ export default async function handleRequest(
2222
const callbackName = isbot(request.headers.get("user-agent")) ? "onAllReady" : "onShellReady"
2323
const instance = createInstance()
2424
const lng = appContext.lang
25-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
26-
const ns = i18nextOpts.getRouteNamespaces(context as any)
25+
const ns = i18nextOpts.getRouteNamespaces(context)
2726

2827
await instance
2928
.use(initReactI18next) // Tell our instance to use react-i18next

app/env.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { z } from "zod"
1+
import { z } from "zod/v4"
22

33
const envSchema = z.object({
44
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
@@ -13,7 +13,7 @@ let env: ServerEnv
1313
* @returns Initialized env vars
1414
*/
1515
function initEnv() {
16-
// biome-ignore lint/nursery/noProcessEnv: This should be the only place to use process.env directly
16+
// biome-ignore lint/style/noProcessEnv: This should be the only place to use process.env directly
1717
const envData = envSchema.safeParse(process.env)
1818

1919
if (!envData.success) {

app/library/link/Link.browser.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { userEvent } from "@vitest/browser/context"
33
import { useLocation } from "react-router"
44
import type { StubRouteEntry } from "tests/setup.browser"
55
import { Link, type LinkProps } from "./link"
6+
67
const getEntries: (linkProps?: LinkProps) => StubRouteEntry[] = (linkProps) => [
78
{
89
path: "/first",

app/library/link/useEnhancedTo.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ export const useEnhancedTo = ({
3131
language,
3232
to,
3333
keepSearchParams,
34-
}: { language?: Language; to: To; keepSearchParams?: boolean }) => {
34+
}: {
35+
language?: Language
36+
to: To
37+
keepSearchParams?: boolean
38+
}) => {
3539
const [params] = useSearchParams()
3640
const { lng, ...searchParams } = Object.fromEntries(params.entries())
3741
// allow language override for language switcher or manually setting the language in specific cases
38-
const lang = language ?? params.get("lng")
42+
const lang = language ?? lng
3943
const newSearchParams = new URLSearchParams(searchParams)
4044
const searchString = newSearchParams.toString()
4145
const hasSearchParams = searchString.length > 0

app/localization/resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const languages = ["en", "bs"] as const
55
export const supportedLanguages = [...languages]
66
export type Language = (typeof languages)[number]
77

8-
type Resource = {
8+
export type Resource = {
99
common: typeof english
1010
}
1111

app/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useTranslation } from "react-i18next"
2-
import { Links, Meta, Outlet, Scripts, ScrollRestoration, isRouteErrorResponse, useRouteError } from "react-router"
32
import type { LinksFunction } from "react-router"
3+
import { isRouteErrorResponse, Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteError } from "react-router"
44
import { useChangeLanguage } from "remix-i18next/react"
55
import type { Route } from "./+types/root"
66
import { LanguageSwitcher } from "./library/language-switcher"

app/routes/resource.locales.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
import { cacheHeader } from "pretty-cache-header"
2-
import { z } from "zod"
3-
import { resources } from "~/localization/resource"
2+
import { z } from "zod/v4"
3+
import { type Language, type Namespace, resources } from "~/localization/resource"
44
import type { Route } from "./+types/resource.locales"
55

66
export async function loader({ request, context }: Route.LoaderArgs) {
77
const { isProductionDeployment } = context
88
const url = new URL(request.url)
99

10-
const lng = z
11-
.string()
12-
.refine((lng): lng is keyof typeof resources => Object.keys(resources).includes(lng))
13-
.parse(url.searchParams.get("lng"))
10+
const lng = z.enum(Object.keys(resources) as Language[]).parse(url.searchParams.get("lng"))
1411

1512
const namespaces = resources[lng]
1613

17-
const ns = z
18-
.string()
19-
.refine((ns): ns is keyof typeof namespaces => {
20-
return Object.keys(resources[lng]).includes(ns)
21-
})
22-
.parse(url.searchParams.get("ns"))
14+
const ns = z.enum(Object.keys(resources[lng]) as Namespace[]).parse(url.searchParams.get("ns"))
2315

2416
const headers = new Headers()
2517

app/routes/sitemap.$lang[.]xml.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { Route } from "./+types/sitemap.$lang[.]xml"
55
export const loader = async ({ request, params }: Route.LoaderArgs) => {
66
const domain = createDomain(request)
77

8-
// @ts-expect-error - This import exists but is not picked up by the typescript compiler because it's a remix internal
98
const { routes } = await import("virtual:react-router/server-build")
109

1110
const sitemap = await generateRemixSitemap({

app/tailwind.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import "tailwindcss";
2-
2+
/** biome-ignore lint/nursery/noUnknownAtRule: This is a rule for the Tailwind CSS file */
33
@theme {
44
/* Your theme styles go here */
55
--animate-float: float 3s ease-in-out infinite;

biome.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"files": {
4-
"ignore": ["app/library/icon/**/*"]
4+
"includes": ["**", "!**/app/library/icon/**/*"]
55
},
66
"vcs": {
77
"enabled": true,
@@ -13,9 +13,7 @@
1313
"enabled": true,
1414
"lineWidth": 120
1515
},
16-
"organizeImports": {
17-
"enabled": true
18-
},
16+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
1917
"linter": {
2018
"enabled": true,
2119
"rules": {
@@ -25,7 +23,18 @@
2523
"noConsole": "error"
2624
},
2725
"style": {
28-
"recommended": true
26+
"recommended": true,
27+
"noParameterAssign": "error",
28+
"useAsConstAssertion": "error",
29+
"useDefaultParameterLast": "error",
30+
"useEnumInitializers": "error",
31+
"useSelfClosingElements": "error",
32+
"useSingleVarDeclarator": "error",
33+
"noUnusedTemplateLiteral": "error",
34+
"useNumberNamespace": "error",
35+
"noInferrableTypes": "error",
36+
"noUselessElse": "error",
37+
"noProcessEnv": "error"
2938
},
3039
"complexity": {
3140
"recommended": true
@@ -48,7 +57,6 @@
4857
},
4958
"nursery": {
5059
"recommended": true,
51-
"noProcessEnv": "error",
5260
"useSortedClasses": {
5361
"level": "error",
5462
"fix": "safe",

0 commit comments

Comments
 (0)