Upgrade eslint-plugin-matrix-org to 1.2.1
This upgrade came with a number of new lints that needed to be fixed across the code base. Primarily: explicit return types on functions, and explicit visibility modifiers on class members.
This commit is contained in:
@@ -18,6 +18,7 @@ import { Link } from "react-router-dom";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { FC } from "react";
|
||||
|
||||
import { CopyButton } from "../button";
|
||||
import { Avatar, Size } from "../Avatar";
|
||||
@@ -31,7 +32,8 @@ interface CallListProps {
|
||||
rooms: GroupCallRoom[];
|
||||
client: MatrixClient;
|
||||
}
|
||||
export function CallList({ rooms, client }: CallListProps) {
|
||||
|
||||
export const CallList: FC<CallListProps> = ({ rooms, client }) => {
|
||||
return (
|
||||
<>
|
||||
<div className={styles.callList}>
|
||||
@@ -54,7 +56,7 @@ export function CallList({ rooms, client }: CallListProps) {
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
interface CallTileProps {
|
||||
name: string;
|
||||
avatarUrl: string;
|
||||
@@ -62,7 +64,8 @@ interface CallTileProps {
|
||||
participants: RoomMember[];
|
||||
client: MatrixClient;
|
||||
}
|
||||
function CallTile({ name, avatarUrl, room }: CallTileProps) {
|
||||
|
||||
const CallTile: FC<CallTileProps> = ({ name, avatarUrl, room }) => {
|
||||
const roomSharedKey = useRoomSharedKey(room.roomId);
|
||||
|
||||
return (
|
||||
@@ -92,4 +95,4 @@ function CallTile({ name, avatarUrl, room }: CallTileProps) {
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FC } from "react";
|
||||
|
||||
import { useClientState } from "../ClientContext";
|
||||
import { ErrorView, LoadingView } from "../FullScreenView";
|
||||
@@ -22,7 +23,7 @@ import { UnauthenticatedView } from "./UnauthenticatedView";
|
||||
import { RegisteredView } from "./RegisteredView";
|
||||
import { usePageTitle } from "../usePageTitle";
|
||||
|
||||
export function HomePage() {
|
||||
export const HomePage: FC = () => {
|
||||
const { t } = useTranslation();
|
||||
usePageTitle(t("Home"));
|
||||
|
||||
@@ -39,4 +40,4 @@ export function HomePage() {
|
||||
<UnauthenticatedView />
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ limitations under the License.
|
||||
|
||||
import { PressEvent } from "@react-types/shared";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FC } from "react";
|
||||
|
||||
import { Modal } from "../Modal";
|
||||
import { Button } from "../button";
|
||||
@@ -28,7 +29,11 @@ interface Props {
|
||||
onJoin: (e: PressEvent) => void;
|
||||
}
|
||||
|
||||
export function JoinExistingCallModal({ onJoin, open, onDismiss }: Props) {
|
||||
export const JoinExistingCallModal: FC<Props> = ({
|
||||
onJoin,
|
||||
open,
|
||||
onDismiss,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -42,4 +47,4 @@ export function JoinExistingCallModal({ onJoin, open, onDismiss }: Props) {
|
||||
</FieldRow>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { useState, useCallback, FormEvent, FormEventHandler } from "react";
|
||||
import { useState, useCallback, FormEvent, FormEventHandler, FC } from "react";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||
@@ -48,7 +48,7 @@ interface Props {
|
||||
client: MatrixClient;
|
||||
}
|
||||
|
||||
export function RegisteredView({ client }: Props) {
|
||||
export const RegisteredView: FC<Props> = ({ client }) => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<Error>();
|
||||
const [optInAnalytics] = useOptInAnalytics();
|
||||
@@ -72,7 +72,7 @@ export function RegisteredView({ client }: Props) {
|
||||
? sanitiseRoomNameInput(roomNameData)
|
||||
: "";
|
||||
|
||||
async function submit() {
|
||||
async function submit(): Promise<void> {
|
||||
setError(undefined);
|
||||
setLoading(true);
|
||||
|
||||
@@ -176,4 +176,4 @@ export function RegisteredView({ client }: Props) {
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ export const UnauthenticatedView: FC = () => {
|
||||
const roomName = sanitiseRoomNameInput(data.get("callName") as string);
|
||||
const displayName = data.get("displayName") as string;
|
||||
|
||||
async function submit() {
|
||||
async function submit(): Promise<void> {
|
||||
setError(undefined);
|
||||
setLoading(true);
|
||||
const recaptchaResponse = await execute();
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface GroupCallRoom {
|
||||
}
|
||||
const tsCache: { [index: string]: number } = {};
|
||||
|
||||
function getLastTs(client: MatrixClient, r: Room) {
|
||||
function getLastTs(client: MatrixClient, r: Room): number {
|
||||
if (tsCache[r.roomId]) {
|
||||
return tsCache[r.roomId];
|
||||
}
|
||||
@@ -82,7 +82,7 @@ export function useGroupCallRooms(client: MatrixClient): GroupCallRoom[] {
|
||||
const [rooms, setRooms] = useState<GroupCallRoom[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
function updateRooms() {
|
||||
function updateRooms(): void {
|
||||
if (!client.groupCallEventHandler) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user