Skip to content

Commit d13cd87

Browse files
authored
Upgrade React v19 & others (#88)
* more upgrades * react 19 * prettier
1 parent affa226 commit d13cd87

File tree

8 files changed

+1955
-1945
lines changed

8 files changed

+1955
-1945
lines changed

package-lock.json

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

package.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
"dependencies": {
2525
"@radix-ui/react-label": "^2.1.2",
2626
"@radix-ui/react-slot": "^1.1.2",
27-
"axios": "^0.21.4",
27+
"axios": "^1.8.4",
2828
"class-variance-authority": "^0.7.1",
2929
"clsx": "^2.1.1",
30-
"history": "^4.10.1",
31-
"lucide-react": "^0.482.0",
32-
"react": "^18.2.0",
33-
"react-dom": "^18.2.0",
30+
"history": "^5.3.0",
31+
"lucide-react": "^0.487.0",
32+
"react": "^19.1.0",
33+
"react-dom": "^19.1.0",
3434
"react-router": "^7.4.1",
35-
"tailwind-merge": "^3.0.2",
35+
"tailwind-merge": "^3.1.0",
3636
"tailwindcss-animate": "^1.0.7"
3737
},
3838
"scripts": {
@@ -59,29 +59,30 @@
5959
]
6060
},
6161
"devDependencies": {
62-
"@tailwindcss/vite": "^4.0.14",
63-
"@testing-library/react": "^14.0.0",
64-
"@testing-library/user-event": "^14.4.3",
65-
"@types/node": "^16.18.14",
66-
"@types/react": "^18.0.28",
67-
"@types/react-dom": "^18.0.11",
68-
"@typescript-eslint/eslint-plugin": "^7.18.0",
69-
"@typescript-eslint/parser": "^7.18.0",
62+
"@tailwindcss/vite": "^4.1.1",
63+
"@testing-library/dom": "^10.4.0",
64+
"@testing-library/react": "^16.3.0",
65+
"@testing-library/user-event": "^14.6.1",
66+
"@types/node": "^22.13.17",
67+
"@types/react": "^19.1.0",
68+
"@types/react-dom": "^19.1.1",
69+
"@typescript-eslint/eslint-plugin": "^8.29.0",
70+
"@typescript-eslint/parser": "^8.29.0",
7071
"@vitejs/plugin-react": "^4.3.4",
7172
"eslint": "^8.10.0",
72-
"eslint-config-prettier": "^9.1.0",
73-
"eslint-plugin-check-file": "^2.8.0",
73+
"eslint-config-prettier": "^10.1.1",
74+
"eslint-plugin-check-file": "^3.1.0",
7475
"eslint-plugin-deprecation": "^3.0.0",
75-
"eslint-plugin-jsx-a11y": "^6.7.1",
76-
"eslint-plugin-react": "^7.32.2",
77-
"eslint-plugin-react-hooks": "^4.0.0",
78-
"eslint-plugin-testing-library": "^5.10.2",
79-
"jsdom": "^21.1.1",
80-
"postcss": "^8.4.21",
81-
"prettier": "3.1.1",
76+
"eslint-plugin-jsx-a11y": "^6.10.2",
77+
"eslint-plugin-react": "^7.37.4",
78+
"eslint-plugin-react-hooks": "^5.2.0",
79+
"eslint-plugin-testing-library": "^7.1.1",
80+
"jsdom": "^26.0.0",
81+
"postcss": "^8.5.3",
82+
"prettier": "3.5.3",
8283
"prettier-plugin-tailwindcss": "^0.6.11",
83-
"tailwindcss": "^4.0.14",
84-
"typescript": "^5.5.4",
84+
"tailwindcss": "^4.1.1",
85+
"typescript": "^5.8.2",
8586
"vite": "^6.2.4",
8687
"vite-plugin-svgr": "^4.3.0",
8788
"vite-tsconfig-paths": "^5.1.4",

src/config/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fetchVariable = (varName: string, defaultValue?: string) => {
22
if (!import.meta.env[varName] && typeof defaultValue === "undefined") {
33
throw new Error(`Mandatory environment variable ${varName} is not set.`);
44
}
5-
return String(import.meta.env[varName] || defaultValue);
5+
return String(import.meta.env[varName] ?? defaultValue);
66
};
77

88
const nodeEnv = fetchVariable("MODE");

src/hocs/with-layout/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ interface LayoutProps {
1414
layoutType: LayoutType;
1515
}
1616

17-
const Layout = ({ layoutType, children }: LayoutProps): JSX.Element | null => {
17+
const Layout = ({
18+
layoutType,
19+
children,
20+
}: LayoutProps): React.JSX.Element | null => {
1821
if (layoutType === LayoutType.Default) {
1922
return <div>{children}</div>;
2023
}

src/networking/api-service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class ApiServiceClass {
2727
throw new ApiError({
2828
// NOTE: we need to disable these rules since there's no way for us to type the `data` object.
2929
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
30-
code: data?.code || ErrorCode.UNEXPECTED_ERROR,
30+
code: data?.code ?? ErrorCode.UNEXPECTED_ERROR,
3131
status: data?.status,
32-
message: data?.message || "An unexpected error has occurred",
32+
message: data?.message ?? "An unexpected error has occurred",
3333
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
3434
});
3535
}
@@ -40,7 +40,11 @@ class ApiServiceClass {
4040
config: RequestInit = {},
4141
): Promise<ReturnType> {
4242
const updatedConfig = { ...config };
43-
updatedConfig.headers = { ...this.addedHeaders, ...(config.headers ?? {}) };
43+
updatedConfig.headers = Object.assign(
44+
{},
45+
this.addedHeaders,
46+
config.headers ?? {},
47+
);
4448
const fullURL = new URL(path, constants.apiBaseURL);
4549
const response = await fetch(fullURL, {
4650
method,

src/routes/routes.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ const ROUTES = [
7171
* This type is used to extract the type of the route params
7272
* from the path string.
7373
*/
74-
export type RouteParams = {
75-
[K in RouteName]: Route;
76-
} & Params;
74+
export type RouteParams = Record<RouteName, Route> & Params;
7775

7876
export const routes = ROUTES.map(setPathParams);

src/routes/scroll-to-top/scroll-to-top.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useEffect, useRef } from "react";
1+
import { useEffect, useRef, type ReactNode } from "react";
22
import type { Location } from "react-router";
33
import { useLocation } from "react-router";
44

55
interface ScrollToTopProps {
6-
children: JSX.Element;
6+
children: ReactNode;
77
}
88

99
const urlFromLocation = (location?: Location) =>

src/tests/helpers/render-with-router.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { render } from "@testing-library/react";
2+
import type React from "react";
23
import { BrowserRouter } from "react-router";
34

45
export const renderWithRouter = (
5-
component: JSX.Element,
6+
component: React.JSX.Element,
67
{ route = "/" } = {},
78
): ReturnType<typeof render> => {
89
window.history.pushState({}, "Test page", route);

0 commit comments

Comments
 (0)