Skip to content

Commit ddd7fe2

Browse files
authored
#180 Bump Next to v15 (#181)
* feat: update dependencies for React and Next.js * chore: migrate ESLint configuration to new format * chore: update eslint config and dependencies * fix: sonarjs rules for todo tags and commented code * chore: update ESLint configuration and dependencies for improved compatibility * feat: change eslint config into .ts * chore: migrate ESLint configuration back to .mjs format and add import order plugin * chore: run lint auto fix to deal with imports * refactor: fix remaining lint issues * fix: ts issues * fix: remaining ts issues
1 parent d942a62 commit ddd7fe2

File tree

124 files changed

+2472
-1127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2472
-1127
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"eslint.workingDirectories": ["./frontend"]
2+
"eslint.workingDirectories": ["./frontend"],
3+
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll": "always"
6+
}
37
}

frontend/.eslintrc.json

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

frontend/eslint.config.mjs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { dirname } from 'path';
2+
import { fileURLToPath } from 'url';
3+
4+
import { FlatCompat } from '@eslint/eslintrc';
5+
import js from '@eslint/js';
6+
import eslintConfigPrettier from 'eslint-config-prettier';
7+
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
8+
import importPlugin from 'eslint-plugin-import-x';
9+
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
10+
import { configs as sonarjsConfigs } from 'eslint-plugin-sonarjs';
11+
import tseslint from 'typescript-eslint';
12+
13+
const __filename = fileURLToPath(import.meta.url);
14+
const __dirname = dirname(__filename);
15+
16+
const compat = new FlatCompat({
17+
baseDirectory: __dirname,
18+
recommendedConfig: js.configs.recommended,
19+
allConfig: js.configs.all,
20+
});
21+
22+
export default tseslint.config(
23+
js.configs.recommended,
24+
sonarjsConfigs.recommended,
25+
importPlugin.flatConfigs.recommended,
26+
importPlugin.flatConfigs.typescript,
27+
eslintConfigPrettier,
28+
eslintPluginPrettier,
29+
...compat.extends('next/core-web-vitals', 'next/typescript'),
30+
{
31+
rules: {
32+
'sonarjs/todo-tag': ['warn'],
33+
'sonarjs/no-commented-code': ['warn'],
34+
'import-x/order': [
35+
'error',
36+
{
37+
pathGroups: [
38+
{
39+
pattern: '@app/**',
40+
group: 'internal',
41+
position: 'after',
42+
},
43+
],
44+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
45+
alphabetize: { order: 'asc', caseInsensitive: true },
46+
'newlines-between': 'always',
47+
},
48+
],
49+
},
50+
},
51+
// Typescript resolver is required for `eslint-import-plugin-x` to resolve
52+
// typescript files.
53+
{
54+
settings: {
55+
'import-x/resolver-next': [
56+
createTypeScriptImportResolver({
57+
alwaysTryTypes: true,
58+
}),
59+
],
60+
},
61+
},
62+
);

frontend/package.json

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,34 @@
66
"scripts": {
77
"build": "next build",
88
"compile": "tsc --noEmit",
9-
"dev": "next dev",
9+
"dev": "next dev --turbopack",
1010
"format": "prettier 'src/**/*.{js,jsx,ts,tsx}' --write",
1111
"postinstall": "cd .. && husky frontend/.husky",
1212
"lint": "next lint",
1313
"lint:fix": "next lint --fix",
1414
"start": "next start",
1515
"test": "echo \"tests\""
1616
},
17+
"resolutions": {
18+
"@types/react": "19.0.10",
19+
"@types/react-dom": "19.0.4"
20+
},
1721
"dependencies": {
1822
"@editorjs/checklist": "^1.6.0",
1923
"@editorjs/editorjs": "^2.30.8",
2024
"@editorjs/header": "^2.8.7",
2125
"@editorjs/list": "^1.10.0",
2226
"@editorjs/paragraph": "^2.11.6",
23-
"@headlessui/react": "^2.0.4",
27+
"@headlessui/react": "^2.2.0",
2428
"@hookform/error-message": "^2.0.1",
2529
"@hookform/resolvers": "^3.9.0",
2630
"@supabase/ssr": "0.5",
2731
"@supabase/supabase-js": "^2.44.4",
2832
"clsx": "^2.1.0",
2933
"framer-motion": "^12.4.3",
30-
"next": "14.2.24",
31-
"react": "^18",
32-
"react-dom": "^18",
34+
"next": "15.1.7",
35+
"react": "19.0.0",
36+
"react-dom": "19.0.0",
3337
"react-easy-crop": "^5.0.7",
3438
"react-hook-form": "^7.52.0",
3539
"react-hot-toast": "^2.4.1",
@@ -43,24 +47,29 @@
4347
"devDependencies": {
4448
"@commitlint/cli": "^19.3.0",
4549
"@commitlint/config-conventional": "^19.2.2",
50+
"@eslint/js": "^9.21.0",
4651
"@tailwindcss/typography": "^0.5.13",
47-
"@types/node": "^20",
48-
"@types/react": "^18",
49-
"@types/react-dom": "^18",
50-
"@typescript-eslint/eslint-plugin": "^7.14.1",
52+
"@types/eslint-config-prettier": "^6.11.3",
53+
"@types/node": "22.13.1",
54+
"@types/react": "19.0.10",
55+
"@types/react-dom": "19.0.4",
56+
"@typescript-eslint/parser": "^8.25.0",
5157
"autoprefixer": "^10.0.1",
52-
"eslint": "^8",
53-
"eslint-config-next": "14.2.4",
54-
"eslint-config-prettier": "^9.1.0",
55-
"eslint-plugin-prettier": "^5.1.3",
56-
"eslint-plugin-sonarjs": "^0.24.0",
58+
"eslint": "^9.21.0",
59+
"eslint-config-next": "^15.1.7",
60+
"eslint-config-prettier": "^10.0.1",
61+
"eslint-import-resolver-typescript": "^3.8.3",
62+
"eslint-plugin-import-x": "^4.6.1",
63+
"eslint-plugin-prettier": "^5.2.3",
64+
"eslint-plugin-sonarjs": "^3.0.2",
5765
"husky": "^9.0.11",
5866
"lint-staged": "^15.2.7",
59-
"postcss": "^8",
60-
"prettier": "3.2.5",
67+
"postcss": "8.4.39",
68+
"prettier": "^3.5.2",
6169
"prettier-plugin-tailwindcss": "^0.6.6",
6270
"tailwindcss": "^3.4.4",
63-
"typescript": "^5"
71+
"typescript": "^5.7.3",
72+
"typescript-eslint": "^8.24.1"
6473
},
6574
"packageManager": "[email protected]",
6675
"engines": {
File renamed without changes.

frontend/src/actions/user.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'use server';
22

3+
import { createClient as createSupabaseClient } from '@supabase/supabase-js';
34
import { revalidatePath } from 'next/cache';
45
import { redirect } from 'next/navigation';
56

6-
import { createClient } from '@app/utils/supabase/server';
7-
import { createClient as createSupabaseClient } from '@supabase/supabase-js';
8-
import { routes } from '@app/constants';
97
import {
108
AddEmployeeForm,
119
addEmployeeFormNames,
1210
} from '@app/components/pages/People/addEmployee/AddEmployeeFormProvider';
11+
import { routes } from '@app/constants';
1312
import { userStatus } from '@app/types/user';
13+
import { createClient } from '@app/utils/supabase/server';
1414

1515
export async function login(formData: FormData) {
16-
const supabase = createClient();
16+
const supabase = await createClient();
1717

1818
// type-casting here for convenience
1919
// in practice, you should validate your inputs
@@ -86,6 +86,7 @@ export async function createEmployee(data: AddEmployeeForm & { status: keyof typ
8686
const { error } = await supabase.auth.admin.createUser({
8787
email: data[addEmployeeFormNames.email],
8888
email_confirm: true,
89+
// eslint-disable-next-line sonarjs/no-hardcoded-passwords
8990
password: 'password',
9091
user_metadata: {
9192
...userMeta,

frontend/src/app/(app)/(addEmployee)/people/add-new/main-ladder/[[...id]]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { MainLadder as MainLadderPage } from '@app/components/pages/People/addEm
22
import { createClient } from '@app/utils/supabase/server';
33

44
const getLadders = async () => {
5-
const supabase = createClient();
5+
const supabase = await createClient();
66
const { data: ladders, error } = await supabase.from('ladder').select();
77

88
if (!error) {

frontend/src/app/(app)/(addProject)/my-space/add-new/project-scope/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { redirect } from 'next/navigation';
2+
13
import { ProjectScope } from '@app/components/pages/mySpace/addProject/ProjectScope';
24
import { BandWithBuckets } from '@app/types/library';
35
import { UserLadder } from '@app/types/user';
46
import { mapKeysToCamelCase } from '@app/utils';
57
import { createClient } from '@app/utils/supabase/server';
6-
import { redirect } from 'next/navigation';
78

89
export default async function Score() {
9-
const supabase = createClient();
10+
const supabase = await createClient();
1011
const {
1112
data: { user },
1213
error,

frontend/src/app/(app)/(root)/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { redirect } from 'next/navigation';
2+
13
import { Sidebar } from '@app/components/modules/Sidebar';
24
import { Topbar } from '@app/components/modules/Topbar';
35
import { User } from '@app/types/user';
46
import { mapKeysToCamelCase } from '@app/utils';
57
import { createClient } from '@app/utils/supabase/server';
6-
import { redirect } from 'next/navigation';
78

89
const getUser = async () => {
9-
const supabase = createClient();
10+
const supabase = await createClient();
1011
const {
1112
data: { user },
1213
error,

frontend/src/app/(app)/(root)/library/[ladder]/[bucket]/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { BucketDetails } from '@app/components/pages/BucketDetails';
2-
import { createClient } from '@app/utils/supabase/server';
3-
import { mapKeysToCamelCase } from '@app/utils';
42
import { Bucket } from '@app/types/library';
3+
import { mapKeysToCamelCase } from '@app/utils';
4+
import { createClient } from '@app/utils/supabase/server';
55

6-
export default async function BucketDetailed({ params }: { params: { bucket: string; ladder: string } }) {
7-
const { bucket: bucketSlug, ladder: ladderSlug } = params;
8-
const supabase = createClient();
6+
export default async function BucketDetailed({ params }: { params: Promise<{ bucket: string; ladder: string }> }) {
7+
const { bucket: bucketSlug, ladder: ladderSlug } = await params;
8+
const supabase = await createClient();
99
const { data: bucket } = await supabase
1010
.from('bucket')
1111
.select(

0 commit comments

Comments
 (0)