Enable strict lints
An attempt to fix https://github.com/vector-im/element-call/issues/1132
This commit is contained in:
@@ -15,10 +15,14 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { useObjectRef } from "@react-aria/utils";
|
||||
import { AllHTMLAttributes, ChangeEvent, useEffect } from "react";
|
||||
import { useCallback } from "react";
|
||||
import { useState } from "react";
|
||||
import { forwardRef } from "react";
|
||||
import {
|
||||
AllHTMLAttributes,
|
||||
useEffect,
|
||||
useCallback,
|
||||
useState,
|
||||
forwardRef,
|
||||
ChangeEvent,
|
||||
} from "react";
|
||||
import classNames from "classnames";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -43,7 +47,7 @@ export const AvatarInputField = forwardRef<HTMLInputElement, Props>(
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [removed, setRemoved] = useState(false);
|
||||
const [objUrl, setObjUrl] = useState<string>(null);
|
||||
const [objUrl, setObjUrl] = useState<string | undefined>(undefined);
|
||||
|
||||
const fileInputRef = useObjectRef(ref);
|
||||
|
||||
@@ -52,11 +56,11 @@ export const AvatarInputField = forwardRef<HTMLInputElement, Props>(
|
||||
|
||||
const onChange = (e: Event) => {
|
||||
const inputEvent = e as unknown as ChangeEvent<HTMLInputElement>;
|
||||
if (inputEvent.target.files.length > 0) {
|
||||
if (inputEvent.target.files && inputEvent.target.files.length > 0) {
|
||||
setObjUrl(URL.createObjectURL(inputEvent.target.files[0]));
|
||||
setRemoved(false);
|
||||
} else {
|
||||
setObjUrl(null);
|
||||
setObjUrl(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,7 +81,7 @@ export const AvatarInputField = forwardRef<HTMLInputElement, Props>(
|
||||
<div className={styles.avatarContainer}>
|
||||
<Avatar
|
||||
size={Size.XL}
|
||||
src={removed ? null : objUrl || avatarUrl}
|
||||
src={removed ? undefined : objUrl || avatarUrl}
|
||||
fallback={displayName.slice(0, 1).toUpperCase()}
|
||||
/>
|
||||
<input
|
||||
|
||||
@@ -82,7 +82,7 @@ interface InputFieldProps {
|
||||
defaultValue?: string;
|
||||
placeholder?: string;
|
||||
defaultChecked?: boolean;
|
||||
onChange?: (event: ChangeEvent) => void;
|
||||
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
||||
}
|
||||
|
||||
export const InputField = forwardRef<
|
||||
@@ -119,6 +119,8 @@ export const InputField = forwardRef<
|
||||
>
|
||||
{prefix && <span>{prefix}</span>}
|
||||
{type === "textarea" ? (
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
<textarea
|
||||
id={id}
|
||||
ref={ref as ForwardedRef<HTMLTextAreaElement>}
|
||||
|
||||
@@ -34,7 +34,7 @@ export function SelectInput(props: Props): JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const state = useSelectState(props);
|
||||
|
||||
const ref = useRef();
|
||||
const ref = useRef(null);
|
||||
const { labelProps, triggerProps, valueProps, menuProps } = useSelect(
|
||||
props,
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user