From 0087e37f306c20e6f5aebb659b8c62d302c7b958 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 11 Dec 2024 09:27:55 +0000 Subject: [PATCH] Enable @typescript-eslint/consistent-type-imports lint rule (#2886) * Enable @typescript-eslint/consistent-type-imports lint rule This is to help ensure that we get proper vite/rollup lazy loading by not `import`ing more than we need to. Revert "Enable @typescript-eslint/consistent-type-imports lint rule" This reverts commit ba385fa00b7e410cc508fd5fb9fe972233ae114f. Enable @typescript-eslint/consistent-type-imports lint rule This is to help ensure that we get proper vite/rollup lazy loading by not `import`ing more than we need to. . * Format --- .eslintrc.cjs | 6 ++++ src/@types/global.d.ts | 2 +- src/@types/i18next.d.ts | 2 +- src/@types/matrix-js-sdk.d.ts | 4 +-- src/App.tsx | 4 +-- src/Avatar.test.tsx | 4 +-- src/Avatar.tsx | 10 ++++-- src/ClientContext.tsx | 4 +-- src/DisconnectedBanner.tsx | 4 +-- src/FullScreenView.tsx | 2 +- src/Header.tsx | 7 +++- src/Modal.test.tsx | 2 +- src/Modal.tsx | 2 +- src/QrCode.tsx | 2 +- src/Slider.tsx | 2 +- src/Toast.tsx | 6 ++-- src/UrlParams.ts | 2 +- src/UserMenu.tsx | 2 +- src/UserMenuContainer.tsx | 2 +- src/analytics/AnalyticsNotice.tsx | 2 +- src/analytics/PosthogAnalytics.ts | 8 +++-- src/analytics/PosthogEvents.ts | 6 ++-- src/analytics/PosthogSpanProcessor.ts | 6 ++-- src/analytics/RageshakeSpanProcessor.ts | 8 ++--- src/auth/LoginPage.tsx | 2 +- src/auth/RegisterPage.tsx | 6 ++-- src/auth/useInteractiveLogin.ts | 6 ++-- src/auth/useInteractiveRegistration.ts | 6 ++-- src/button/Button.tsx | 2 +- src/button/InviteButton.tsx | 2 +- src/button/Link.tsx | 6 ++-- src/button/LinkButton.tsx | 4 +-- src/button/ReactionToggleButton.test.tsx | 2 +- src/button/ReactionToggleButton.tsx | 12 ++++--- src/config/Config.ts | 4 +-- src/e2ee/matrixKeyProvider.test.ts | 2 +- src/e2ee/matrixKeyProvider.ts | 2 +- src/e2ee/sharedKeyManagement.ts | 2 +- src/form/Form.tsx | 2 +- src/grid/CallLayout.ts | 8 ++--- src/grid/Grid.tsx | 24 ++++++------- src/grid/GridLayout.tsx | 8 ++--- src/grid/OneOnOneLayout.tsx | 6 ++-- src/grid/SpotlightExpandedLayout.tsx | 6 ++-- src/grid/SpotlightLandscapeLayout.tsx | 4 +-- src/grid/SpotlightPortraitLayout.tsx | 6 ++-- src/grid/TileWrapper.tsx | 8 ++--- src/home/CallList.test.tsx | 6 ++-- src/home/CallList.tsx | 10 +++--- src/home/HomePage.tsx | 2 +- src/home/JoinExistingCallModal.tsx | 2 +- src/home/RegisteredView.tsx | 10 ++++-- src/home/UnauthenticatedView.tsx | 2 +- src/home/useGroupCallRooms.ts | 8 ++--- src/input/AvatarInputField.tsx | 6 ++-- src/input/Input.tsx | 8 ++--- src/livekit/MediaDevicesContext.tsx | 6 ++-- src/livekit/openIDSFU.ts | 6 ++-- src/livekit/options.ts | 6 ++-- src/livekit/useECConnectionState.ts | 8 ++--- src/livekit/useLiveKit.ts | 18 +++++----- src/otel/OTelCall.ts | 10 +++--- src/otel/OTelCallAbstractMediaStreamSpan.ts | 6 ++-- src/otel/OTelCallFeedMediaStreamSpan.ts | 8 ++--- src/otel/OTelCallMediaStreamTrackSpan.ts | 6 ++-- .../OTelCallTransceiverMediaStreamSpan.ts | 8 ++--- src/otel/OTelGroupCallMembership.ts | 36 ++++++++++--------- src/otel/ObjectFlattener.test.ts | 8 ++--- src/otel/ObjectFlattener.ts | 12 +++---- src/otel/otel.ts | 2 +- src/profile/useProfile.ts | 8 ++--- src/reactions/RaisedHandIndicator.tsx | 4 +-- src/reactions/ReactionIndicator.tsx | 2 +- src/reactions/index.ts | 2 +- src/room/AppSelectionModal.tsx | 8 ++++- src/room/CallEndedView.tsx | 10 ++++-- src/room/CallEventAudioRenderer.test.tsx | 10 +++--- src/room/CallEventAudioRenderer.tsx | 4 +-- src/room/EncryptionLock.tsx | 2 +- src/room/GroupCallView.tsx | 24 +++++++++---- src/room/InCallView.tsx | 36 ++++++++++--------- src/room/InviteModal.test.tsx | 2 +- src/room/InviteModal.tsx | 10 ++++-- src/room/LayoutToggle.tsx | 2 +- src/room/LobbyView.tsx | 10 +++--- src/room/MuteStates.test.tsx | 6 ++-- src/room/MuteStates.ts | 11 +++--- src/room/RageshakeRequestModal.tsx | 4 +-- src/room/ReactionAudioRenderer.test.tsx | 6 ++-- src/room/ReactionAudioRenderer.tsx | 2 +- src/room/ReactionsOverlay.test.tsx | 2 +- src/room/ReactionsOverlay.tsx | 2 +- src/room/RoomAuthView.tsx | 2 +- src/room/RoomPage.tsx | 4 +-- src/room/VideoPreview.tsx | 8 ++--- src/room/checkForParallelCalls.test.ts | 4 +-- src/room/checkForParallelCalls.ts | 2 +- src/room/useActiveFocus.ts | 4 +-- src/room/useJoinRule.ts | 2 +- src/room/useLoadGroupCall.ts | 8 ++--- src/room/useRoomAvatar.ts | 2 +- src/room/useRoomName.ts | 2 +- src/room/useRoomState.ts | 5 ++- src/room/useSwitchCamera.ts | 4 +-- src/rtcSessionHelper.test.ts | 2 +- src/rtcSessionHelpers.ts | 8 ++--- src/settings/DeviceSelection.tsx | 4 +-- src/settings/FeedbackSettingsTab.tsx | 2 +- src/settings/PreferencesSettingsTab.tsx | 2 +- src/settings/ProfileSettingsTab.tsx | 4 +-- src/settings/RageshakeButton.tsx | 2 +- src/settings/SettingsModal.tsx | 6 ++-- src/settings/rageshake.ts | 6 ++-- src/settings/settings.ts | 2 +- src/settings/submit-rageshake.ts | 10 +++--- src/state/CallViewModel.test.ts | 19 +++++----- src/state/CallViewModel.ts | 28 +++++++++------ src/state/GridLikeLayout.ts | 6 ++-- src/state/MediaViewModel.ts | 20 +++++------ src/state/ObservableScope.ts | 2 +- src/state/OneOnOneLayout.ts | 6 ++-- src/state/PipLayout.ts | 6 ++-- src/state/SpotlightExpandedLayout.ts | 8 ++--- src/state/TileStore.ts | 2 +- src/state/TileViewModel.ts | 4 +-- src/state/observeSpeaker.ts | 2 +- src/tabs/Tabs.tsx | 2 +- src/tile/GridTile.test.tsx | 4 +-- src/tile/GridTile.tsx | 14 ++++---- src/tile/MediaView.test.tsx | 4 +-- src/tile/MediaView.tsx | 10 +++--- src/tile/SpotlightTile.tsx | 18 +++++----- src/useAudioContext.test.tsx | 2 +- src/useAudioContext.tsx | 2 +- src/useCallViewKeyboardShortcuts.test.tsx | 8 +++-- src/useCallViewKeyboardShortcuts.ts | 8 +++-- src/useLatest.ts | 2 +- src/useMatrixRTCSessionJoinState.ts | 2 +- src/useMatrixRTCSessionMemberships.ts | 4 +-- src/useMergedRefs.ts | 2 +- src/useReactions.test.tsx | 2 +- src/useReactions.tsx | 12 +++---- src/useReactiveState.ts | 6 ++-- src/useTheme.test.ts | 2 +- src/utils/matrix.ts | 9 +++-- src/utils/observable.ts | 2 +- src/utils/spa.ts | 2 +- src/utils/test.ts | 31 ++++++++-------- src/utils/testReactions.tsx | 12 +++---- 149 files changed, 523 insertions(+), 425 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 31dccb6a..db5f3fd9 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -37,6 +37,12 @@ module.exports = { "@typescript-eslint/promise-function-async": "error", "@typescript-eslint/require-await": "error", "@typescript-eslint/await-thenable": "error", + // To help ensure that we get proper vite/rollup lazy loading (e.g. for matrix-js-sdk): + "@typescript-eslint/consistent-type-imports": [ + "error", + { fixStyle: "inline-type-imports" }, + ], + // To encourage good usage of RxJS: "rxjs/no-exposed-subjects": "error", }, settings: { diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 94a4e379..398ca4af 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import "matrix-js-sdk/src/@types/global"; import type { DurationFormat as PolyfillDurationFormat } from "@formatjs/intl-durationformat"; -import { Controls } from "../controls"; +import { type Controls } from "../controls"; declare global { interface Document { diff --git a/src/@types/i18next.d.ts b/src/@types/i18next.d.ts index 3c65e620..13210b0b 100644 --- a/src/@types/i18next.d.ts +++ b/src/@types/i18next.d.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import "i18next"; // import all namespaces (for the default language, only) -import app from "../../locales/en/app.json"; +import type app from "../../locales/en/app.json"; declare module "i18next" { interface CustomTypeOptions { diff --git a/src/@types/matrix-js-sdk.d.ts b/src/@types/matrix-js-sdk.d.ts index dc27b1ef..3ac7ef66 100644 --- a/src/@types/matrix-js-sdk.d.ts +++ b/src/@types/matrix-js-sdk.d.ts @@ -6,8 +6,8 @@ Please see LICENSE in the repository root for full details. */ import { - ElementCallReactionEventType, - ECallReactionEventContent, + type ElementCallReactionEventType, + type ECallReactionEventContent, } from "../reactions"; // Extend Matrix JS SDK types via Typescript declaration merging to support unspecced event fields and types diff --git a/src/App.tsx b/src/App.tsx index 8d841dba..288d4c9d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, Suspense, useEffect, useState } from "react"; +import { type FC, Suspense, useEffect, useState } from "react"; import { BrowserRouter as Router, Switch, @@ -13,7 +13,7 @@ import { useLocation, } from "react-router-dom"; import * as Sentry from "@sentry/react"; -import { History } from "history"; +import { type History } from "history"; import { TooltipProvider } from "@vector-im/compound-web"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/Avatar.test.tsx b/src/Avatar.test.tsx index 7eee2e90..1f3ddb04 100644 --- a/src/Avatar.test.tsx +++ b/src/Avatar.test.tsx @@ -7,8 +7,8 @@ Please see LICENSE in the repository root for full details. import { afterEach, expect, test, vi } from "vitest"; import { render, screen } from "@testing-library/react"; -import { MatrixClient } from "matrix-js-sdk/src/client"; -import { FC, PropsWithChildren } from "react"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; +import { type FC, type PropsWithChildren } from "react"; import { ClientContextProvider } from "./ClientContext"; import { Avatar } from "./Avatar"; diff --git a/src/Avatar.tsx b/src/Avatar.tsx index f3fe6cd8..dcdead7a 100644 --- a/src/Avatar.tsx +++ b/src/Avatar.tsx @@ -5,9 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { useMemo, FC, CSSProperties, useState, useEffect } from "react"; +import { + useMemo, + type FC, + type CSSProperties, + useState, + useEffect, +} from "react"; import { Avatar as CompoundAvatar } from "@vector-im/compound-web"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { useClientState } from "./ClientContext"; diff --git a/src/ClientContext.tsx b/src/ClientContext.tsx index 7a37e750..400784b5 100644 --- a/src/ClientContext.tsx +++ b/src/ClientContext.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { - FC, + type FC, useCallback, useEffect, useState, @@ -18,7 +18,7 @@ import { import { useHistory } from "react-router-dom"; import { logger } from "matrix-js-sdk/src/logger"; import { useTranslation } from "react-i18next"; -import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync"; +import { type ISyncStateData, type SyncState } from "matrix-js-sdk/src/sync"; import { ClientEvent, type MatrixClient } from "matrix-js-sdk/src/client"; import type { WidgetApi } from "matrix-widget-api"; diff --git a/src/DisconnectedBanner.tsx b/src/DisconnectedBanner.tsx index e317a5be..2fdb7b70 100644 --- a/src/DisconnectedBanner.tsx +++ b/src/DisconnectedBanner.tsx @@ -6,11 +6,11 @@ Please see LICENSE in the repository root for full details. */ import classNames from "classnames"; -import { FC, HTMLAttributes, ReactNode } from "react"; +import { type FC, type HTMLAttributes, type ReactNode } from "react"; import { useTranslation } from "react-i18next"; import styles from "./DisconnectedBanner.module.css"; -import { ValidClientState, useClientState } from "./ClientContext"; +import { type ValidClientState, useClientState } from "./ClientContext"; interface Props extends HTMLAttributes { children?: ReactNode; diff --git a/src/FullScreenView.tsx b/src/FullScreenView.tsx index ad66a3b8..e88f45de 100644 --- a/src/FullScreenView.tsx +++ b/src/FullScreenView.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, ReactNode, useCallback, useEffect } from "react"; +import { type FC, type ReactNode, useCallback, useEffect } from "react"; import { useLocation } from "react-router-dom"; import classNames from "classnames"; import { Trans, useTranslation } from "react-i18next"; diff --git a/src/Header.tsx b/src/Header.tsx index 69e77935..a4eb8fff 100644 --- a/src/Header.tsx +++ b/src/Header.tsx @@ -6,7 +6,12 @@ Please see LICENSE in the repository root for full details. */ import classNames from "classnames"; -import { FC, HTMLAttributes, ReactNode, forwardRef } from "react"; +import { + type FC, + type HTMLAttributes, + type ReactNode, + forwardRef, +} from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Heading, Text } from "@vector-im/compound-web"; diff --git a/src/Modal.test.tsx b/src/Modal.test.tsx index 41bd7bbe..bb6fb0f7 100644 --- a/src/Modal.test.tsx +++ b/src/Modal.test.tsx @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { expect, test } from "vitest"; import { render } from "@testing-library/react"; -import { ReactNode, useState } from "react"; +import { type ReactNode, useState } from "react"; import { afterEach } from "node:test"; import userEvent from "@testing-library/user-event"; diff --git a/src/Modal.tsx b/src/Modal.tsx index 63d5c50a..14b6b68d 100644 --- a/src/Modal.tsx +++ b/src/Modal.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, ReactNode, useCallback } from "react"; +import { type FC, type ReactNode, useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Root as DialogRoot, diff --git a/src/QrCode.tsx b/src/QrCode.tsx index 8ad246e9..60946d70 100644 --- a/src/QrCode.tsx +++ b/src/QrCode.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useEffect, useState } from "react"; +import { type FC, useEffect, useState } from "react"; import { toDataURL } from "qrcode"; import classNames from "classnames"; import { t } from "i18next"; diff --git a/src/Slider.tsx b/src/Slider.tsx index e398fba1..86141598 100644 --- a/src/Slider.tsx +++ b/src/Slider.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback } from "react"; +import { type FC, useCallback } from "react"; import { Root, Track, Range, Thumb } from "@radix-ui/react-slider"; import classNames from "classnames"; import { Tooltip } from "@vector-im/compound-web"; diff --git a/src/Toast.tsx b/src/Toast.tsx index 5b463f31..f16cfc04 100644 --- a/src/Toast.tsx +++ b/src/Toast.tsx @@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details. */ import { - ComponentType, - FC, - SVGAttributes, + type ComponentType, + type FC, + type SVGAttributes, useCallback, useEffect, } from "react"; diff --git a/src/UrlParams.ts b/src/UrlParams.ts index 216e5b35..e0aae237 100644 --- a/src/UrlParams.ts +++ b/src/UrlParams.ts @@ -10,7 +10,7 @@ import { useLocation } from "react-router-dom"; import { logger } from "matrix-js-sdk/src/logger"; import { Config } from "./config/Config"; -import { EncryptionSystem } from "./e2ee/sharedKeyManagement"; +import { type EncryptionSystem } from "./e2ee/sharedKeyManagement"; import { E2eeType } from "./e2ee/e2eeType"; interface RoomIdentifier { diff --git a/src/UserMenu.tsx b/src/UserMenu.tsx index 906f220f..0cb9868b 100644 --- a/src/UserMenu.tsx +++ b/src/UserMenu.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useMemo, useState } from "react"; +import { type FC, useMemo, useState } from "react"; import { useLocation } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Menu, MenuItem } from "@vector-im/compound-web"; diff --git a/src/UserMenuContainer.tsx b/src/UserMenuContainer.tsx index e73f2780..2695552d 100644 --- a/src/UserMenuContainer.tsx +++ b/src/UserMenuContainer.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useState } from "react"; +import { type FC, useCallback, useState } from "react"; import { useHistory, useLocation } from "react-router-dom"; import { useClientLegacy } from "./ClientContext"; diff --git a/src/analytics/AnalyticsNotice.tsx b/src/analytics/AnalyticsNotice.tsx index 9ba78f0d..9725d596 100644 --- a/src/analytics/AnalyticsNotice.tsx +++ b/src/analytics/AnalyticsNotice.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC } from "react"; +import { type FC } from "react"; import { Trans } from "react-i18next"; import { ExternalLink } from "../button/Link"; diff --git a/src/analytics/PosthogAnalytics.ts b/src/analytics/PosthogAnalytics.ts index 0df0ee32..5124e711 100644 --- a/src/analytics/PosthogAnalytics.ts +++ b/src/analytics/PosthogAnalytics.ts @@ -5,9 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import posthog, { CaptureOptions, PostHog, Properties } from "posthog-js"; +import posthog, { + type CaptureOptions, + type PostHog, + type Properties, +} from "posthog-js"; import { logger } from "matrix-js-sdk/src/logger"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { Buffer } from "buffer"; import { widget } from "../widget"; diff --git a/src/analytics/PosthogEvents.ts b/src/analytics/PosthogEvents.ts index ca086dc2..2e5744d2 100644 --- a/src/analytics/PosthogEvents.ts +++ b/src/analytics/PosthogEvents.ts @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { DisconnectReason } from "livekit-client"; +import { type DisconnectReason } from "livekit-client"; import { logger } from "matrix-js-sdk/src/logger"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import { - IPosthogEvent, + type IPosthogEvent, PosthogAnalytics, RegistrationType, } from "./PosthogAnalytics"; diff --git a/src/analytics/PosthogSpanProcessor.ts b/src/analytics/PosthogSpanProcessor.ts index 102de159..c03fcab9 100644 --- a/src/analytics/PosthogSpanProcessor.ts +++ b/src/analytics/PosthogSpanProcessor.ts @@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details. */ import { - SpanProcessor, - ReadableSpan, - Span, + type SpanProcessor, + type ReadableSpan, + type Span, } from "@opentelemetry/sdk-trace-base"; import { hrTimeToMilliseconds } from "@opentelemetry/core"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/analytics/RageshakeSpanProcessor.ts b/src/analytics/RageshakeSpanProcessor.ts index ee547e29..df42641e 100644 --- a/src/analytics/RageshakeSpanProcessor.ts +++ b/src/analytics/RageshakeSpanProcessor.ts @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { AttributeValue, Attributes } from "@opentelemetry/api"; +import { type AttributeValue, type Attributes } from "@opentelemetry/api"; import { hrTimeToMicroseconds } from "@opentelemetry/core"; import { - SpanProcessor, - ReadableSpan, - Span, + type SpanProcessor, + type ReadableSpan, + type Span, } from "@opentelemetry/sdk-trace-base"; const dumpAttributes = ( diff --git a/src/auth/LoginPage.tsx b/src/auth/LoginPage.tsx index e4aede09..11b831cd 100644 --- a/src/auth/LoginPage.tsx +++ b/src/auth/LoginPage.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, FormEvent, useCallback, useRef, useState } from "react"; +import { type FC, type FormEvent, useCallback, useRef, useState } from "react"; import { useHistory, useLocation } from "react-router-dom"; import { Trans, useTranslation } from "react-i18next"; import { Button } from "@vector-im/compound-web"; diff --git a/src/auth/RegisterPage.tsx b/src/auth/RegisterPage.tsx index 392f8a7a..b12ff2ca 100644 --- a/src/auth/RegisterPage.tsx +++ b/src/auth/RegisterPage.tsx @@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details. */ import { - ChangeEvent, - FC, - FormEvent, + type ChangeEvent, + type FC, + type FormEvent, useCallback, useEffect, useRef, diff --git a/src/auth/useInteractiveLogin.ts b/src/auth/useInteractiveLogin.ts index 2bd15acb..8a70dee2 100644 --- a/src/auth/useInteractiveLogin.ts +++ b/src/auth/useInteractiveLogin.ts @@ -9,12 +9,12 @@ import { useCallback } from "react"; import { InteractiveAuth } from "matrix-js-sdk/src/interactive-auth"; import { createClient, - LoginResponse, - MatrixClient, + type LoginResponse, + type MatrixClient, } from "matrix-js-sdk/src/matrix"; import { initClient } from "../utils/matrix"; -import { Session } from "../ClientContext"; +import { type Session } from "../ClientContext"; /** * This provides the login method to login using user credentials. * @param oldClient If there is an already authenticated client it should be passed to this hook diff --git a/src/auth/useInteractiveRegistration.ts b/src/auth/useInteractiveRegistration.ts index 2c272cb1..d6568ede 100644 --- a/src/auth/useInteractiveRegistration.ts +++ b/src/auth/useInteractiveRegistration.ts @@ -9,13 +9,13 @@ import { useState, useEffect, useCallback, useRef } from "react"; import { InteractiveAuth } from "matrix-js-sdk/src/interactive-auth"; import { createClient, - MatrixClient, - RegisterResponse, + type MatrixClient, + type RegisterResponse, } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { initClient } from "../utils/matrix"; -import { Session } from "../ClientContext"; +import { type Session } from "../ClientContext"; import { Config } from "../config/Config"; import { widget } from "../widget"; diff --git a/src/button/Button.tsx b/src/button/Button.tsx index 5c85ddbf..c4fb2db7 100644 --- a/src/button/Button.tsx +++ b/src/button/Button.tsx @@ -4,7 +4,7 @@ Copyright 2022-2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ComponentPropsWithoutRef, FC } from "react"; +import { type ComponentPropsWithoutRef, type FC } from "react"; import classNames from "classnames"; import { useTranslation } from "react-i18next"; import { Button as CpdButton, Tooltip } from "@vector-im/compound-web"; diff --git a/src/button/InviteButton.tsx b/src/button/InviteButton.tsx index 874c1046..bbd023f5 100644 --- a/src/button/InviteButton.tsx +++ b/src/button/InviteButton.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ComponentPropsWithoutRef, FC } from "react"; +import { type ComponentPropsWithoutRef, type FC } from "react"; import { Button } from "@vector-im/compound-web"; import { useTranslation } from "react-i18next"; import { UserAddIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; diff --git a/src/button/Link.tsx b/src/button/Link.tsx index 68c4dd13..829cbdc8 100644 --- a/src/button/Link.tsx +++ b/src/button/Link.tsx @@ -6,15 +6,15 @@ Please see LICENSE in the repository root for full details. */ import { - ComponentPropsWithoutRef, + type ComponentPropsWithoutRef, forwardRef, - MouseEvent, + type MouseEvent, useCallback, useMemo, } from "react"; import { Link as CpdLink } from "@vector-im/compound-web"; import { useHistory } from "react-router-dom"; -import { createPath, LocationDescriptor, Path } from "history"; +import { createPath, type LocationDescriptor, type Path } from "history"; import classNames from "classnames"; import { useLatest } from "../useLatest"; diff --git a/src/button/LinkButton.tsx b/src/button/LinkButton.tsx index 5e231a49..b0e733b0 100644 --- a/src/button/LinkButton.tsx +++ b/src/button/LinkButton.tsx @@ -5,9 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ComponentPropsWithoutRef, forwardRef } from "react"; +import { type ComponentPropsWithoutRef, forwardRef } from "react"; import { Button } from "@vector-im/compound-web"; -import { LocationDescriptor } from "history"; +import { type LocationDescriptor } from "history"; import { useLink } from "./Link"; diff --git a/src/button/ReactionToggleButton.test.tsx b/src/button/ReactionToggleButton.test.tsx index a1498304..72437825 100644 --- a/src/button/ReactionToggleButton.test.tsx +++ b/src/button/ReactionToggleButton.test.tsx @@ -9,7 +9,7 @@ import { render } from "@testing-library/react"; import { expect, test } from "vitest"; import { TooltipProvider } from "@vector-im/compound-web"; import { userEvent } from "@testing-library/user-event"; -import { ReactNode } from "react"; +import { type ReactNode } from "react"; import { MockRoom, diff --git a/src/button/ReactionToggleButton.tsx b/src/button/ReactionToggleButton.tsx index b1d6ec3e..7f231d30 100644 --- a/src/button/ReactionToggleButton.tsx +++ b/src/button/ReactionToggleButton.tsx @@ -13,9 +13,9 @@ import { ReactionSolidIcon, } from "@vector-im/compound-design-tokens/assets/web/icons"; import { - ComponentPropsWithoutRef, - FC, - ReactNode, + type ComponentPropsWithoutRef, + type FC, + type ReactNode, useCallback, useEffect, useMemo, @@ -27,7 +27,11 @@ import classNames from "classnames"; import { useReactions } from "../useReactions"; import styles from "./ReactionToggleButton.module.css"; -import { ReactionOption, ReactionSet, ReactionsRowSize } from "../reactions"; +import { + type ReactionOption, + ReactionSet, + ReactionsRowSize, +} from "../reactions"; import { Modal } from "../Modal"; interface InnerButtonProps extends ComponentPropsWithoutRef<"button"> { diff --git a/src/config/Config.ts b/src/config/Config.ts index e3c43bf1..27a8cb7f 100644 --- a/src/config/Config.ts +++ b/src/config/Config.ts @@ -10,8 +10,8 @@ import { merge } from "lodash-es"; import { getUrlParams } from "../UrlParams"; import { DEFAULT_CONFIG, - ConfigOptions, - ResolvedConfigOptions, + type ConfigOptions, + type ResolvedConfigOptions, } from "./ConfigOptions"; export class Config { diff --git a/src/e2ee/matrixKeyProvider.test.ts b/src/e2ee/matrixKeyProvider.test.ts index e5b4015f..df4c6009 100644 --- a/src/e2ee/matrixKeyProvider.test.ts +++ b/src/e2ee/matrixKeyProvider.test.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { describe, expect, test, vi } from "vitest"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc"; import { KeyProviderEvent } from "livekit-client"; diff --git a/src/e2ee/matrixKeyProvider.ts b/src/e2ee/matrixKeyProvider.ts index 6cbecd19..2d269bae 100644 --- a/src/e2ee/matrixKeyProvider.ts +++ b/src/e2ee/matrixKeyProvider.ts @@ -8,7 +8,7 @@ Please see LICENSE in the repository root for full details. import { BaseKeyProvider, createKeyMaterialFromBuffer } from "livekit-client"; import { logger } from "matrix-js-sdk/src/logger"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; diff --git a/src/e2ee/sharedKeyManagement.ts b/src/e2ee/sharedKeyManagement.ts index 2b67ec4a..7936de8b 100644 --- a/src/e2ee/sharedKeyManagement.ts +++ b/src/e2ee/sharedKeyManagement.ts @@ -8,7 +8,7 @@ Please see LICENSE in the repository root for full details. import { useEffect, useMemo } from "react"; import { setLocalStorageItem, useLocalStorage } from "../useLocalStorage"; -import { UrlParams, getUrlParams, useUrlParams } from "../UrlParams"; +import { type UrlParams, getUrlParams, useUrlParams } from "../UrlParams"; import { E2eeType } from "./e2eeType"; import { useClient } from "../ClientContext"; diff --git a/src/form/Form.tsx b/src/form/Form.tsx index 03291b79..49cd1b65 100644 --- a/src/form/Form.tsx +++ b/src/form/Form.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import classNames from "classnames"; -import { FormEventHandler, forwardRef, ReactNode } from "react"; +import { type FormEventHandler, forwardRef, type ReactNode } from "react"; import styles from "./Form.module.css"; diff --git a/src/grid/CallLayout.ts b/src/grid/CallLayout.ts index 895af23f..e05cd025 100644 --- a/src/grid/CallLayout.ts +++ b/src/grid/CallLayout.ts @@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { BehaviorSubject, Observable } from "rxjs"; -import { ComponentType } from "react"; +import { type BehaviorSubject, type Observable } from "rxjs"; +import { type ComponentType } from "react"; -import { LayoutProps } from "./Grid"; -import { TileViewModel } from "../state/TileViewModel"; +import { type LayoutProps } from "./Grid"; +import { type TileViewModel } from "../state/TileViewModel"; export interface Bounds { width: number; diff --git a/src/grid/Grid.tsx b/src/grid/Grid.tsx index 2983357b..411d9d08 100644 --- a/src/grid/Grid.tsx +++ b/src/grid/Grid.tsx @@ -6,21 +6,21 @@ Please see LICENSE in the repository root for full details. */ import { - SpringRef, - TransitionFn, - animated, + type SpringRef, + type TransitionFn, + type animated, useTransition, } from "@react-spring/web"; -import { EventTypes, Handler, useScroll } from "@use-gesture/react"; +import { type EventTypes, type Handler, useScroll } from "@use-gesture/react"; import { - CSSProperties, - ComponentProps, - ComponentType, - Dispatch, - FC, - LegacyRef, - ReactNode, - SetStateAction, + type CSSProperties, + type ComponentProps, + type ComponentType, + type Dispatch, + type FC, + type LegacyRef, + type ReactNode, + type SetStateAction, createContext, forwardRef, memo, diff --git a/src/grid/GridLayout.tsx b/src/grid/GridLayout.tsx index 3dc3bef1..45aecd85 100644 --- a/src/grid/GridLayout.tsx +++ b/src/grid/GridLayout.tsx @@ -5,15 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { CSSProperties, forwardRef, useCallback, useMemo } from "react"; +import { type CSSProperties, forwardRef, useCallback, useMemo } from "react"; import { distinctUntilChanged } from "rxjs"; import { useObservableEagerState } from "observable-hooks"; -import { GridLayout as GridLayoutModel } from "../state/CallViewModel"; +import { type GridLayout as GridLayoutModel } from "../state/CallViewModel"; import styles from "./GridLayout.module.css"; import { useInitial } from "../useInitial"; -import { CallLayout, arrangeTiles } from "./CallLayout"; -import { DragCallback, useUpdateLayout } from "./Grid"; +import { type CallLayout, arrangeTiles } from "./CallLayout"; +import { type DragCallback, useUpdateLayout } from "./Grid"; interface GridCSSProperties extends CSSProperties { "--gap": string; diff --git a/src/grid/OneOnOneLayout.tsx b/src/grid/OneOnOneLayout.tsx index 03ff5b32..e841a686 100644 --- a/src/grid/OneOnOneLayout.tsx +++ b/src/grid/OneOnOneLayout.tsx @@ -9,10 +9,10 @@ import { forwardRef, useCallback, useMemo } from "react"; import { useObservableEagerState } from "observable-hooks"; import classNames from "classnames"; -import { OneOnOneLayout as OneOnOneLayoutModel } from "../state/CallViewModel"; -import { CallLayout, arrangeTiles } from "./CallLayout"; +import { type OneOnOneLayout as OneOnOneLayoutModel } from "../state/CallViewModel"; +import { type CallLayout, arrangeTiles } from "./CallLayout"; import styles from "./OneOnOneLayout.module.css"; -import { DragCallback, useUpdateLayout } from "./Grid"; +import { type DragCallback, useUpdateLayout } from "./Grid"; /** * An implementation of the "one-on-one" layout, in which the remote participant diff --git a/src/grid/SpotlightExpandedLayout.tsx b/src/grid/SpotlightExpandedLayout.tsx index 08495036..371930ce 100644 --- a/src/grid/SpotlightExpandedLayout.tsx +++ b/src/grid/SpotlightExpandedLayout.tsx @@ -8,9 +8,9 @@ Please see LICENSE in the repository root for full details. import { forwardRef, useCallback } from "react"; import { useObservableEagerState } from "observable-hooks"; -import { SpotlightExpandedLayout as SpotlightExpandedLayoutModel } from "../state/CallViewModel"; -import { CallLayout } from "./CallLayout"; -import { DragCallback, useUpdateLayout } from "./Grid"; +import { type SpotlightExpandedLayout as SpotlightExpandedLayoutModel } from "../state/CallViewModel"; +import { type CallLayout } from "./CallLayout"; +import { type DragCallback, useUpdateLayout } from "./Grid"; import styles from "./SpotlightExpandedLayout.module.css"; /** diff --git a/src/grid/SpotlightLandscapeLayout.tsx b/src/grid/SpotlightLandscapeLayout.tsx index b9e6b289..8596aec8 100644 --- a/src/grid/SpotlightLandscapeLayout.tsx +++ b/src/grid/SpotlightLandscapeLayout.tsx @@ -9,8 +9,8 @@ import { forwardRef } from "react"; import { useObservableEagerState } from "observable-hooks"; import classNames from "classnames"; -import { CallLayout } from "./CallLayout"; -import { SpotlightLandscapeLayout as SpotlightLandscapeLayoutModel } from "../state/CallViewModel"; +import { type CallLayout } from "./CallLayout"; +import { type SpotlightLandscapeLayout as SpotlightLandscapeLayoutModel } from "../state/CallViewModel"; import styles from "./SpotlightLandscapeLayout.module.css"; import { useUpdateLayout } from "./Grid"; diff --git a/src/grid/SpotlightPortraitLayout.tsx b/src/grid/SpotlightPortraitLayout.tsx index e617160e..beeca3e6 100644 --- a/src/grid/SpotlightPortraitLayout.tsx +++ b/src/grid/SpotlightPortraitLayout.tsx @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { CSSProperties, forwardRef } from "react"; +import { type CSSProperties, forwardRef } from "react"; import { useObservableEagerState } from "observable-hooks"; import classNames from "classnames"; -import { CallLayout, arrangeTiles } from "./CallLayout"; -import { SpotlightPortraitLayout as SpotlightPortraitLayoutModel } from "../state/CallViewModel"; +import { type CallLayout, arrangeTiles } from "./CallLayout"; +import { type SpotlightPortraitLayout as SpotlightPortraitLayoutModel } from "../state/CallViewModel"; import styles from "./SpotlightPortraitLayout.module.css"; import { useUpdateLayout } from "./Grid"; diff --git a/src/grid/TileWrapper.tsx b/src/grid/TileWrapper.tsx index aeb581fe..a2eebd43 100644 --- a/src/grid/TileWrapper.tsx +++ b/src/grid/TileWrapper.tsx @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ComponentType, memo, RefObject, useRef } from "react"; -import { EventTypes, Handler, useDrag } from "@use-gesture/react"; -import { SpringValue } from "@react-spring/web"; +import { type ComponentType, memo, type RefObject, useRef } from "react"; +import { type EventTypes, type Handler, useDrag } from "@use-gesture/react"; +import { type SpringValue } from "@react-spring/web"; import classNames from "classnames"; -import { TileProps } from "./Grid"; +import { type TileProps } from "./Grid"; import styles from "./TileWrapper.module.css"; interface Props { diff --git a/src/home/CallList.test.tsx b/src/home/CallList.test.tsx index cd9e38d1..5e5a3439 100644 --- a/src/home/CallList.test.tsx +++ b/src/home/CallList.test.tsx @@ -5,13 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { render, RenderResult } from "@testing-library/react"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { render, type RenderResult } from "@testing-library/react"; +import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { MemoryRouter } from "react-router-dom"; import { describe, expect, it } from "vitest"; import { CallList } from "../../src/home/CallList"; -import { GroupCallRoom } from "../../src/home/useGroupCallRooms"; +import { type GroupCallRoom } from "../../src/home/useGroupCallRooms"; describe("CallList", () => { const renderComponent = (rooms: GroupCallRoom[]): RenderResult => { diff --git a/src/home/CallList.tsx b/src/home/CallList.tsx index 72b7356a..12bfae45 100644 --- a/src/home/CallList.tsx +++ b/src/home/CallList.tsx @@ -6,10 +6,10 @@ Please see LICENSE in the repository root for full details. */ 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, useCallback, MouseEvent, useState } from "react"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; +import { type RoomMember } from "matrix-js-sdk/src/models/room-member"; +import { type Room } from "matrix-js-sdk/src/models/room"; +import { type FC, useCallback, type MouseEvent, useState } from "react"; import { useTranslation } from "react-i18next"; import { IconButton, Text } from "@vector-im/compound-web"; import { CloseIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; @@ -18,7 +18,7 @@ import classNames from "classnames"; import { Avatar, Size } from "../Avatar"; import styles from "./CallList.module.css"; import { getRelativeRoomUrl } from "../utils/matrix"; -import { GroupCallRoom } from "./useGroupCallRooms"; +import { type GroupCallRoom } from "./useGroupCallRooms"; import { useRoomEncryptionSystem } from "../e2ee/sharedKeyManagement"; interface CallListProps { diff --git a/src/home/HomePage.tsx b/src/home/HomePage.tsx index 74575494..9340ecc0 100644 --- a/src/home/HomePage.tsx +++ b/src/home/HomePage.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { useTranslation } from "react-i18next"; -import { FC } from "react"; +import { type FC } from "react"; import { useClientState } from "../ClientContext"; import { ErrorView, LoadingView } from "../FullScreenView"; diff --git a/src/home/JoinExistingCallModal.tsx b/src/home/JoinExistingCallModal.tsx index 6de3d2a9..3f2c3902 100644 --- a/src/home/JoinExistingCallModal.tsx +++ b/src/home/JoinExistingCallModal.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { useTranslation } from "react-i18next"; -import { FC, MouseEvent } from "react"; +import { type FC, type MouseEvent } from "react"; import { Button } from "@vector-im/compound-web"; import { Modal } from "../Modal"; diff --git a/src/home/RegisteredView.tsx b/src/home/RegisteredView.tsx index db242414..7a44ebb6 100644 --- a/src/home/RegisteredView.tsx +++ b/src/home/RegisteredView.tsx @@ -5,9 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { useState, useCallback, FormEvent, FormEventHandler, FC } from "react"; +import { + useState, + useCallback, + type FormEvent, + type FormEventHandler, + type FC, +} from "react"; import { useHistory } from "react-router-dom"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { useTranslation } from "react-i18next"; import { Heading, Text } from "@vector-im/compound-web"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/home/UnauthenticatedView.tsx b/src/home/UnauthenticatedView.tsx index daafa9f8..0e9be675 100644 --- a/src/home/UnauthenticatedView.tsx +++ b/src/home/UnauthenticatedView.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useState, FormEventHandler } from "react"; +import { type FC, useCallback, useState, type FormEventHandler } from "react"; import { useHistory } from "react-router-dom"; import { randomString } from "matrix-js-sdk/src/randomstring"; import { Trans, useTranslation } from "react-i18next"; diff --git a/src/home/useGroupCallRooms.ts b/src/home/useGroupCallRooms.ts index 3946b51b..73464987 100644 --- a/src/home/useGroupCallRooms.ts +++ b/src/home/useGroupCallRooms.ts @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { MatrixClient } from "matrix-js-sdk/src/client"; -import { Room, RoomEvent } from "matrix-js-sdk/src/models/room"; -import { RoomMember } from "matrix-js-sdk/src/models/room-member"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; +import { type Room, RoomEvent } from "matrix-js-sdk/src/models/room"; +import { type RoomMember } from "matrix-js-sdk/src/models/room-member"; import { useState, useEffect } from "react"; import { EventTimeline, EventType, JoinRule } from "matrix-js-sdk/src/matrix"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; import { KnownMembership } from "matrix-js-sdk/src/types"; diff --git a/src/input/AvatarInputField.tsx b/src/input/AvatarInputField.tsx index 84eb48ac..a4bccb27 100644 --- a/src/input/AvatarInputField.tsx +++ b/src/input/AvatarInputField.tsx @@ -6,13 +6,13 @@ Please see LICENSE in the repository root for full details. */ import { - AllHTMLAttributes, + type AllHTMLAttributes, useEffect, useCallback, useState, - ChangeEvent, + type ChangeEvent, useRef, - FC, + type FC, } from "react"; import classNames from "classnames"; import { useTranslation } from "react-i18next"; diff --git a/src/input/Input.tsx b/src/input/Input.tsx index 77003e5a..761988ad 100644 --- a/src/input/Input.tsx +++ b/src/input/Input.tsx @@ -6,11 +6,11 @@ Please see LICENSE in the repository root for full details. */ import { - ChangeEvent, - FC, - ForwardedRef, + type ChangeEvent, + type FC, + type ForwardedRef, forwardRef, - ReactNode, + type ReactNode, useId, } from "react"; import classNames from "classnames"; diff --git a/src/livekit/MediaDevicesContext.tsx b/src/livekit/MediaDevicesContext.tsx index d19840ef..f25761f9 100644 --- a/src/livekit/MediaDevicesContext.tsx +++ b/src/livekit/MediaDevicesContext.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { - FC, + type FC, createContext, useCallback, useContext, @@ -16,7 +16,7 @@ import { useState, } from "react"; import { createMediaDeviceObserver } from "@livekit/components-core"; -import { Observable } from "rxjs"; +import { type Observable } from "rxjs"; import { logger } from "matrix-js-sdk/src/logger"; import { @@ -24,7 +24,7 @@ import { audioInput as audioInputSetting, audioOutput as audioOutputSetting, videoInput as videoInputSetting, - Setting, + type Setting, } from "../settings/settings"; import { isFirefox } from "../Platform"; diff --git a/src/livekit/openIDSFU.ts b/src/livekit/openIDSFU.ts index 3c77db2f..ab696d4e 100644 --- a/src/livekit/openIDSFU.ts +++ b/src/livekit/openIDSFU.ts @@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { IOpenIDToken, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { type IOpenIDToken, type MatrixClient } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { useEffect, useState } from "react"; -import { LivekitFocus } from "matrix-js-sdk/src/matrixrtc/LivekitFocus"; +import { type LivekitFocus } from "matrix-js-sdk/src/matrixrtc/LivekitFocus"; import { useActiveLivekitFocus } from "../room/useActiveFocus"; diff --git a/src/livekit/options.ts b/src/livekit/options.ts index f7fe03ff..4f138585 100644 --- a/src/livekit/options.ts +++ b/src/livekit/options.ts @@ -8,10 +8,10 @@ Please see LICENSE in the repository root for full details. import { AudioPresets, DefaultReconnectPolicy, - RoomOptions, + type RoomOptions, ScreenSharePresets, - TrackPublishDefaults, - VideoPreset, + type TrackPublishDefaults, + type VideoPreset, VideoPresets, } from "livekit-client"; diff --git a/src/livekit/useECConnectionState.ts b/src/livekit/useECConnectionState.ts index 60c5b9bb..a99aa2e1 100644 --- a/src/livekit/useECConnectionState.ts +++ b/src/livekit/useECConnectionState.ts @@ -6,10 +6,10 @@ Please see LICENSE in the repository root for full details. */ import { - AudioCaptureOptions, + type AudioCaptureOptions, ConnectionState, - LocalTrack, - Room, + type LocalTrack, + type Room, RoomEvent, Track, } from "livekit-client"; @@ -17,7 +17,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import { logger } from "matrix-js-sdk/src/logger"; import * as Sentry from "@sentry/react"; -import { SFUConfig, sfuConfigEquals } from "./openIDSFU"; +import { type SFUConfig, sfuConfigEquals } from "./openIDSFU"; import { PosthogAnalytics } from "../analytics/PosthogAnalytics"; declare global { diff --git a/src/livekit/useLiveKit.ts b/src/livekit/useLiveKit.ts index 4645fab7..1bfe01d1 100644 --- a/src/livekit/useLiveKit.ts +++ b/src/livekit/useLiveKit.ts @@ -7,32 +7,32 @@ Please see LICENSE in the repository root for full details. import { ConnectionState, - E2EEOptions, + type E2EEOptions, ExternalE2EEKeyProvider, Room, - RoomOptions, + type RoomOptions, Track, } from "livekit-client"; import { useEffect, useMemo, useRef } from "react"; import E2EEWorker from "livekit-client/e2ee-worker?worker"; import { logger } from "matrix-js-sdk/src/logger"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { defaultLiveKitOptions } from "./options"; -import { SFUConfig } from "./openIDSFU"; -import { MuteStates } from "../room/MuteStates"; +import { type SFUConfig } from "./openIDSFU"; +import { type MuteStates } from "../room/MuteStates"; import { - MediaDevice, - MediaDevices, + type MediaDevice, + type MediaDevices, useMediaDevices, } from "./MediaDevicesContext"; import { - ECConnectionState, + type ECConnectionState, useECConnectionState, } from "./useECConnectionState"; import { MatrixKeyProvider } from "../e2ee/matrixKeyProvider"; import { E2eeType } from "../e2ee/e2eeType"; -import { EncryptionSystem } from "../e2ee/sharedKeyManagement"; +import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; interface UseLivekitResult { livekitRoom?: Room; diff --git a/src/otel/OTelCall.ts b/src/otel/OTelCall.ts index 586d410c..1bc349d3 100644 --- a/src/otel/OTelCall.ts +++ b/src/otel/OTelCall.ts @@ -5,17 +5,17 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Span } from "@opentelemetry/api"; -import { MatrixCall } from "matrix-js-sdk/src/matrix"; +import { type Span } from "@opentelemetry/api"; +import { type MatrixCall } from "matrix-js-sdk/src/matrix"; import { CallEvent } from "matrix-js-sdk/src/webrtc/call"; import { - TransceiverStats, - CallFeedStats, + type TransceiverStats, + type CallFeedStats, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; import { ObjectFlattener } from "./ObjectFlattener"; import { ElementCallOpenTelemetry } from "./otel"; -import { OTelCallAbstractMediaStreamSpan } from "./OTelCallAbstractMediaStreamSpan"; +import { type OTelCallAbstractMediaStreamSpan } from "./OTelCallAbstractMediaStreamSpan"; import { OTelCallTransceiverMediaStreamSpan } from "./OTelCallTransceiverMediaStreamSpan"; import { OTelCallFeedMediaStreamSpan } from "./OTelCallFeedMediaStreamSpan"; diff --git a/src/otel/OTelCallAbstractMediaStreamSpan.ts b/src/otel/OTelCallAbstractMediaStreamSpan.ts index 98862597..59328250 100644 --- a/src/otel/OTelCallAbstractMediaStreamSpan.ts +++ b/src/otel/OTelCallAbstractMediaStreamSpan.ts @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import opentelemetry, { Span } from "@opentelemetry/api"; -import { TrackStats } from "matrix-js-sdk/src/webrtc/stats/statsReport"; +import opentelemetry, { type Span } from "@opentelemetry/api"; +import { type TrackStats } from "matrix-js-sdk/src/webrtc/stats/statsReport"; -import { ElementCallOpenTelemetry } from "./otel"; +import { type ElementCallOpenTelemetry } from "./otel"; import { OTelCallMediaStreamTrackSpan } from "./OTelCallMediaStreamTrackSpan"; type TrackId = string; diff --git a/src/otel/OTelCallFeedMediaStreamSpan.ts b/src/otel/OTelCallFeedMediaStreamSpan.ts index 68a683fb..5ba9a774 100644 --- a/src/otel/OTelCallFeedMediaStreamSpan.ts +++ b/src/otel/OTelCallFeedMediaStreamSpan.ts @@ -5,13 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Span } from "@opentelemetry/api"; +import { type Span } from "@opentelemetry/api"; import { - CallFeedStats, - TrackStats, + type CallFeedStats, + type TrackStats, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; -import { ElementCallOpenTelemetry } from "./otel"; +import { type ElementCallOpenTelemetry } from "./otel"; import { OTelCallAbstractMediaStreamSpan } from "./OTelCallAbstractMediaStreamSpan"; export class OTelCallFeedMediaStreamSpan extends OTelCallAbstractMediaStreamSpan { diff --git a/src/otel/OTelCallMediaStreamTrackSpan.ts b/src/otel/OTelCallMediaStreamTrackSpan.ts index cee2b298..50c4c028 100644 --- a/src/otel/OTelCallMediaStreamTrackSpan.ts +++ b/src/otel/OTelCallMediaStreamTrackSpan.ts @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { TrackStats } from "matrix-js-sdk/src/webrtc/stats/statsReport"; -import opentelemetry, { Span } from "@opentelemetry/api"; +import { type TrackStats } from "matrix-js-sdk/src/webrtc/stats/statsReport"; +import opentelemetry, { type Span } from "@opentelemetry/api"; -import { ElementCallOpenTelemetry } from "./otel"; +import { type ElementCallOpenTelemetry } from "./otel"; export class OTelCallMediaStreamTrackSpan { private readonly span: Span; diff --git a/src/otel/OTelCallTransceiverMediaStreamSpan.ts b/src/otel/OTelCallTransceiverMediaStreamSpan.ts index c1fa33a2..a9f780ce 100644 --- a/src/otel/OTelCallTransceiverMediaStreamSpan.ts +++ b/src/otel/OTelCallTransceiverMediaStreamSpan.ts @@ -5,13 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Span } from "@opentelemetry/api"; +import { type Span } from "@opentelemetry/api"; import { - TrackStats, - TransceiverStats, + type TrackStats, + type TransceiverStats, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; -import { ElementCallOpenTelemetry } from "./otel"; +import { type ElementCallOpenTelemetry } from "./otel"; import { OTelCallAbstractMediaStreamSpan } from "./OTelCallAbstractMediaStreamSpan"; export class OTelCallTransceiverMediaStreamSpan extends OTelCallAbstractMediaStreamSpan { diff --git a/src/otel/OTelGroupCallMembership.ts b/src/otel/OTelGroupCallMembership.ts index c9eded22..6854a6c4 100644 --- a/src/otel/OTelGroupCallMembership.ts +++ b/src/otel/OTelGroupCallMembership.ts @@ -5,31 +5,35 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import opentelemetry, { Span, Attributes, Context } from "@opentelemetry/api"; +import opentelemetry, { + type Span, + type Attributes, + type Context, +} from "@opentelemetry/api"; import { - GroupCall, - MatrixClient, - MatrixEvent, - RoomMember, + type GroupCall, + type MatrixClient, + type MatrixEvent, + type RoomMember, } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { - CallError, - CallState, - MatrixCall, - VoipEvent, + type CallError, + type CallState, + type MatrixCall, + type VoipEvent, } from "matrix-js-sdk/src/webrtc/call"; import { - CallsByUserAndDevice, - GroupCallError, + type CallsByUserAndDevice, + type GroupCallError, GroupCallEvent, - GroupCallStatsReport, + type GroupCallStatsReport, } from "matrix-js-sdk/src/webrtc/groupCall"; import { - ConnectionStatsReport, - ByteSentStatsReport, - SummaryStatsReport, - CallFeedReport, + type ConnectionStatsReport, + type ByteSentStatsReport, + type SummaryStatsReport, + type CallFeedReport, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; import { ElementCallOpenTelemetry } from "./otel"; diff --git a/src/otel/ObjectFlattener.test.ts b/src/otel/ObjectFlattener.test.ts index 42f029cb..6a8de58b 100644 --- a/src/otel/ObjectFlattener.test.ts +++ b/src/otel/ObjectFlattener.test.ts @@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { GroupCallStatsReport } from "matrix-js-sdk/src/webrtc/groupCall"; +import { type GroupCallStatsReport } from "matrix-js-sdk/src/webrtc/groupCall"; import { - AudioConcealment, - ByteSentStatsReport, - ConnectionStatsReport, + type AudioConcealment, + type ByteSentStatsReport, + type ConnectionStatsReport, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; import { describe, expect, it } from "vitest"; diff --git a/src/otel/ObjectFlattener.ts b/src/otel/ObjectFlattener.ts index ebf66975..622700f2 100644 --- a/src/otel/ObjectFlattener.ts +++ b/src/otel/ObjectFlattener.ts @@ -4,13 +4,13 @@ Copyright 2023, 2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Attributes } from "@opentelemetry/api"; -import { VoipEvent } from "matrix-js-sdk/src/webrtc/call"; -import { GroupCallStatsReport } from "matrix-js-sdk/src/webrtc/groupCall"; +import { type Attributes } from "@opentelemetry/api"; +import { type VoipEvent } from "matrix-js-sdk/src/webrtc/call"; +import { type GroupCallStatsReport } from "matrix-js-sdk/src/webrtc/groupCall"; import { - ByteSentStatsReport, - ConnectionStatsReport, - SummaryStatsReport, + type ByteSentStatsReport, + type ConnectionStatsReport, + type SummaryStatsReport, } from "matrix-js-sdk/src/webrtc/stats/statsReport"; export class ObjectFlattener { diff --git a/src/otel/otel.ts b/src/otel/otel.ts index 14d31ec8..ec982975 100644 --- a/src/otel/otel.ts +++ b/src/otel/otel.ts @@ -8,7 +8,7 @@ Please see LICENSE in the repository root for full details. import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base"; import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; import { WebTracerProvider } from "@opentelemetry/sdk-trace-web"; -import opentelemetry, { Tracer } from "@opentelemetry/api"; +import opentelemetry, { type Tracer } from "@opentelemetry/api"; import { Resource } from "@opentelemetry/resources"; import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/profile/useProfile.ts b/src/profile/useProfile.ts index 6e04eec8..86164104 100644 --- a/src/profile/useProfile.ts +++ b/src/profile/useProfile.ts @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { MatrixClient } from "matrix-js-sdk/src/client"; -import { MatrixEvent } from "matrix-js-sdk/src/models/event"; -import { User, UserEvent } from "matrix-js-sdk/src/models/user"; -import { FileType } from "matrix-js-sdk/src/http-api"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixEvent } from "matrix-js-sdk/src/models/event"; +import { type User, UserEvent } from "matrix-js-sdk/src/models/user"; +import { type FileType } from "matrix-js-sdk/src/http-api"; import { useState, useCallback, useEffect } from "react"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/reactions/RaisedHandIndicator.tsx b/src/reactions/RaisedHandIndicator.tsx index 8c4747b3..02ca068c 100644 --- a/src/reactions/RaisedHandIndicator.tsx +++ b/src/reactions/RaisedHandIndicator.tsx @@ -6,8 +6,8 @@ Please see LICENSE in the repository root for full details. */ import { - MouseEventHandler, - ReactNode, + type MouseEventHandler, + type ReactNode, useCallback, useEffect, useState, diff --git a/src/reactions/ReactionIndicator.tsx b/src/reactions/ReactionIndicator.tsx index a664df18..e7066e11 100644 --- a/src/reactions/ReactionIndicator.tsx +++ b/src/reactions/ReactionIndicator.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { PropsWithChildren, ReactNode } from "react"; +import { type PropsWithChildren, type ReactNode } from "react"; import classNames from "classnames"; import { useTranslation } from "react-i18next"; diff --git a/src/reactions/index.ts b/src/reactions/index.ts index 610e24f0..f8253c81 100644 --- a/src/reactions/index.ts +++ b/src/reactions/index.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { RelationType } from "matrix-js-sdk/src/types"; +import { type RelationType } from "matrix-js-sdk/src/types"; import catSoundOgg from "../sound/reactions/cat.ogg?url"; import catSoundMp3 from "../sound/reactions/cat.mp3?url"; diff --git a/src/room/AppSelectionModal.tsx b/src/room/AppSelectionModal.tsx index 588fceef..79df17c9 100644 --- a/src/room/AppSelectionModal.tsx +++ b/src/room/AppSelectionModal.tsx @@ -5,7 +5,13 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, MouseEvent, useCallback, useMemo, useState } from "react"; +import { + type FC, + type MouseEvent, + useCallback, + useMemo, + useState, +} from "react"; import { useTranslation } from "react-i18next"; import { Button, Text } from "@vector-im/compound-web"; import { PopOutIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; diff --git a/src/room/CallEndedView.tsx b/src/room/CallEndedView.tsx index 556dc6e5..3ff4f397 100644 --- a/src/room/CallEndedView.tsx +++ b/src/room/CallEndedView.tsx @@ -5,8 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, FormEventHandler, ReactNode, useCallback, useState } from "react"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { + type FC, + type FormEventHandler, + type ReactNode, + useCallback, + useState, +} from "react"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { Trans, useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; import { Button, Heading, Text } from "@vector-im/compound-web"; diff --git a/src/room/CallEventAudioRenderer.test.tsx b/src/room/CallEventAudioRenderer.test.tsx index 5bb1ba19..e8d22704 100644 --- a/src/room/CallEventAudioRenderer.test.tsx +++ b/src/room/CallEventAudioRenderer.test.tsx @@ -10,20 +10,20 @@ import { afterAll, beforeEach, expect, - MockedFunction, + type MockedFunction, test, vitest, } from "vitest"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { ConnectionState } from "livekit-client"; import { BehaviorSubject, of } from "rxjs"; import { afterEach } from "node:test"; -import { act, ReactNode } from "react"; +import { act, type ReactNode } from "react"; import { - CallMembership, + type CallMembership, type MatrixRTCSession, } from "matrix-js-sdk/src/matrixrtc"; -import { RoomMember } from "matrix-js-sdk/src/matrix"; +import { type RoomMember } from "matrix-js-sdk/src/matrix"; import { mockLivekitRoom, diff --git a/src/room/CallEventAudioRenderer.tsx b/src/room/CallEventAudioRenderer.tsx index 6f4f0359..3c2e338f 100644 --- a/src/room/CallEventAudioRenderer.tsx +++ b/src/room/CallEventAudioRenderer.tsx @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ReactNode, useDeferredValue, useEffect, useMemo } from "react"; +import { type ReactNode, useDeferredValue, useEffect, useMemo } from "react"; import { filter, interval, throttle } from "rxjs"; -import { CallViewModel } from "../state/CallViewModel"; +import { type CallViewModel } from "../state/CallViewModel"; import joinCallSoundMp3 from "../sound/join_call.mp3"; import joinCallSoundOgg from "../sound/join_call.ogg"; import leftCallSoundMp3 from "../sound/left_call.mp3"; diff --git a/src/room/EncryptionLock.tsx b/src/room/EncryptionLock.tsx index 74706be1..e93aec98 100644 --- a/src/room/EncryptionLock.tsx +++ b/src/room/EncryptionLock.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC } from "react"; +import { type FC } from "react"; import { Tooltip } from "@vector-im/compound-web"; import { useTranslation } from "react-i18next"; import { diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 9336ffdd..98bfa1a6 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -5,31 +5,41 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { + type FC, + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from "react"; import { useHistory } from "react-router-dom"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { Room, isE2EESupported as isE2EESupportedBrowser, } from "livekit-client"; import { logger } from "matrix-js-sdk/src/logger"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { JoinRule } from "matrix-js-sdk/src/matrix"; import { Heading, Text } from "@vector-im/compound-web"; import { useTranslation } from "react-i18next"; import type { IWidgetApiRequest } from "matrix-widget-api"; -import { widget, ElementWidgetActions, JoinCallData } from "../widget"; +import { widget, ElementWidgetActions, type JoinCallData } from "../widget"; import { FullScreenView } from "../FullScreenView"; import { LobbyView } from "./LobbyView"; -import { MatrixInfo } from "./VideoPreview"; +import { type MatrixInfo } from "./VideoPreview"; import { CallEndedView } from "./CallEndedView"; import { PosthogAnalytics } from "../analytics/PosthogAnalytics"; import { useProfile } from "../profile/useProfile"; import { findDeviceByName } from "../utils/media"; import { ActiveCall } from "./InCallView"; -import { MUTE_PARTICIPANT_COUNT, MuteStates } from "./MuteStates"; -import { useMediaDevices, MediaDevices } from "../livekit/MediaDevicesContext"; +import { MUTE_PARTICIPANT_COUNT, type MuteStates } from "./MuteStates"; +import { + useMediaDevices, + type MediaDevices, +} from "../livekit/MediaDevicesContext"; import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships"; import { enterRTCSession, leaveRTCSession } from "../rtcSessionHelpers"; import { useMatrixRTCSessionJoinState } from "../useMatrixRTCSessionJoinState"; diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 8710d3e8..6ee9f184 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -10,13 +10,13 @@ import { RoomContext, useLocalParticipant, } from "@livekit/components-react"; -import { ConnectionState, Room } from "livekit-client"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { ConnectionState, type Room } from "livekit-client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { - FC, - PointerEvent, - PropsWithoutRef, - TouchEvent, + type FC, + type PointerEvent, + type PropsWithoutRef, + type TouchEvent, forwardRef, useCallback, useEffect, @@ -25,7 +25,7 @@ import { useState, } from "react"; import useMeasure from "react-use-measure"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import classNames from "classnames"; import { BehaviorSubject, map } from "rxjs"; import { useObservable, useObservableEagerState } from "observable-hooks"; @@ -49,28 +49,32 @@ import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts"; import { ElementWidgetActions, widget } from "../widget"; import styles from "./InCallView.module.css"; import { GridTile } from "../tile/GridTile"; -import { OTelGroupCallMembership } from "../otel/OTelGroupCallMembership"; +import { type OTelGroupCallMembership } from "../otel/OTelGroupCallMembership"; import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal"; import { useRageshakeRequestModal } from "../settings/submit-rageshake"; import { RageshakeRequestModal } from "./RageshakeRequestModal"; import { useLiveKit } from "../livekit/useLiveKit"; import { useWakeLock } from "../useWakeLock"; import { useMergedRefs } from "../useMergedRefs"; -import { MuteStates } from "./MuteStates"; -import { MatrixInfo } from "./VideoPreview"; +import { type MuteStates } from "./MuteStates"; +import { type MatrixInfo } from "./VideoPreview"; import { InviteButton } from "../button/InviteButton"; import { LayoutToggle } from "./LayoutToggle"; -import { ECConnectionState } from "../livekit/useECConnectionState"; +import { type ECConnectionState } from "../livekit/useECConnectionState"; import { useOpenIDSFU } from "../livekit/openIDSFU"; -import { CallViewModel, GridMode, Layout } from "../state/CallViewModel"; -import { Grid, TileProps } from "../grid/Grid"; +import { + CallViewModel, + type GridMode, + type Layout, +} from "../state/CallViewModel"; +import { Grid, type TileProps } from "../grid/Grid"; import { useInitial } from "../useInitial"; import { SpotlightTile } from "../tile/SpotlightTile"; -import { EncryptionSystem } from "../e2ee/sharedKeyManagement"; +import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; import { E2eeType } from "../e2ee/e2eeType"; import { makeGridLayout } from "../grid/GridLayout"; import { - CallLayoutOutputs, + type CallLayoutOutputs, defaultPipAlignment, defaultSpotlightAlignment, } from "../grid/CallLayout"; @@ -78,7 +82,7 @@ import { makeOneOnOneLayout } from "../grid/OneOnOneLayout"; import { makeSpotlightExpandedLayout } from "../grid/SpotlightExpandedLayout"; import { makeSpotlightLandscapeLayout } from "../grid/SpotlightLandscapeLayout"; import { makeSpotlightPortraitLayout } from "../grid/SpotlightPortraitLayout"; -import { GridTileViewModel, TileViewModel } from "../state/TileViewModel"; +import { GridTileViewModel, type TileViewModel } from "../state/TileViewModel"; import { ReactionsProvider, useReactions } from "../useReactions"; import { ReactionsAudioRenderer } from "./ReactionAudioRenderer"; import { useSwitchCamera } from "./useSwitchCamera"; diff --git a/src/room/InviteModal.test.tsx b/src/room/InviteModal.test.tsx index 45d903b0..ecd1ee48 100644 --- a/src/room/InviteModal.test.tsx +++ b/src/room/InviteModal.test.tsx @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { render, screen } from "@testing-library/react"; import { expect, test, vi } from "vitest"; -import { Room } from "matrix-js-sdk/src/matrix"; +import { type Room } from "matrix-js-sdk/src/matrix"; import { axe } from "vitest-axe"; import { BrowserRouter } from "react-router-dom"; import userEvent from "@testing-library/user-event"; diff --git a/src/room/InviteModal.tsx b/src/room/InviteModal.tsx index 4ef9a5a5..26bb6bc2 100644 --- a/src/room/InviteModal.tsx +++ b/src/room/InviteModal.tsx @@ -5,9 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, MouseEvent, useCallback, useMemo, useState } from "react"; +import { + type FC, + type MouseEvent, + useCallback, + useMemo, + useState, +} from "react"; import { useTranslation } from "react-i18next"; -import { Room } from "matrix-js-sdk/src/matrix"; +import { type Room } from "matrix-js-sdk/src/matrix"; import { Button, Text } from "@vector-im/compound-web"; import { LinkIcon, diff --git a/src/room/LayoutToggle.tsx b/src/room/LayoutToggle.tsx index 59dff95f..45cecb20 100644 --- a/src/room/LayoutToggle.tsx +++ b/src/room/LayoutToggle.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ChangeEvent, FC, TouchEvent, useCallback } from "react"; +import { type ChangeEvent, type FC, type TouchEvent, useCallback } from "react"; import { useTranslation } from "react-i18next"; import { Tooltip } from "@vector-im/compound-web"; import { diff --git a/src/room/LobbyView.tsx b/src/room/LobbyView.tsx index fd3df0c8..e7dfe3c5 100644 --- a/src/room/LobbyView.tsx +++ b/src/room/LobbyView.tsx @@ -5,15 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useMemo, useState } from "react"; +import { type FC, useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { Button } from "@vector-im/compound-web"; import classNames from "classnames"; import { useHistory } from "react-router-dom"; import { logger } from "matrix-js-sdk/src/logger"; import { usePreviewTracks } from "@livekit/components-react"; -import { LocalVideoTrack, Track } from "livekit-client"; +import { type LocalVideoTrack, Track } from "livekit-client"; import { useObservable } from "observable-hooks"; import { map } from "rxjs"; @@ -21,8 +21,8 @@ import inCallStyles from "./InCallView.module.css"; import styles from "./LobbyView.module.css"; import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header"; import { useLocationNavigation } from "../useLocationNavigation"; -import { MatrixInfo, VideoPreview } from "./VideoPreview"; -import { MuteStates } from "./MuteStates"; +import { type MatrixInfo, VideoPreview } from "./VideoPreview"; +import { type MuteStates } from "./MuteStates"; import { InviteButton } from "../button/InviteButton"; import { EndCallButton, diff --git a/src/room/MuteStates.test.tsx b/src/room/MuteStates.test.tsx index 6cc5815c..77ab8ace 100644 --- a/src/room/MuteStates.test.tsx +++ b/src/room/MuteStates.test.tsx @@ -6,15 +6,15 @@ Please see LICENSE in the repository root for full details. */ import { afterAll, afterEach, describe, expect, it, vi } from "vitest"; -import React, { ReactNode } from "react"; +import React, { type ReactNode } from "react"; import { beforeEach } from "vitest"; import { render, screen } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; import { useMuteStates } from "./MuteStates"; import { - MediaDevice, - MediaDevices, + type MediaDevice, + type MediaDevices, MediaDevicesContext, } from "../livekit/MediaDevicesContext"; import { mockConfig } from "../utils/test"; diff --git a/src/room/MuteStates.ts b/src/room/MuteStates.ts index 1452c250..b4f2b43e 100644 --- a/src/room/MuteStates.ts +++ b/src/room/MuteStates.ts @@ -6,16 +6,19 @@ Please see LICENSE in the repository root for full details. */ import { - Dispatch, - SetStateAction, + type Dispatch, + type SetStateAction, useCallback, useEffect, useMemo, } from "react"; -import { IWidgetApiRequest } from "matrix-widget-api"; +import { type IWidgetApiRequest } from "matrix-widget-api"; import { logger } from "matrix-js-sdk/src/logger"; -import { MediaDevice, useMediaDevices } from "../livekit/MediaDevicesContext"; +import { + type MediaDevice, + useMediaDevices, +} from "../livekit/MediaDevicesContext"; import { useReactiveState } from "../useReactiveState"; import { ElementWidgetActions, widget } from "../widget"; import { Config } from "../config/Config"; diff --git a/src/room/RageshakeRequestModal.tsx b/src/room/RageshakeRequestModal.tsx index d22b0bea..d240cb73 100644 --- a/src/room/RageshakeRequestModal.tsx +++ b/src/room/RageshakeRequestModal.tsx @@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useEffect } from "react"; +import { type FC, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { Button, Text } from "@vector-im/compound-web"; -import { Modal, Props as ModalProps } from "../Modal"; +import { Modal, type Props as ModalProps } from "../Modal"; import { FieldRow, ErrorMessage } from "../input/Input"; import { useSubmitRageshake } from "../settings/submit-rageshake"; diff --git a/src/room/ReactionAudioRenderer.test.tsx b/src/room/ReactionAudioRenderer.test.tsx index 2fec8a9a..0ab283a9 100644 --- a/src/room/ReactionAudioRenderer.test.tsx +++ b/src/room/ReactionAudioRenderer.test.tsx @@ -12,11 +12,11 @@ import { expect, test, vitest, - MockedFunction, - Mock, + type MockedFunction, + type Mock, } from "vitest"; import { TooltipProvider } from "@vector-im/compound-web"; -import { act, ReactNode } from "react"; +import { act, type ReactNode } from "react"; import { afterEach } from "node:test"; import { diff --git a/src/room/ReactionAudioRenderer.tsx b/src/room/ReactionAudioRenderer.tsx index 15bfc90f..6463c9d1 100644 --- a/src/room/ReactionAudioRenderer.tsx +++ b/src/room/ReactionAudioRenderer.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ReactNode, useDeferredValue, useEffect, useState } from "react"; +import { type ReactNode, useDeferredValue, useEffect, useState } from "react"; import { useReactions } from "../useReactions"; import { playReactionsSound, useSetting } from "../settings/settings"; diff --git a/src/room/ReactionsOverlay.test.tsx b/src/room/ReactionsOverlay.test.tsx index 121594ab..8ea17178 100644 --- a/src/room/ReactionsOverlay.test.tsx +++ b/src/room/ReactionsOverlay.test.tsx @@ -8,7 +8,7 @@ Please see LICENSE in the repository root for full details. import { render } from "@testing-library/react"; import { expect, test } from "vitest"; import { TooltipProvider } from "@vector-im/compound-web"; -import { act, ReactNode } from "react"; +import { act, type ReactNode } from "react"; import { afterEach } from "node:test"; import { diff --git a/src/room/ReactionsOverlay.tsx b/src/room/ReactionsOverlay.tsx index 7cdf7568..2f8daba5 100644 --- a/src/room/ReactionsOverlay.tsx +++ b/src/room/ReactionsOverlay.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ReactNode, useMemo } from "react"; +import { type ReactNode, useMemo } from "react"; import { useReactions } from "../useReactions"; import { diff --git a/src/room/RoomAuthView.tsx b/src/room/RoomAuthView.tsx index 2c7fd489..33aeb4c8 100644 --- a/src/room/RoomAuthView.tsx +++ b/src/room/RoomAuthView.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useState } from "react"; +import { type FC, useCallback, useState } from "react"; import { useLocation } from "react-router-dom"; import { Trans, useTranslation } from "react-i18next"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/room/RoomPage.tsx b/src/room/RoomPage.tsx index 49d594bb..8c88b985 100644 --- a/src/room/RoomPage.tsx +++ b/src/room/RoomPage.tsx @@ -5,11 +5,11 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useEffect, useState, ReactNode, useRef } from "react"; +import { type FC, useEffect, useState, type ReactNode, useRef } from "react"; import { logger } from "matrix-js-sdk/src/logger"; import { useTranslation } from "react-i18next"; import { CheckIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; -import { MatrixError } from "matrix-js-sdk/src/http-api"; +import { type MatrixError } from "matrix-js-sdk/src/http-api"; import { Heading, Text } from "@vector-im/compound-web"; import { useClientLegacy } from "../ClientContext"; diff --git a/src/room/VideoPreview.tsx b/src/room/VideoPreview.tsx index af05369e..f9609b99 100644 --- a/src/room/VideoPreview.tsx +++ b/src/room/VideoPreview.tsx @@ -5,15 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { useEffect, useRef, FC, ReactNode } from "react"; +import { useEffect, useRef, type FC, type ReactNode } from "react"; import useMeasure from "react-use-measure"; -import { facingModeFromLocalTrack, LocalVideoTrack } from "livekit-client"; +import { facingModeFromLocalTrack, type LocalVideoTrack } from "livekit-client"; import classNames from "classnames"; import { Avatar } from "../Avatar"; import styles from "./VideoPreview.module.css"; -import { MuteStates } from "./MuteStates"; -import { EncryptionSystem } from "../e2ee/sharedKeyManagement"; +import { type MuteStates } from "./MuteStates"; +import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; export type MatrixInfo = { userId: string; diff --git a/src/room/checkForParallelCalls.test.ts b/src/room/checkForParallelCalls.test.ts index 59378e43..c434620d 100644 --- a/src/room/checkForParallelCalls.test.ts +++ b/src/room/checkForParallelCalls.test.ts @@ -5,8 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { vi, Mocked, test, expect } from "vitest"; -import { RoomState } from "matrix-js-sdk/src/models/room-state"; +import { vi, type Mocked, test, expect } from "vitest"; +import { type RoomState } from "matrix-js-sdk/src/models/room-state"; import { PosthogAnalytics } from "../../src/analytics/PosthogAnalytics"; import { checkForParallelCalls } from "../../src/room/checkForParallelCalls"; diff --git a/src/room/checkForParallelCalls.ts b/src/room/checkForParallelCalls.ts index 92fa8174..f1687604 100644 --- a/src/room/checkForParallelCalls.ts +++ b/src/room/checkForParallelCalls.ts @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { EventType } from "matrix-js-sdk/src/@types/event"; -import { RoomState } from "matrix-js-sdk/src/models/room-state"; +import { type RoomState } from "matrix-js-sdk/src/models/room-state"; import { PosthogAnalytics } from "../analytics/PosthogAnalytics"; diff --git a/src/room/useActiveFocus.ts b/src/room/useActiveFocus.ts index bdfe0d02..79b5b6cb 100644 --- a/src/room/useActiveFocus.ts +++ b/src/room/useActiveFocus.ts @@ -6,14 +6,14 @@ Please see LICENSE in the repository root for full details. */ import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { useCallback, useEffect, useState } from "react"; import { deepCompare } from "matrix-js-sdk/src/utils"; import { logger } from "matrix-js-sdk/src/logger"; import { - LivekitFocus, + type LivekitFocus, isLivekitFocus, } from "matrix-js-sdk/src/matrixrtc/LivekitFocus"; diff --git a/src/room/useJoinRule.ts b/src/room/useJoinRule.ts index 7900a174..6939a952 100644 --- a/src/room/useJoinRule.ts +++ b/src/room/useJoinRule.ts @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { useCallback } from "react"; -import { JoinRule } from "matrix-js-sdk/src/matrix"; +import { type JoinRule } from "matrix-js-sdk/src/matrix"; import type { Room } from "matrix-js-sdk/src/models/room"; import { useRoomState } from "./useRoomState"; diff --git a/src/room/useLoadGroupCall.ts b/src/room/useLoadGroupCall.ts index 163571c8..5edf49d7 100644 --- a/src/room/useLoadGroupCall.ts +++ b/src/room/useLoadGroupCall.ts @@ -10,12 +10,12 @@ import { logger } from "matrix-js-sdk/src/logger"; import { EventType } from "matrix-js-sdk/src/@types/event"; import { ClientEvent, - MatrixClient, - RoomSummary, + type MatrixClient, + type RoomSummary, } from "matrix-js-sdk/src/client"; import { SyncState } from "matrix-js-sdk/src/sync"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; -import { RoomEvent, Room } from "matrix-js-sdk/src/models/room"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { RoomEvent, type Room } from "matrix-js-sdk/src/models/room"; import { KnownMembership } from "matrix-js-sdk/src/types"; import { JoinRule, MatrixError } from "matrix-js-sdk/src/matrix"; import { useTranslation } from "react-i18next"; diff --git a/src/room/useRoomAvatar.ts b/src/room/useRoomAvatar.ts index 377dd7fd..990880eb 100644 --- a/src/room/useRoomAvatar.ts +++ b/src/room/useRoomAvatar.ts @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { useCallback } from "react"; -import { Room } from "matrix-js-sdk/src/models/room"; +import { type Room } from "matrix-js-sdk/src/models/room"; import { useRoomState } from "./useRoomState"; diff --git a/src/room/useRoomName.ts b/src/room/useRoomName.ts index b58d3be1..f49a84b2 100644 --- a/src/room/useRoomName.ts +++ b/src/room/useRoomName.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Room, RoomEvent } from "matrix-js-sdk/src/matrix"; +import { type Room, RoomEvent } from "matrix-js-sdk/src/matrix"; import { useState } from "react"; import { useTypedEventEmitter } from "../useEvents"; diff --git a/src/room/useRoomState.ts b/src/room/useRoomState.ts index f4d52ff5..d7cc9b6b 100644 --- a/src/room/useRoomState.ts +++ b/src/room/useRoomState.ts @@ -5,7 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { RoomState, RoomStateEvent } from "matrix-js-sdk/src/models/room-state"; +import { + type RoomState, + RoomStateEvent, +} from "matrix-js-sdk/src/models/room-state"; import { useCallback, useMemo, useState } from "react"; import type { Room } from "matrix-js-sdk/src/models/room"; diff --git a/src/room/useSwitchCamera.ts b/src/room/useSwitchCamera.ts index c1b4f092..8bbfc92c 100644 --- a/src/room/useSwitchCamera.ts +++ b/src/room/useSwitchCamera.ts @@ -9,14 +9,14 @@ import { fromEvent, map, merge, - Observable, + type Observable, of, startWith, switchMap, } from "rxjs"; import { facingModeFromLocalTrack, - LocalVideoTrack, + type LocalVideoTrack, TrackEvent, } from "livekit-client"; import { useObservable, useObservableEagerState } from "observable-hooks"; diff --git a/src/rtcSessionHelper.test.ts b/src/rtcSessionHelper.test.ts index 61cd990e..7df9f1b3 100644 --- a/src/rtcSessionHelper.test.ts +++ b/src/rtcSessionHelper.test.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { expect, test, vi } from "vitest"; import { enterRTCSession } from "../src/rtcSessionHelpers"; diff --git a/src/rtcSessionHelpers.ts b/src/rtcSessionHelpers.ts index 9e699319..015bf627 100644 --- a/src/rtcSessionHelpers.ts +++ b/src/rtcSessionHelpers.ts @@ -5,18 +5,18 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { logger } from "matrix-js-sdk/src/logger"; import { - LivekitFocus, - LivekitFocusActive, + type LivekitFocus, + type LivekitFocusActive, isLivekitFocus, isLivekitFocusConfig, } from "matrix-js-sdk/src/matrixrtc/LivekitFocus"; import { PosthogAnalytics } from "./analytics/PosthogAnalytics"; import { Config } from "./config/Config"; -import { ElementWidgetActions, WidgetHelpers, widget } from "./widget"; +import { ElementWidgetActions, type WidgetHelpers, widget } from "./widget"; const FOCI_WK_KEY = "org.matrix.msc4143.rtc_foci"; diff --git a/src/settings/DeviceSelection.tsx b/src/settings/DeviceSelection.tsx index 005973a0..da4fe11a 100644 --- a/src/settings/DeviceSelection.tsx +++ b/src/settings/DeviceSelection.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ChangeEvent, FC, useCallback, useId } from "react"; +import { type ChangeEvent, type FC, useCallback, useId } from "react"; import { Heading, InlineField, @@ -14,7 +14,7 @@ import { Separator, } from "@vector-im/compound-web"; -import { MediaDevice } from "../livekit/MediaDevicesContext"; +import { type MediaDevice } from "../livekit/MediaDevicesContext"; import styles from "./DeviceSelection.module.css"; interface Props { diff --git a/src/settings/FeedbackSettingsTab.tsx b/src/settings/FeedbackSettingsTab.tsx index 455995a1..f77da898 100644 --- a/src/settings/FeedbackSettingsTab.tsx +++ b/src/settings/FeedbackSettingsTab.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback } from "react"; +import { type FC, useCallback } from "react"; import { randomString } from "matrix-js-sdk/src/randomstring"; import { useTranslation } from "react-i18next"; import { Button, Text } from "@vector-im/compound-web"; diff --git a/src/settings/PreferencesSettingsTab.tsx b/src/settings/PreferencesSettingsTab.tsx index bc98d181..32200f7b 100644 --- a/src/settings/PreferencesSettingsTab.tsx +++ b/src/settings/PreferencesSettingsTab.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ChangeEvent, FC } from "react"; +import { type ChangeEvent, type FC } from "react"; import { useTranslation } from "react-i18next"; import { Text } from "@vector-im/compound-web"; diff --git a/src/settings/ProfileSettingsTab.tsx b/src/settings/ProfileSettingsTab.tsx index 4eb5b0d9..94d43f04 100644 --- a/src/settings/ProfileSettingsTab.tsx +++ b/src/settings/ProfileSettingsTab.tsx @@ -5,8 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { FC, useCallback, useEffect, useMemo, useRef } from "react"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type FC, useCallback, useEffect, useMemo, useRef } from "react"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { useTranslation } from "react-i18next"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/settings/RageshakeButton.tsx b/src/settings/RageshakeButton.tsx index 0854da6e..fa17b788 100644 --- a/src/settings/RageshakeButton.tsx +++ b/src/settings/RageshakeButton.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { useTranslation } from "react-i18next"; -import { FC, useCallback } from "react"; +import { type FC, useCallback } from "react"; import { Button } from "@vector-im/compound-web"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/settings/SettingsModal.tsx b/src/settings/SettingsModal.tsx index 9d7eb5a1..6bb8d42b 100644 --- a/src/settings/SettingsModal.tsx +++ b/src/settings/SettingsModal.tsx @@ -5,14 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ChangeEvent, FC, useCallback, useState } from "react"; +import { type ChangeEvent, type FC, useCallback, useState } from "react"; import { Trans, useTranslation } from "react-i18next"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { Root as Form, Text } from "@vector-im/compound-web"; import { Modal } from "../Modal"; import styles from "./SettingsModal.module.css"; -import { Tab, TabContainer } from "../tabs/Tabs"; +import { type Tab, TabContainer } from "../tabs/Tabs"; import { FieldRow, InputField } from "../input/Input"; import { AnalyticsNotice } from "../analytics/AnalyticsNotice"; import { ProfileSettingsTab } from "./ProfileSettingsTab"; diff --git a/src/settings/rageshake.ts b/src/settings/rageshake.ts index 1030042f..c2d0ebf8 100644 --- a/src/settings/rageshake.ts +++ b/src/settings/rageshake.ts @@ -29,9 +29,11 @@ Please see LICENSE in the repository root for full details. import EventEmitter from "events"; import { throttle } from "lodash-es"; -import { Logger, logger } from "matrix-js-sdk/src/logger"; +import { type Logger, logger } from "matrix-js-sdk/src/logger"; import { randomString } from "matrix-js-sdk/src/randomstring"; -import loglevel, { LoggingMethod } from "loglevel"; +import { type LoggingMethod } from "loglevel"; + +import type loglevel from "loglevel"; // the length of log data we keep in indexeddb (and include in the reports) const MAX_LOG_SIZE = 1024 * 1024 * 5; // 5 MB diff --git a/src/settings/settings.ts b/src/settings/settings.ts index b2da1674..8d32adbe 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { logger } from "matrix-js-sdk/src/logger"; -import { BehaviorSubject, Observable } from "rxjs"; +import { BehaviorSubject, type Observable } from "rxjs"; import { useObservableEagerState } from "observable-hooks"; import { PosthogAnalytics } from "../analytics/PosthogAnalytics"; diff --git a/src/settings/submit-rageshake.ts b/src/settings/submit-rageshake.ts index ae320493..9a3529d5 100644 --- a/src/settings/submit-rageshake.ts +++ b/src/settings/submit-rageshake.ts @@ -5,20 +5,20 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ComponentProps, useCallback, useEffect, useState } from "react"; +import { type ComponentProps, useCallback, useEffect, useState } from "react"; import { logger } from "matrix-js-sdk/src/logger"; import { ClientEvent, - Crypto, - MatrixClient, - MatrixEvent, + type Crypto, + type MatrixClient, + type MatrixEvent, } from "matrix-js-sdk/src/matrix"; import { getLogsForReport } from "./rageshake"; import { useClient } from "../ClientContext"; import { Config } from "../config/Config"; import { ElementCallOpenTelemetry } from "../otel/otel"; -import { RageshakeRequestModal } from "../room/RageshakeRequestModal"; +import { type RageshakeRequestModal } from "../room/RageshakeRequestModal"; const gzip = async (text: string): Promise => { // pako is relatively large (200KB), so we only import it when needed diff --git a/src/state/CallViewModel.test.ts b/src/state/CallViewModel.test.ts index 5dbfb1ca..ad7e8702 100644 --- a/src/state/CallViewModel.test.ts +++ b/src/state/CallViewModel.test.ts @@ -11,23 +11,26 @@ import { debounceTime, distinctUntilChanged, map, - Observable, + type Observable, of, switchMap, } from "rxjs"; -import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { type MatrixClient } from "matrix-js-sdk/src/matrix"; import { ConnectionState, - LocalParticipant, - Participant, + type LocalParticipant, + type Participant, ParticipantEvent, - RemoteParticipant, + type RemoteParticipant, } from "livekit-client"; import * as ComponentsCore from "@livekit/components-core"; import { isEqual } from "lodash-es"; -import { CallMembership, MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; +import { + type CallMembership, + type MatrixRTCSession, +} from "matrix-js-sdk/src/matrixrtc"; -import { CallViewModel, Layout } from "./CallViewModel"; +import { CallViewModel, type Layout } from "./CallViewModel"; import { mockLivekitRoom, mockLocalParticipant, @@ -40,7 +43,7 @@ import { } from "../utils/test"; import { ECAddonConnectionState, - ECConnectionState, + type ECConnectionState, } from "../livekit/useECConnectionState"; import { E2eeType } from "../e2ee/e2eeType"; diff --git a/src/state/CallViewModel.ts b/src/state/CallViewModel.ts index af8780b1..a2a10884 100644 --- a/src/state/CallViewModel.ts +++ b/src/state/CallViewModel.ts @@ -11,18 +11,21 @@ import { observeParticipantMedia, } from "@livekit/components-core"; import { - Room as LivekitRoom, - LocalParticipant, + type Room as LivekitRoom, + type LocalParticipant, LocalVideoTrack, ParticipantEvent, - RemoteParticipant, + type RemoteParticipant, Track, } from "livekit-client"; -import { Room as MatrixRoom, RoomMember } from "matrix-js-sdk/src/matrix"; +import { + type Room as MatrixRoom, + type RoomMember, +} from "matrix-js-sdk/src/matrix"; import { BehaviorSubject, EMPTY, - Observable, + type Observable, Subject, combineLatest, concat, @@ -47,35 +50,38 @@ import { } from "rxjs"; import { logger } from "matrix-js-sdk/src/logger"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc"; import { ViewModel } from "./ViewModel"; import { ECAddonConnectionState, - ECConnectionState, + type ECConnectionState, } from "../livekit/useECConnectionState"; import { LocalUserMediaViewModel, - MediaViewModel, + type MediaViewModel, observeTrackReference, RemoteUserMediaViewModel, ScreenShareViewModel, - UserMediaViewModel, + type UserMediaViewModel, } from "./MediaViewModel"; import { accumulate, finalizeValue } from "../utils/observable"; import { ObservableScope } from "./ObservableScope"; import { duplicateTiles } from "../settings/settings"; import { isFirefox } from "../Platform"; import { setPipEnabled } from "../controls"; -import { GridTileViewModel, SpotlightTileViewModel } from "./TileViewModel"; +import { + type GridTileViewModel, + type SpotlightTileViewModel, +} from "./TileViewModel"; import { TileStore } from "./TileStore"; import { gridLikeLayout } from "./GridLikeLayout"; import { spotlightExpandedLayout } from "./SpotlightExpandedLayout"; import { oneOnOneLayout } from "./OneOnOneLayout"; import { pipLayout } from "./PipLayout"; -import { EncryptionSystem } from "../e2ee/sharedKeyManagement"; +import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; import { observeSpeaker } from "./observeSpeaker"; // How long we wait after a focus switch before showing the real participant diff --git a/src/state/GridLikeLayout.ts b/src/state/GridLikeLayout.ts index 7fcada95..b846939e 100644 --- a/src/state/GridLikeLayout.ts +++ b/src/state/GridLikeLayout.ts @@ -5,9 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Layout, LayoutMedia } from "./CallViewModel"; -import { TileStore } from "./TileStore"; -import { GridTileViewModel } from "./TileViewModel"; +import { type Layout, type LayoutMedia } from "./CallViewModel"; +import { type TileStore } from "./TileStore"; +import { type GridTileViewModel } from "./TileViewModel"; export type GridLikeLayoutType = | "grid" diff --git a/src/state/MediaViewModel.ts b/src/state/MediaViewModel.ts index ceaca57c..ea015eb8 100644 --- a/src/state/MediaViewModel.ts +++ b/src/state/MediaViewModel.ts @@ -6,30 +6,30 @@ Please see LICENSE in the repository root for full details. */ import { - AudioSource, - TrackReferenceOrPlaceholder, - VideoSource, + type AudioSource, + type TrackReferenceOrPlaceholder, + type VideoSource, observeParticipantEvents, observeParticipantMedia, roomEventSelector, } from "@livekit/components-core"; import { - LocalParticipant, + type LocalParticipant, LocalTrack, - Participant, + type Participant, ParticipantEvent, - RemoteParticipant, + type RemoteParticipant, Track, TrackEvent, facingModeFromLocalTrack, - Room as LivekitRoom, + type Room as LivekitRoom, RoomEvent as LivekitRoomEvent, RemoteTrack, } from "livekit-client"; -import { RoomMember, RoomMemberEvent } from "matrix-js-sdk/src/matrix"; +import { type RoomMember, RoomMemberEvent } from "matrix-js-sdk/src/matrix"; import { BehaviorSubject, - Observable, + type Observable, Subject, combineLatest, distinctUntilKeyChanged, @@ -49,7 +49,7 @@ import { ViewModel } from "./ViewModel"; import { useReactiveState } from "../useReactiveState"; import { alwaysShowSelf } from "../settings/settings"; import { accumulate } from "../utils/observable"; -import { EncryptionSystem } from "../e2ee/sharedKeyManagement"; +import { type EncryptionSystem } from "../e2ee/sharedKeyManagement"; import { E2eeType } from "../e2ee/e2eeType"; // TODO: Move this naming logic into the view model diff --git a/src/state/ObservableScope.ts b/src/state/ObservableScope.ts index 2cf88351..5a2e0e9a 100644 --- a/src/state/ObservableScope.ts +++ b/src/state/ObservableScope.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { distinctUntilChanged, - Observable, + type Observable, shareReplay, Subject, takeUntil, diff --git a/src/state/OneOnOneLayout.ts b/src/state/OneOnOneLayout.ts index 29ed9fc0..f078b7e3 100644 --- a/src/state/OneOnOneLayout.ts +++ b/src/state/OneOnOneLayout.ts @@ -5,9 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { OneOnOneLayout, OneOnOneLayoutMedia } from "./CallViewModel"; -import { TileStore } from "./TileStore"; -import { GridTileViewModel } from "./TileViewModel"; +import { type OneOnOneLayout, type OneOnOneLayoutMedia } from "./CallViewModel"; +import { type TileStore } from "./TileStore"; +import { type GridTileViewModel } from "./TileViewModel"; /** * Produces a one-on-one layout with the given media. diff --git a/src/state/PipLayout.ts b/src/state/PipLayout.ts index 35edeefe..79187752 100644 --- a/src/state/PipLayout.ts +++ b/src/state/PipLayout.ts @@ -5,9 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { PipLayout, PipLayoutMedia } from "./CallViewModel"; -import { TileStore } from "./TileStore"; -import { GridTileViewModel } from "./TileViewModel"; +import { type PipLayout, type PipLayoutMedia } from "./CallViewModel"; +import { type TileStore } from "./TileStore"; +import { type GridTileViewModel } from "./TileViewModel"; /** * Produces a picture-in-picture layout with the given media. diff --git a/src/state/SpotlightExpandedLayout.ts b/src/state/SpotlightExpandedLayout.ts index 83c5a95e..56b1d01d 100644 --- a/src/state/SpotlightExpandedLayout.ts +++ b/src/state/SpotlightExpandedLayout.ts @@ -6,11 +6,11 @@ Please see LICENSE in the repository root for full details. */ import { - SpotlightExpandedLayout, - SpotlightExpandedLayoutMedia, + type SpotlightExpandedLayout, + type SpotlightExpandedLayoutMedia, } from "./CallViewModel"; -import { TileStore } from "./TileStore"; -import { GridTileViewModel } from "./TileViewModel"; +import { type TileStore } from "./TileStore"; +import { type GridTileViewModel } from "./TileViewModel"; /** * Produces an expanded spotlight layout with the given media. diff --git a/src/state/TileStore.ts b/src/state/TileStore.ts index 0288830c..ab918cb0 100644 --- a/src/state/TileStore.ts +++ b/src/state/TileStore.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { BehaviorSubject } from "rxjs"; -import { MediaViewModel, UserMediaViewModel } from "./MediaViewModel"; +import { type MediaViewModel, type UserMediaViewModel } from "./MediaViewModel"; import { GridTileViewModel, SpotlightTileViewModel } from "./TileViewModel"; import { fillGaps } from "../utils/iter"; diff --git a/src/state/TileViewModel.ts b/src/state/TileViewModel.ts index 3c25907e..53bc8648 100644 --- a/src/state/TileViewModel.ts +++ b/src/state/TileViewModel.ts @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { BehaviorSubject, Observable } from "rxjs"; +import { BehaviorSubject, type Observable } from "rxjs"; import { ViewModel } from "./ViewModel"; -import { MediaViewModel, UserMediaViewModel } from "./MediaViewModel"; +import { type MediaViewModel, type UserMediaViewModel } from "./MediaViewModel"; let nextId = 0; function createId(): string { diff --git a/src/state/observeSpeaker.ts b/src/state/observeSpeaker.ts index d32fbdaa..cce43ef9 100644 --- a/src/state/observeSpeaker.ts +++ b/src/state/observeSpeaker.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ import { - Observable, + type Observable, audit, merge, timer, diff --git a/src/tabs/Tabs.tsx b/src/tabs/Tabs.tsx index 8f063a97..287be30d 100644 --- a/src/tabs/Tabs.tsx +++ b/src/tabs/Tabs.tsx @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Key, ReactNode, useId } from "react"; +import { type Key, type ReactNode, useId } from "react"; import { NavBar, NavItem } from "@vector-im/compound-web"; import styles from "./Tabs.module.css"; diff --git a/src/tile/GridTile.test.tsx b/src/tile/GridTile.test.tsx index c0cf9c48..d7edf3b3 100644 --- a/src/tile/GridTile.test.tsx +++ b/src/tile/GridTile.test.tsx @@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { RemoteTrackPublication } from "livekit-client"; +import { type RemoteTrackPublication } from "livekit-client"; import { test, expect } from "vitest"; import { render, screen } from "@testing-library/react"; import { axe } from "vitest-axe"; import { of } from "rxjs"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { GridTile } from "./GridTile"; import { mockRtcMembership, withRemoteMedia } from "../utils/test"; diff --git a/src/tile/GridTile.tsx b/src/tile/GridTile.tsx index 15f7c295..73c17527 100644 --- a/src/tile/GridTile.tsx +++ b/src/tile/GridTile.tsx @@ -6,14 +6,14 @@ Please see LICENSE in the repository root for full details. */ import { - ComponentProps, - ReactNode, + type ComponentProps, + type ReactNode, forwardRef, useCallback, useRef, useState, } from "react"; -import { animated } from "@react-spring/web"; +import { type animated } from "@react-spring/web"; import classNames from "classnames"; import { useTranslation } from "react-i18next"; import { @@ -38,18 +38,18 @@ import { useObservableEagerState } from "observable-hooks"; import styles from "./GridTile.module.css"; import { - UserMediaViewModel, + type UserMediaViewModel, useDisplayName, LocalUserMediaViewModel, - RemoteUserMediaViewModel, + type RemoteUserMediaViewModel, } from "../state/MediaViewModel"; import { Slider } from "../Slider"; import { MediaView } from "./MediaView"; import { useLatest } from "../useLatest"; -import { GridTileViewModel } from "../state/TileViewModel"; +import { type GridTileViewModel } from "../state/TileViewModel"; import { useMergedRefs } from "../useMergedRefs"; import { useReactions } from "../useReactions"; -import { ReactionOption } from "../reactions"; +import { type ReactionOption } from "../reactions"; interface TileProps { className?: string; diff --git a/src/tile/MediaView.test.tsx b/src/tile/MediaView.test.tsx index fea4303f..55ad8a12 100644 --- a/src/tile/MediaView.test.tsx +++ b/src/tile/MediaView.test.tsx @@ -10,8 +10,8 @@ import { render, screen } from "@testing-library/react"; import { axe } from "vitest-axe"; import { TooltipProvider } from "@vector-im/compound-web"; import { - TrackReference, - TrackReferencePlaceholder, + type TrackReference, + type TrackReferencePlaceholder, } from "@livekit/components-core"; import { Track, TrackPublication } from "livekit-client"; import { type ComponentProps } from "react"; diff --git a/src/tile/MediaView.tsx b/src/tile/MediaView.tsx index 48871abd..0d5341a8 100644 --- a/src/tile/MediaView.tsx +++ b/src/tile/MediaView.tsx @@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { TrackReferenceOrPlaceholder } from "@livekit/components-core"; +import { type TrackReferenceOrPlaceholder } from "@livekit/components-core"; import { animated } from "@react-spring/web"; -import { RoomMember } from "matrix-js-sdk/src/matrix"; -import { ComponentProps, ReactNode, forwardRef } from "react"; +import { type RoomMember } from "matrix-js-sdk/src/matrix"; +import { type ComponentProps, type ReactNode, forwardRef } from "react"; import { useTranslation } from "react-i18next"; import classNames from "classnames"; import { VideoTrack } from "@livekit/components-react"; @@ -17,10 +17,10 @@ import { ErrorIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; import styles from "./MediaView.module.css"; import { Avatar } from "../Avatar"; -import { EncryptionStatus } from "../state/MediaViewModel"; +import { type EncryptionStatus } from "../state/MediaViewModel"; import { RaisedHandIndicator } from "../reactions/RaisedHandIndicator"; import { showHandRaisedTimer, useSetting } from "../settings/settings"; -import { ReactionOption } from "../reactions"; +import { type ReactionOption } from "../reactions"; import { ReactionIndicator } from "../reactions/ReactionIndicator"; interface Props extends ComponentProps { diff --git a/src/tile/SpotlightTile.tsx b/src/tile/SpotlightTile.tsx index dce30d5f..a1c3d46f 100644 --- a/src/tile/SpotlightTile.tsx +++ b/src/tile/SpotlightTile.tsx @@ -6,8 +6,8 @@ Please see LICENSE in the repository root for full details. */ import { - ComponentProps, - RefAttributes, + type ComponentProps, + type RefAttributes, forwardRef, useCallback, useEffect, @@ -21,28 +21,28 @@ import { ChevronRightIcon, } from "@vector-im/compound-design-tokens/assets/web/icons"; import { animated } from "@react-spring/web"; -import { Observable, map } from "rxjs"; +import { type Observable, map } from "rxjs"; import { useObservableEagerState, useObservableRef } from "observable-hooks"; import { useTranslation } from "react-i18next"; import classNames from "classnames"; -import { TrackReferenceOrPlaceholder } from "@livekit/components-core"; -import { RoomMember } from "matrix-js-sdk/src/matrix"; +import { type TrackReferenceOrPlaceholder } from "@livekit/components-core"; +import { type RoomMember } from "matrix-js-sdk/src/matrix"; import { MediaView } from "./MediaView"; import styles from "./SpotlightTile.module.css"; import { - EncryptionStatus, + type EncryptionStatus, LocalUserMediaViewModel, - MediaViewModel, + type MediaViewModel, ScreenShareViewModel, - UserMediaViewModel, + type UserMediaViewModel, useDisplayName, } from "../state/MediaViewModel"; import { useInitial } from "../useInitial"; import { useMergedRefs } from "../useMergedRefs"; import { useReactiveState } from "../useReactiveState"; import { useLatest } from "../useLatest"; -import { SpotlightTileViewModel } from "../state/TileViewModel"; +import { type SpotlightTileViewModel } from "../state/TileViewModel"; interface SpotlightItemBaseProps { className?: string; diff --git a/src/useAudioContext.test.tsx b/src/useAudioContext.test.tsx index 5a1afe43..2b9b0982 100644 --- a/src/useAudioContext.test.tsx +++ b/src/useAudioContext.test.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { expect, test, vitest } from "vitest"; -import { FC } from "react"; +import { type FC } from "react"; import { render } from "@testing-library/react"; import { afterEach } from "node:test"; import userEvent from "@testing-library/user-event"; diff --git a/src/useAudioContext.tsx b/src/useAudioContext.tsx index ccf4cbd5..1580f32a 100644 --- a/src/useAudioContext.tsx +++ b/src/useAudioContext.tsx @@ -13,7 +13,7 @@ import { useSetting, } from "./settings/settings"; import { useMediaDevices } from "./livekit/MediaDevicesContext"; -import { PrefetchedSounds } from "./soundUtils"; +import { type PrefetchedSounds } from "./soundUtils"; /** * Play a sound though a given AudioContext. Will take diff --git a/src/useCallViewKeyboardShortcuts.test.tsx b/src/useCallViewKeyboardShortcuts.test.tsx index fdf7ed85..8c25bb57 100644 --- a/src/useCallViewKeyboardShortcuts.test.tsx +++ b/src/useCallViewKeyboardShortcuts.test.tsx @@ -6,13 +6,17 @@ Please see LICENSE in the repository root for full details. */ import { render } from "@testing-library/react"; -import { FC, useRef } from "react"; +import { type FC, useRef } from "react"; import { expect, test, vi } from "vitest"; import { Button } from "@vector-im/compound-web"; import userEvent from "@testing-library/user-event"; import { useCallViewKeyboardShortcuts } from "../src/useCallViewKeyboardShortcuts"; -import { ReactionOption, ReactionSet, ReactionsRowSize } from "./reactions"; +import { + type ReactionOption, + ReactionSet, + ReactionsRowSize, +} from "./reactions"; // Test Explanation: // - The main objective is to test `useCallViewKeyboardShortcuts`. diff --git a/src/useCallViewKeyboardShortcuts.ts b/src/useCallViewKeyboardShortcuts.ts index 77028a27..a426be58 100644 --- a/src/useCallViewKeyboardShortcuts.ts +++ b/src/useCallViewKeyboardShortcuts.ts @@ -5,10 +5,14 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { RefObject, useCallback, useMemo, useRef } from "react"; +import { type RefObject, useCallback, useMemo, useRef } from "react"; import { useEventTarget } from "./useEvents"; -import { ReactionOption, ReactionSet, ReactionsRowSize } from "./reactions"; +import { + type ReactionOption, + ReactionSet, + ReactionsRowSize, +} from "./reactions"; /** * Determines whether focus is in the same part of the tree as the given diff --git a/src/useLatest.ts b/src/useLatest.ts index 6a7ec41a..c54eb6c4 100644 --- a/src/useLatest.ts +++ b/src/useLatest.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { RefObject, useRef } from "react"; +import { type RefObject, useRef } from "react"; export interface LatestRef extends RefObject { current: T; diff --git a/src/useMatrixRTCSessionJoinState.ts b/src/useMatrixRTCSessionJoinState.ts index 42fed070..0bdaa25d 100644 --- a/src/useMatrixRTCSessionJoinState.ts +++ b/src/useMatrixRTCSessionJoinState.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { logger } from "matrix-js-sdk/src/logger"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { useCallback, useEffect, useState } from "react"; diff --git a/src/useMatrixRTCSessionMemberships.ts b/src/useMatrixRTCSessionMemberships.ts index 942a2257..fa9e8f46 100644 --- a/src/useMatrixRTCSessionMemberships.ts +++ b/src/useMatrixRTCSessionMemberships.ts @@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details. */ import { logger } from "matrix-js-sdk/src/logger"; -import { CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership"; +import { type CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { useCallback, useEffect, useState } from "react"; diff --git a/src/useMergedRefs.ts b/src/useMergedRefs.ts index 20627b30..03093b77 100644 --- a/src/useMergedRefs.ts +++ b/src/useMergedRefs.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { MutableRefObject, RefCallback, useCallback } from "react"; +import { type MutableRefObject, type RefCallback, useCallback } from "react"; /** * Combines multiple refs into one, useful for attaching multiple refs to the diff --git a/src/useReactions.test.tsx b/src/useReactions.test.tsx index 6140793f..56edd7e1 100644 --- a/src/useReactions.test.tsx +++ b/src/useReactions.test.tsx @@ -6,7 +6,7 @@ Please see LICENSE in the repository root for full details. */ import { render } from "@testing-library/react"; -import { act, FC } from "react"; +import { act, type FC } from "react"; import { describe, expect, test } from "vitest"; import { RoomEvent } from "matrix-js-sdk/src/matrix"; diff --git a/src/useReactions.tsx b/src/useReactions.tsx index 7195cfd0..7289187a 100644 --- a/src/useReactions.tsx +++ b/src/useReactions.tsx @@ -7,31 +7,31 @@ Please see LICENSE in the repository root for full details. import { EventType, - MatrixEvent, + type MatrixEvent, RelationType, RoomEvent as MatrixRoomEvent, MatrixEventEvent, } from "matrix-js-sdk/src/matrix"; -import { ReactionEventContent } from "matrix-js-sdk/src/types"; +import { type ReactionEventContent } from "matrix-js-sdk/src/types"; import { createContext, useContext, useState, - ReactNode, + type ReactNode, useCallback, useEffect, useMemo, } from "react"; -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; import { logger } from "matrix-js-sdk/src/logger"; import { useMatrixRTCSessionMemberships } from "./useMatrixRTCSessionMemberships"; import { useClientState } from "./ClientContext"; import { - ECallReactionEventContent, + type ECallReactionEventContent, ElementCallReactionEventType, GenericReaction, - ReactionOption, + type ReactionOption, ReactionSet, } from "./reactions"; import { useLatest } from "./useLatest"; diff --git a/src/useReactiveState.ts b/src/useReactiveState.ts index 76d8d410..2a58d33a 100644 --- a/src/useReactiveState.ts +++ b/src/useReactiveState.ts @@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details. */ import { - DependencyList, - Dispatch, - SetStateAction, + type DependencyList, + type Dispatch, + type SetStateAction, useCallback, useRef, useState, diff --git a/src/useTheme.test.ts b/src/useTheme.test.ts index 31822668..d0927b35 100644 --- a/src/useTheme.test.ts +++ b/src/useTheme.test.ts @@ -11,7 +11,7 @@ import { beforeEach, describe, expect, - Mock, + type Mock, test, vi, } from "vitest"; diff --git a/src/utils/matrix.ts b/src/utils/matrix.ts index 63b6ef67..abc49295 100644 --- a/src/utils/matrix.ts +++ b/src/utils/matrix.ts @@ -9,12 +9,12 @@ import { IndexedDBStore } from "matrix-js-sdk/src/store/indexeddb"; import { MemoryStore } from "matrix-js-sdk/src/store/memory"; import { createClient, - ICreateClientOpts, + type ICreateClientOpts, Preset, Visibility, } from "matrix-js-sdk/src/matrix"; import { ClientEvent } from "matrix-js-sdk/src/client"; -import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync"; +import { type ISyncStateData, type SyncState } from "matrix-js-sdk/src/sync"; import { logger } from "matrix-js-sdk/src/logger"; import { secureRandomBase64Url } from "matrix-js-sdk/src/randomstring"; @@ -24,7 +24,10 @@ import IndexedDBWorker from "../IndexedDBWorker?worker"; import { generateUrlSearchParams, getUrlParams } from "../UrlParams"; import { Config } from "../config/Config"; import { E2eeType } from "../e2ee/e2eeType"; -import { EncryptionSystem, saveKeyForRoom } from "../e2ee/sharedKeyManagement"; +import { + type EncryptionSystem, + saveKeyForRoom, +} from "../e2ee/sharedKeyManagement"; export const fallbackICEServerAllowed = import.meta.env.VITE_FALLBACK_STUN_ALLOWED === "true"; diff --git a/src/utils/observable.ts b/src/utils/observable.ts index dc804941..a54c0293 100644 --- a/src/utils/observable.ts +++ b/src/utils/observable.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { Observable, defer, finalize, scan, startWith, tap } from "rxjs"; +import { type Observable, defer, finalize, scan, startWith, tap } from "rxjs"; const nothing = Symbol("nothing"); diff --git a/src/utils/spa.ts b/src/utils/spa.ts index 37835259..ab3dbea5 100644 --- a/src/utils/spa.ts +++ b/src/utils/spa.ts @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { ICreateClientOpts } from "matrix-js-sdk/src/client"; +import { type ICreateClientOpts } from "matrix-js-sdk/src/client"; import { MatrixError } from "matrix-js-sdk/src/http-api"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/src/utils/test.ts b/src/utils/test.ts index 459a252e..ca6a5fce 100644 --- a/src/utils/test.ts +++ b/src/utils/test.ts @@ -4,29 +4,29 @@ Copyright 2023, 2024 New Vector Ltd. SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { map, Observable, of, SchedulerLike } from "rxjs"; -import { RunHelpers, TestScheduler } from "rxjs/testing"; +import { map, type Observable, of, type SchedulerLike } from "rxjs"; +import { type RunHelpers, TestScheduler } from "rxjs/testing"; import { expect, vi } from "vitest"; import { - RoomMember, - Room as MatrixRoom, + type RoomMember, + type Room as MatrixRoom, MatrixEvent, - Room, + type Room, TypedEventEmitter, } from "matrix-js-sdk/src/matrix"; import { CallMembership, - Focus, + type Focus, MatrixRTCSessionEvent, - MatrixRTCSessionEventHandlerMap, - SessionMembershipData, + type MatrixRTCSessionEventHandlerMap, + type SessionMembershipData, } from "matrix-js-sdk/src/matrixrtc"; import { - LocalParticipant, - LocalTrackPublication, - RemoteParticipant, - RemoteTrackPublication, - Room as LivekitRoom, + type LocalParticipant, + type LocalTrackPublication, + type RemoteParticipant, + type RemoteTrackPublication, + type Room as LivekitRoom, } from "livekit-client"; import { @@ -34,7 +34,10 @@ import { RemoteUserMediaViewModel, } from "../state/MediaViewModel"; import { E2eeType } from "../e2ee/e2eeType"; -import { DEFAULT_CONFIG, ResolvedConfigOptions } from "../config/ConfigOptions"; +import { + DEFAULT_CONFIG, + type ResolvedConfigOptions, +} from "../config/ConfigOptions"; import { Config } from "../config/Config"; export function withFakeTimers(continuation: () => void): void { diff --git a/src/utils/testReactions.tsx b/src/utils/testReactions.tsx index fec3e859..6fad030c 100644 --- a/src/utils/testReactions.tsx +++ b/src/utils/testReactions.tsx @@ -5,27 +5,27 @@ SPDX-License-Identifier: AGPL-3.0-only Please see LICENSE in the repository root for full details. */ -import { PropsWithChildren, ReactNode } from "react"; +import { type PropsWithChildren, type ReactNode } from "react"; import { randomUUID } from "crypto"; import EventEmitter from "events"; -import { MatrixClient } from "matrix-js-sdk/src/client"; +import { type MatrixClient } from "matrix-js-sdk/src/client"; import { EventType, RoomEvent, RelationType } from "matrix-js-sdk/src/matrix"; import { MatrixEvent, EventTimeline, EventTimelineSet, - Room, + type Room, } from "matrix-js-sdk/src/matrix"; import { - MatrixRTCSession, + type MatrixRTCSession, MatrixRTCSessionEvent, } from "matrix-js-sdk/src/matrixrtc"; import { ReactionsProvider } from "../useReactions"; import { - ECallReactionEventContent, + type ECallReactionEventContent, ElementCallReactionEventType, - ReactionOption, + type ReactionOption, } from "../reactions"; export const TestReactionsWrapper = ({