chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import type { FC } from "react";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Alert, Button, PasswordInput, Stack, TextInput } from "@mantine/core";
|
||||
import type { FC } from "react";
|
||||
import { useState } from "react";
|
||||
import { FormProvider, type Resolver, useForm } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import {
|
||||
type AuthFormValues,
|
||||
loginSchema,
|
||||
@@ -13,12 +15,12 @@ import {
|
||||
import classes from "./AuthForm.module.css";
|
||||
|
||||
type AuthFormProps = {
|
||||
register?: true;
|
||||
onSubmit: (email: string, password: string) => Promise<void>;
|
||||
register?: true;
|
||||
};
|
||||
|
||||
const AuthForm: FC<AuthFormProps> = (props) => {
|
||||
const { register, onSubmit } = props;
|
||||
const { onSubmit, register } = props;
|
||||
const { t } = useTranslation();
|
||||
const schema = register ? registerSchema : loginSchema;
|
||||
const methods = useForm<AuthFormValues>({
|
||||
@@ -27,7 +29,7 @@ const AuthForm: FC<AuthFormProps> = (props) => {
|
||||
const {
|
||||
formState: { errors, isSubmitting },
|
||||
} = methods;
|
||||
const [submitError, setSubmitError] = useState<string | null>(null);
|
||||
const [submitError, setSubmitError] = useState<null | string>(null);
|
||||
return (
|
||||
<FormProvider {...methods}>
|
||||
<form
|
||||
@@ -35,7 +37,8 @@ const AuthForm: FC<AuthFormProps> = (props) => {
|
||||
setSubmitError(null);
|
||||
try {
|
||||
await onSubmit(values.email, values.password);
|
||||
} catch {
|
||||
}
|
||||
catch {
|
||||
setSubmitError(t("auth.requestError"));
|
||||
}
|
||||
})}
|
||||
@@ -60,7 +63,7 @@ const AuthForm: FC<AuthFormProps> = (props) => {
|
||||
/>
|
||||
)}
|
||||
{submitError && <Alert color="red">{submitError}</Alert>}
|
||||
<Button type="submit" loading={isSubmitting}>
|
||||
<Button loading={isSubmitting} type="submit">
|
||||
{t(register ? "auth.register" : "auth.login")}
|
||||
</Button>
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user