diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..bea7a698 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,8 @@ +// .eslintrc.js +module.exports = { + root: true, + extends: ['next', 'next/core-web-vitals'], + rules: { + '@typescript-eslint/no-explicit-any': 'off', + }, +} diff --git a/app/profile/page.tsx b/app/profile/page.tsx index 4c371ffd..fd604ff0 100644 --- a/app/profile/page.tsx +++ b/app/profile/page.tsx @@ -2,7 +2,7 @@ import Link from 'next/link'; import {usePathname, useRouter} from "next/navigation"; -import {getProfile} from "@/lib/client/profile"; +import {Profile} from "@/lib/client/profile"; import {useEffect} from "react"; import {useSession} from "next-auth/react"; @@ -39,7 +39,7 @@ export default function ProfilePage() { return (
- {getProfile('/api/profile', header)} + {Profile('/api/profile', header)}
) ; diff --git a/app/profiles/[id]/page.tsx b/app/profiles/[id]/page.tsx index 33f93c45..bf1ba703 100644 --- a/app/profiles/[id]/page.tsx +++ b/app/profiles/[id]/page.tsx @@ -1,7 +1,7 @@ 'use client'; import {useParams} from "next/navigation"; -import {getProfile} from "@/lib/client/profile"; +import {Profile} from "@/lib/client/profile"; export const dynamic = "force-dynamic"; // This disables SSG and ISR @@ -11,7 +11,7 @@ export default function Post() { return (
- {getProfile(`/api/profiles/${id}`)} + {Profile(`/api/profiles/${id}`)}
); } diff --git a/app/profiles/page.tsx b/app/profiles/page.tsx index d22fa30c..3f521a01 100644 --- a/app/profiles/page.tsx +++ b/app/profiles/page.tsx @@ -5,6 +5,7 @@ import {useCallback, useEffect, useState} from "react"; import LoadingSpinner from "@/lib/client/LoadingSpinner"; import {ProfileData} from "@/lib/client/schema"; import {dropdownConfig, ProfileFilters} from "./ProfileFilters"; +import Image from "next/image"; // Disable static generation export const dynamic = "force-dynamic"; @@ -111,7 +112,7 @@ export default function ProfilePage() { } finally { setLoading(false); } - }, [filters]); + }, [filters, images]); useEffect(() => { fetchProfiles(); @@ -241,7 +242,7 @@ export default function ProfilePage() {
{renderImages && (
- {``}

No profiles found

- Try adjusting your search or filter to find what you're looking for. + {"Try adjusting your search or filter to find what you're looking for."}

)} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 950a226f..00000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); - -const compat = new FlatCompat({ - baseDirectory: __dirname, -}); - -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), - ...compat.rules({"@typescript-eslint/no-explicit-any": "off",}) -]; - -export default eslintConfig; diff --git a/jest.setup.d.ts b/jest.setup.d.ts index 453a3709..fcffd96d 100644 --- a/jest.setup.d.ts +++ b/jest.setup.d.ts @@ -1,14 +1,14 @@ -// This file extends the global Jest namespace with custom matchers from @testing-library/jest-dom -import '@testing-library/jest-dom'; - -declare global { - namespace jest { - interface Matchers { - toBeInTheDocument(): R; - toHaveClass(...classes: string[]): R; - // Add other custom matchers you use from @testing-library/jest-dom - } - } -} - -export {}; +// // This file extends the global Jest namespace with custom matchers from @testing-library/jest-dom +// import '@testing-library/jest-dom'; +// +// declare global { +// namespace jest { +// interface Matchers { +// toBeInTheDocument(): R; +// toHaveClass(...classes: string[]): R; +// // Add other custom matchers you use from @testing-library/jest-dom +// } +// } +// } +// +// export {}; diff --git a/lib/client/profile.tsx b/lib/client/profile.tsx index 872f3b50..5d695219 100644 --- a/lib/client/profile.tsx +++ b/lib/client/profile.tsx @@ -59,7 +59,7 @@ export function DeleteProfileButton({profileId, onDelete}: DeleteProfileButtonPr ); } -export function getProfile(url: string, header: any = null) { +export function Profile(url: string, header: any = null) { const [loading, setLoading] = useState(true); const [userData, setUserData] = useState(null); @@ -95,7 +95,7 @@ export function getProfile(url: string, header: any = null) { } fetchImage(); - }, []); + }, [url]); if (loading) { return ; diff --git a/package-lock.json b/package-lock.json index f1000f3d..3b99acc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5678,6 +5678,7 @@ "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.4.tgz", "integrity": "sha512-xDXgLjVunjHqczScfkCJ9iyjdNOVHvvCdqHSSxwM9L0l/wHkTRum67SDc020uAlCoqktJplgO2AAQeLP1wgqDQ==", "dev": true, + "license": "MIT", "dependencies": { "@adobe/css-tools": "^4.4.0", "aria-query": "^5.0.0", diff --git a/lib/client/__tests__/LoadingSpinner.test.tsx b/tests/LoadingSpinner.test.tsx similarity index 92% rename from lib/client/__tests__/LoadingSpinner.test.tsx rename to tests/LoadingSpinner.test.tsx index 3a49c470..e75836f0 100644 --- a/lib/client/__tests__/LoadingSpinner.test.tsx +++ b/tests/LoadingSpinner.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import LoadingSpinner from '../LoadingSpinner'; +import LoadingSpinner from '../lib/client/LoadingSpinner'; describe('LoadingSpinner', () => { it('renders a loading spinner', () => { diff --git a/tsconfig.json b/tsconfig.json index 17517cc2..b678ce96 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,5 +24,7 @@ }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"], + "types": ["jest", "@testing-library/jest-dom"], + "typeRoots": ["./node_modules/@types", "./types"], "sourceMap": true }