Skip to content

Commit 5c909f6

Browse files
committed
feat: upgrade to nextjs 15 and fix eslint errors
1 parent 165ca39 commit 5c909f6

File tree

20 files changed

+403
-371
lines changed

20 files changed

+403
-371
lines changed

frontend/app/debug/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import { getCookie } from "cookies-next/client";
44
import React, { useState } from "react";
55

6+
import { VERSION } from "@caviardeul/utils/config";
67
import SaveManagement from "@caviardeul/utils/save";
7-
import {VERSION} from "@caviardeul/utils/config";
88

99
const Page = () => {
1010
const [ready, setReady] = useState(false);

frontend/app/login/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"use client";
22

33
import { redirect } from "next/navigation";
4-
import { useEffect, useRef, useState } from "react";
4+
import React, { use, useEffect, useRef, useState } from "react";
55

66
import Loader from "@caviardeul/components/utils/loader";
77
import { sendLoginRequest } from "@caviardeul/lib/queries";
88

9-
const Page = ({ searchParams }: { searchParams: { user?: string } }) => {
9+
const Page = (props: { searchParams: Promise<{ user?: string }> }) => {
10+
const searchParams = use(props.searchParams);
1011
const [loggedIn, setLoggedIn] = useState(false);
1112
const userIdRef = useRef<string | null>(null);
1213
const userId = searchParams?.user ?? "";

frontend/components/game/article.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
standardizeText,
1818
} from "@caviardeul/utils/caviarding";
1919

20-
const _WordContainer: React.FC<{ word: string }> = ({ word }) => {
20+
const WordContainer_: React.FC<{ word: string }> = ({ word }) => {
2121
const { revealedWords, isOver, selection } = useContext(GameContext);
2222
if (word === undefined) {
2323
return null;
@@ -40,7 +40,7 @@ const _WordContainer: React.FC<{ word: string }> = ({ word }) => {
4040
}
4141
};
4242

43-
const WordContainer = React.memo(_WordContainer);
43+
const WordContainer = React.memo(WordContainer_);
4444

4545
const parseHTML = (content: string): ReactNode => {
4646
const doc = parse(content);

frontend/components/game/gameManager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export const GameContext = createContext<{
3434
userScore?: UserScore;
3535
canPlay: boolean;
3636
// callbacks
37-
updateSelection: (word: string | null) => void;
38-
makeAttempt: (word: string) => void;
37+
updateSelection: (_word: string | null) => void;
38+
makeAttempt: (_word: string) => void;
3939
}>({
4040
isOver: false,
4141
canPlay: false,

frontend/components/settings/manager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const getInitialSettings = (): Settings => {
1313
let settings;
1414
try {
1515
settings = SaveManagement.getSettings();
16-
} catch (e) {
16+
} catch (_e) {
1717
return defaultSettings;
1818
}
1919
return {
@@ -24,7 +24,7 @@ const getInitialSettings = (): Settings => {
2424

2525
export const SettingsContext = createContext<{
2626
settings: Settings;
27-
onChangeSettings: (newSettings: Partial<Settings>) => void;
27+
onChangeSettings: (_newSettings: Partial<Settings>) => void;
2828
}>({
2929
settings: defaultSettings,
3030
onChangeSettings: () => {},

frontend/components/utils/error.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
import React from "react";
21
import Error from "next/error";
2+
import React from "react";
33

4-
5-
const CustomError: React.FC<{ statusCode?: number, text?: string }> = ({statusCode, text}) => {
4+
const CustomError: React.FC<{ statusCode?: number; text?: string }> = ({
5+
statusCode,
6+
text,
7+
}) => {
68
return (
79
<main>
810
<div className="error">
9-
<Error statusCode={statusCode ?? 500} title={text ?? "Une erreur est survenue"}/>
11+
<Error
12+
statusCode={statusCode ?? 500}
13+
title={text ?? "Une erreur est survenue"}
14+
/>
1015
</div>
1116
</main>
12-
)
13-
}
17+
);
18+
};
1419

15-
export default CustomError
20+
export default CustomError;

frontend/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
namespace NodeJS {
23
interface ProcessEnv {
34
NEXT_PUBLIC_API_URL?: string;

frontend/eslint.config.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const compat = new FlatCompat({
1414
allConfig: js.configs.all,
1515
});
1616

17-
export default [
17+
const config = [
1818
{
1919
ignores: ["**/.next/*", "**/node_modules/*"],
2020
},
@@ -34,6 +34,17 @@ export default [
3434

3535
rules: {
3636
"prettier/prettier": "error",
37+
"no-unused-vars": [
38+
"error",
39+
{
40+
argsIgnorePattern: "^_",
41+
caughtErrorsIgnorePattern: "^_",
42+
destructuredArrayIgnorePattern: "^_",
43+
ignoreRestSiblings: true,
44+
},
45+
],
3746
},
3847
},
3948
];
49+
50+
export default config;

frontend/lib/article.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { APIError } from "@caviardeul/lib/queries";
12
import { ArticleId, EncodedArticle } from "@caviardeul/types";
23
import { API_URL } from "@caviardeul/utils/config";
3-
import {APIError} from "@caviardeul/lib/queries";
44

55
export const getEncodedArticle = async (
66
articleId?: ArticleId,
@@ -24,7 +24,7 @@ export const getEncodedArticle = async (
2424

2525
const data = await res.json();
2626
if (!res.ok) {
27-
throw new APIError(res.status, data.details ?? "")
27+
throw new APIError(res.status, data.details ?? "");
2828
}
2929

3030
return {

frontend/package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"cookies-next": "^5.0.0",
1515
"fernet": "^0.3.2",
1616
"latinize": "^2.0.0",
17-
"next": "^14.2.10",
17+
"next": "^15.0.3",
1818
"node-html-parser": "^6.1.8",
1919
"qrcode.react": "^4.0.1",
20-
"react": "^18.1.0",
21-
"react-dom": "^18.1.0",
20+
"react": "19.0.0-rc.1",
21+
"react-dom": "19.0.0-rc.1",
2222
"react-icons": "^5.0.1",
2323
"swr": "^2.2.4"
2424
},
@@ -29,15 +29,19 @@
2929
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
3030
"@types/latinize": "^0.2.15",
3131
"@types/node": "^22.5.4",
32-
"@types/react": "^18.0.9",
33-
"@types/react-dom": "^18.0.4",
32+
"@types/react": "npm:types-react@19.0.0-rc.1",
33+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
3434
"eslint": "^9.9.1",
35-
"eslint-config-next": "^14.2.5",
35+
"eslint-config-next": "^15.0.3",
3636
"eslint-config-prettier": "^9.1.0",
3737
"eslint-plugin-prettier": "^5.2.1",
3838
"eslint-plugin-react": "^7.37.2",
3939
"prettier": "^3.0.3",
4040
"sass": "^1.52.1",
4141
"typescript": "^5.0.2"
42+
},
43+
"resolutions": {
44+
"@types/react": "npm:[email protected]",
45+
"@types/react-dom": "npm:[email protected]"
4246
}
4347
}

0 commit comments

Comments
 (0)