Make the linter happy.

This commit is contained in:
Paul
2021-08-05 14:47:00 +01:00
parent 1be8bdfa9b
commit 872b710bc4
106 changed files with 1083 additions and 5554 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { Attachment, AttachmentMetadata } from "revolt-api/types/Autumn";
import { EmbedImage } from "revolt-api/types/January";

View File

@@ -85,11 +85,13 @@ export function ModifyAccountModal({ onClose, field }: Props) {
]}>
{/* Preact / React typing incompatabilities */}
<form
onSubmit={
onSubmit={(e) => {
e.preventDefault();
handleSubmit(
onSubmit,
) as JSX.GenericEventHandler<HTMLFormElement>
}>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
)(e as any);
}}>
{field === "email" && (
<FormField
type="email"

View File

@@ -42,6 +42,7 @@ export function UserPicker(props: Props) {
)
.map((x) => (
<UserCheckbox
key={x._id}
user={x}
checked={selected.includes(x._id)}
onChange={(v) => {

View File

@@ -20,7 +20,6 @@ import Preloader from "../../../components/ui/Preloader";
import Markdown from "../../../components/markdown/Markdown";
import {
AppContext,
ClientStatus,
StatusContext,
useClient,
@@ -30,7 +29,7 @@ import { useIntermediate } from "../Intermediate";
interface Props {
user_id: string;
dummy?: boolean;
onClose: () => void;
onClose?: () => void;
dummyProfile?: Profile;
}
@@ -60,7 +59,7 @@ export const UserProfile = observer(
const user = client.users.get(user_id);
if (!user) {
useEffect(onClose, []);
if (onClose) useEffect(onClose, []);
return null;
}
@@ -76,7 +75,7 @@ export const UserProfile = observer(
if (!user_id) return;
if (typeof profile !== "undefined") setProfile(undefined);
if (typeof mutual !== "undefined") setMutual(undefined);
}, [user_id]);
}, [user_id, mutual, profile]);
if (dummy) {
useLayoutEffect(() => {
@@ -93,7 +92,7 @@ export const UserProfile = observer(
setMutual(null);
user.fetchMutual().then(setMutual);
}
}, [mutual, status]);
}, [mutual, status, dummy, user]);
useEffect(() => {
if (dummy) return;
@@ -104,12 +103,10 @@ export const UserProfile = observer(
setProfile(null);
if (user.permission & UserPermission.ViewProfile) {
user.fetchProfile()
.then(setProfile)
.catch(() => {});
user.fetchProfile().then(setProfile);
}
}
}, [profile, status]);
}, [profile, status, dummy, user]);
const backgroundURL =
profile &&
@@ -157,7 +154,7 @@ export const UserProfile = observer(
}>
<IconButton
onClick={() => {
onClose();
onClose?.();
history.push(`/open/${user_id}`);
}}>
<Envelope size={30} />
@@ -168,7 +165,7 @@ export const UserProfile = observer(
{user.relationship === RelationshipStatus.User && (
<IconButton
onClick={() => {
onClose();
onClose?.();
if (dummy) return;
history.push(`/settings/profile`);
}}>