Fix some lints

This commit is contained in:
MartinBraquet
2025-08-04 11:44:24 +02:00
parent c45adc1a8a
commit e6de25c0a4
10 changed files with 36 additions and 41 deletions

8
.eslintrc.js Normal file
View File

@@ -0,0 +1,8 @@
// .eslintrc.js
module.exports = {
root: true,
extends: ['next', 'next/core-web-vitals'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
}

View File

@@ -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 (
<div className="min-h-screen py-12 px-4 sm:px-6 lg:px-8">
{getProfile('/api/profile', header)}
{Profile('/api/profile', header)}
</div>
)
;

View File

@@ -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 (
<div className="min-h-screen py-12 px-4 sm:px-6 lg:px-8">
{getProfile(`/api/profiles/${id}`)}
{Profile(`/api/profiles/${id}`)}
</div>
);
}

View File

@@ -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() {
<div className="p-4 h-full flex flex-col">
<div className="flex items-center space-x-4">
{renderImages && (<div className="flex-shrink-0">
<img
<Image
className="h-16 w-16 rounded-full object-cover"
src={images[idx]}
alt={``}
@@ -294,7 +295,7 @@ export default function ProfilePage() {
</svg>
<h3 className="mt-2 text-sm font-medium">No profiles found</h3>
<p className="mt-1 text-sm">
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."}
</p>
</div>
)}

View File

@@ -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;

28
jest.setup.d.ts vendored
View File

@@ -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<R> {
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<R> {
// toBeInTheDocument(): R;
// toHaveClass(...classes: string[]): R;
// // Add other custom matchers you use from @testing-library/jest-dom
// }
// }
// }
//
// export {};

View File

@@ -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<any>(null);
@@ -95,7 +95,7 @@ export function getProfile(url: string, header: any = null) {
}
fetchImage();
}, []);
}, [url]);
if (loading) {
return <LoadingSpinner/>;

1
package-lock.json generated
View File

@@ -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",

View File

@@ -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', () => {

View File

@@ -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
}