implemented initial eslintFixes

This commit is contained in:
PxlLoewe
2025-07-09 01:06:54 -07:00
parent f793f2623b
commit 98ed0cb5ca
20 changed files with 309 additions and 111 deletions

View File

@@ -24,7 +24,7 @@ export const DateInput = <T extends FieldValues>({
locale={"de"}
onChange={(date) => field.onChange(date)}
selected={field.value}
{...(props as any)}
{...props}
/>
)}
/>

View File

@@ -1,24 +1,18 @@
import { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from 'react';
import { InputHTMLAttributes, ReactNode } from "react";
interface FormTextInputProps extends InputHTMLAttributes<HTMLInputElement> {
error: any;
Svg: ReactNode;
children?: ReactNode;
error: ReactNode;
children?: ReactNode;
}
export const FormTextInput = ({
error,
Svg,
children,
...props
}: FormTextInputProps) => {
return (
<>
<label className="input input-bordered flex items-center gap-2">
{children}
<input {...props} />
</label>
<p className="text-error">{error}</p>
</>
);
export const FormTextInput = ({ error, children, ...props }: FormTextInputProps) => {
return (
<>
<label className="input input-bordered flex items-center gap-2">
{children}
<input {...props} />
</label>
<p className="text-error">{error}</p>
</>
);
};

View File

@@ -1,5 +1,6 @@
import DatePicker, { DatePickerProps, registerLocale } from "react-datepicker";
import { Control, Controller, FieldValues, Path, PathValue } from "react-hook-form";
/* eslint-disable @typescript-eslint/no-explicit-any */
import { DatePickerProps, registerLocale } from "react-datepicker";
import { Control, Controller, FieldValues, Path } from "react-hook-form";
import { de } from "date-fns/locale";
import { useState } from "react";
import { cn } from "@repo/shared-components";
@@ -44,7 +45,7 @@ export const ListInput = <T extends FieldValues>({
setValue("");
}}
type="button"
onSubmit={(e) => false}
onSubmit={() => false}
>
Hinzufügen
</button>

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
"use client";
import MDEditor from "@uiw/react-md-editor";
import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
@@ -5,7 +6,7 @@ import { cn } from "@repo/shared-components";
interface MarkdownEditorProps<T extends FieldValues> {
name: Path<T>;
form: UseFormReturn<T>;
form: UseFormReturn<any>;
formOptions?: RegisterOptions<T>;
label?: string;
placeholder?: string;

View File

@@ -1,19 +1,20 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
"use client";
import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
import SelectTemplate, { Props as SelectTemplateProps, StylesConfig } from "react-select";
import { cn } from "@repo/shared-components";
import dynamic from "next/dynamic";
import { CSSProperties } from "react";
interface SelectProps<T extends FieldValues> extends Omit<SelectTemplateProps, "form"> {
label?: any;
label?: React.ReactNode;
name: Path<T>;
form: UseFormReturn<T> | any;
form: UseFormReturn<any>;
formOptions?: RegisterOptions<T>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}
const customStyles: StylesConfig<any, false> = {
type OptionType = { label: string; value: string };
const customStyles: StylesConfig<OptionType, false> = {
control: (provided) => ({
...provided,
backgroundColor: "var(--color-base-100)",
@@ -55,7 +56,6 @@ const SelectCom = <T extends FieldValues>({
label = name,
placeholder = label,
form,
formOptions,
className,
...inputProps
}: SelectProps<T>) => {
@@ -74,7 +74,6 @@ const SelectCom = <T extends FieldValues>({
});
}
form.trigger(name);
form.Dirty;
}}
value={
(inputProps as any)?.isMulti

View File

@@ -1,10 +1,11 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { FieldValues, Path, RegisterOptions, UseFormReturn } from "react-hook-form";
import { cn } from "@repo/shared-components";
interface InputProps<T extends FieldValues>
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "form"> {
name: Path<T>;
form: UseFormReturn<T>;
form: UseFormReturn<any>;
formOptions?: RegisterOptions<T>;
label?: string;
}
@@ -13,7 +14,6 @@ export const Switch = <T extends FieldValues>({
name,
label = name,
form,
formOptions,
className,
...inputProps
}: InputProps<T>) => {
@@ -21,7 +21,12 @@ export const Switch = <T extends FieldValues>({
<div className="form-control ">
<label className="label cursor-pointer w-full">
<span className={cn("label-text text-left w-full", className)}>{label}</span>
<input type="checkbox" className={cn("toggle", className)} {...form.register(name)} />
<input
type="checkbox"
className={cn("toggle", className)}
{...form.register(name)}
{...inputProps}
/>
</label>
</div>
);

View File

@@ -1,7 +1,7 @@
import { AuthOptions, getServerSession as getNextAuthServerSession } from "next-auth";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import Credentials from "next-auth/providers/credentials";
import { DiscordAccount, prisma, User } from "@repo/db";
import { prisma } from "@repo/db";
import bcrypt from "bcryptjs";
import oldUser from "./var.User.json";
import { createNewUserFromOld, OldUser } from "../../../../types/oldUser";
@@ -70,7 +70,7 @@ export const options: AuthOptions = {
},
},
},
adapter: PrismaAdapter(prisma as any),
adapter: PrismaAdapter(prisma),
callbacks: {
jwt: async ({ token, user }) => {
if (user && "firstname" in user) {
@@ -88,6 +88,7 @@ export const options: AuthOptions = {
},
});
if (!dbUser) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return null as any;
}
return {

View File

@@ -1,7 +1,7 @@
import { prisma } from "@repo/db";
import { NextResponse } from "next/server";
export async function GET(request: Request): Promise<NextResponse> {
export async function GET(): Promise<NextResponse> {
try {
const config = await prisma.config.findFirst({
orderBy: {

View File

@@ -7,7 +7,6 @@ import "./globals.css";
import { QueryProvider } from "_components/QueryClient";
import { prisma } from "@repo/db";
import React from "react";
import { Error as ErrorComp } from "_components/Error";
import { Maintenance } from "@repo/shared-components";
const geistSans = Geist({

View File

@@ -1,4 +1,4 @@
import { nextJsConfig } from "@repo/eslint-config/next-js";
import nextJsConfig from "@repo/eslint-config/next-js";
/** @type {import("eslint").Linter.Config} */
export default nextJsConfig;

View File

@@ -19,7 +19,7 @@ export const sendMailByTemplate = async (
| "email-verification"
| "ban-notice"
| "timeban-notice",
data: any,
data: unknown,
) => {
try {
await fetch(`${process.env.NEXT_PUBLIC_HUB_SERVER_URL}/mail/template/${template}`, {

View File

@@ -25,7 +25,7 @@ export const enrollUserInCourse = async (courseid: number | string, userid: numb
);
return enrollmentResponse;
} catch (error) {
return new Error("Failed to enroll user in course");
return error;
}
};

View File

@@ -1,5 +1,5 @@
/** @type {import('next').NextConfig} */
const removeImports = require("next-remove-imports")();
/* const removeImports = require("next-remove-imports")(); */
/* const nextConfig = removeImports({}); */
const nextConfig = {};

View File

@@ -31,7 +31,6 @@
"clsx": "^2.1.1",
"daisyui": "^5.0.43",
"date-fns": "^4.1.0",
"eslint": "^9.30.0",
"eslint-config-next": "^15.3.4",
"i": "^0.3.7",
"jsonwebtoken": "^9.0.2",
@@ -52,8 +51,13 @@
"react-select": "^5.10.1",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.11",
"typescript": "^5.8.3",
"zod": "^3.25.67",
"zustand": "^5.0.6"
},
"devDependencies": {
"@eslint/js": "^9.30.0",
"eslint": "^9.30.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.33.1"
}
}

View File

@@ -1,4 +1,3 @@
import NextAuth from "next-auth";
import { User as IUser } from "@repo/db";
declare module "next-auth" {

View File

@@ -1,14 +1,8 @@
import { Prisma } from "@prisma/client";
import { JsonArray, JsonObject } from "@prisma/client/runtime/library";
/* import { JsonArray, JsonObject } from "@prisma/client/runtime/library";
declare module "@prisma/client" {
export type InputJsonValue =
| string
| number
| boolean
| null
| JsonObject
| JsonArray;
export type InputJsonValue = string | number | boolean | null | JsonObject | JsonArray;
export type JsonValue = any; // Erzwingt Flexibilität
}
*/