From 6c6bf811a6dfb9ceda89aeb0fd179f0568e94cd2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 16 Oct 2024 16:43:07 +0100 Subject: [PATCH] Migrate to stylistic Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .eslintrc.js | 2 ++ package.json | 3 +- playwright/e2e/read-receipts/index.ts | 2 +- .../spaces/threads-activity-centre/index.ts | 2 +- src/@types/common.ts | 2 ++ src/BasePlatform.ts | 4 +-- src/DraftCleaner.ts | 2 +- src/HtmlUtils.tsx | 6 ++-- src/LegacyCallHandler.tsx | 2 +- src/MatrixClientPeg.ts | 4 +-- src/PosthogAnalytics.ts | 2 +- src/Presence.ts | 2 +- src/RoomNotifs.ts | 2 +- src/ScalarMessaging.ts | 4 +-- src/SdkConfig.ts | 1 + src/SlidingSyncManager.ts | 6 ++-- src/UserActivity.ts | 2 +- src/components/structures/FileDropTarget.tsx | 7 ++-- .../structures/LegacyCallEventGrouper.ts | 8 +++-- src/components/structures/MatrixChat.tsx | 2 +- src/components/structures/SpaceHierarchy.tsx | 4 +-- src/components/structures/TimelinePanel.tsx | 4 +-- src/components/structures/UserMenu.tsx | 8 ++--- .../structures/auth/ForgotPassword.tsx | 2 +- src/components/structures/static-page-vars.ts | 2 +- src/components/views/avatars/WidgetAvatar.tsx | 2 ++ .../dialogs/AddExistingToSpaceDialog.tsx | 8 ++--- .../views/dialogs/ForwardDialog.tsx | 12 +++---- .../views/dialogs/ModalWidgetDialog.tsx | 8 ++--- src/components/views/dialogs/ShareDialog.tsx | 4 ++- .../security/AccessSecretStorageDialog.tsx | 2 +- .../security/RestoreKeyBackupDialog.tsx | 2 +- .../security/SetupEncryptionDialog.tsx | 2 ++ src/components/views/elements/AppWarning.tsx | 4 ++- src/components/views/elements/ReplyChain.tsx | 4 +-- src/components/views/elements/SSOButtons.tsx | 2 ++ src/components/views/location/Map.tsx | 10 +++--- .../views/messages/LegacyCallEvent.tsx | 2 +- src/components/views/messages/MFileBody.tsx | 2 +- .../views/messages/MStickerBody.tsx | 3 +- .../views/right_panel/EncryptionPanel.tsx | 6 ++-- src/components/views/right_panel/UserInfo.tsx | 2 +- src/components/views/rooms/MemberList.tsx | 10 ++---- .../views/rooms/MessageComposer.tsx | 3 +- src/components/views/rooms/RoomInfoLine.tsx | 2 +- src/components/views/rooms/Stickerpicker.tsx | 3 +- .../views/settings/AddPrivilegedUsers.tsx | 2 +- src/components/views/settings/SetIdServer.tsx | 2 +- .../settings/UserPersonalInfoSettings.tsx | 2 +- .../views/settings/UserProfileSettings.tsx | 2 +- .../settings/devices/DeviceDetailHeading.tsx | 2 +- .../settings/discovery/DiscoverySettings.tsx | 2 +- .../tabs/user/VoiceUserSettingsTab.tsx | 2 +- .../views/spaces/QuickThemeSwitcher.tsx | 2 +- .../views/spaces/SpaceTreeLevel.tsx | 2 +- .../user-onboarding/UserOnboardingHeader.tsx | 2 ++ src/customisations/Alias.ts | 1 + src/customisations/ComponentVisibility.ts | 1 + src/customisations/Directory.ts | 1 + src/customisations/Lifecycle.ts | 1 + src/customisations/RoomList.ts | 1 + src/customisations/WidgetPermissions.ts | 1 + src/customisations/WidgetVariables.ts | 2 ++ src/hooks/useLocalStorageState.ts | 2 +- src/languageHandler.tsx | 2 +- src/linkify-matrix.ts | 4 +-- src/models/LocalRoom.ts | 2 +- src/rageshake/rageshake.ts | 2 +- src/rageshake/submit-rageshake.ts | 12 +++---- src/sentry.ts | 6 ++-- src/settings/Settings.tsx | 1 + .../controllers/NotificationControllers.ts | 2 +- src/settings/handlers/LocalEchoWrapper.ts | 2 +- src/settings/handlers/RoomSettingsHandler.ts | 4 +-- src/stores/AsyncStore.ts | 6 ++-- src/stores/AsyncStoreWithClient.ts | 2 +- src/stores/MemberListStore.ts | 2 +- src/toasts/IncomingLegacyCallToast.tsx | 8 +++-- src/utils/EventUtils.ts | 4 +-- src/utils/FontManager.ts | 2 ++ src/utils/Singleflight.ts | 8 ++--- src/utils/StorageAccess.ts | 2 +- src/utils/WidgetUtils.ts | 2 +- src/utils/beacon/useOwnLiveBeacons.ts | 2 +- src/utils/createMatrixClient.ts | 2 +- .../snoozeBulkUnverifiedDeviceReminder.ts | 2 +- src/utils/exportUtils/Exporter.ts | 2 +- src/utils/image-media.ts | 2 +- src/utils/permalinks/Permalinks.ts | 6 ++-- src/utils/tokens/pickling.ts | 2 +- src/utils/tokens/tokens.ts | 4 +-- src/utils/tooltipify.tsx | 2 +- src/vector/getconfig.ts | 2 +- src/vector/index.ts | 2 ++ src/vector/jitsi/index.ts | 1 + src/vector/platform/ElectronPlatform.tsx | 10 +++--- .../audio/VoiceBroadcastRecorder.ts | 2 +- .../utils/retrieveStartedInfoEvent.ts | 2 +- src/widgets/Jitsi.ts | 2 +- test/setupTests.ts | 1 + test/test-utils/test-utils.ts | 4 +-- test/unit-tests/Terms-test.tsx | 1 - .../beacon/LeftPanelLiveShareWarning-test.tsx | 2 +- .../polls/pollHistory/PollListItem-test.tsx | 1 - .../views/rooms/MessageComposer-test.tsx | 4 +-- .../views/rooms/RoomHeader-test.tsx | 2 +- .../components/views/rooms/RoomList-test.tsx | 1 - .../views/rooms/RoomPreviewBar-test.tsx | 2 +- .../views/spaces/SpacePanel-test.tsx | 2 +- .../views/spaces/SpaceTreeLevel-test.tsx | 2 +- test/unit-tests/contexts/SdkContext-test.ts | 8 ++--- test/unit-tests/models/Call-test.ts | 12 +++---- .../stores/BreadcrumbsStore-test.ts | 4 +-- .../unit-tests/stores/OwnProfileStore-test.ts | 2 +- test/unit-tests/stores/RoomViewStore-test.ts | 2 +- .../stores/room-list/RoomListStore-test.ts | 1 - .../filters/SpaceFilterCondition-test.ts | 2 +- .../utils/MegolmExportEncryption-test.ts | 1 + test/unit-tests/utils/SessionLock-test.ts | 2 ++ test/unit-tests/utils/Singleflight-test.ts | 2 +- .../vector/platform/ElectronPlatform-test.ts | 4 ++- .../models/VoiceBroadcastPlayback-test.tsx | 6 +++- .../models/VoiceBroadcastRecording-test.ts | 6 ++-- yarn.lock | 35 ++++++++++++++++--- 124 files changed, 239 insertions(+), 196 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index cf034d1468..f4d92f1cf2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -198,6 +198,8 @@ module.exports = { "@typescript-eslint/ban-ts-comment": "off", // We're okay with assertion errors when we ask for them "@typescript-eslint/no-non-null-assertion": "off", + // We do this sometimes to brand interfaces + "@typescript-eslint/no-empty-object-type": "off", }, }, // temporary override for offending icon require files diff --git a/package.json b/package.json index c01dca81fa..0167a03278 100644 --- a/package.json +++ b/package.json @@ -186,6 +186,7 @@ "@playwright/test": "^1.40.1", "@principalstudio/html-webpack-inject-preload": "^1.2.7", "@sentry/webpack-plugin": "^2.7.1", + "@stylistic/eslint-plugin": "^2.9.0", "@svgr/webpack": "^8.0.0", "@testing-library/dom": "^9.0.0", "@testing-library/jest-dom": "^6.0.0", @@ -246,7 +247,7 @@ "eslint-plugin-import": "^2.25.4", "eslint-plugin-jest": "^28.0.0", "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-matrix-org": "1.2.1", + "eslint-plugin-matrix-org": "^2.0.2", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-unicorn": "^56.0.0", diff --git a/playwright/e2e/read-receipts/index.ts b/playwright/e2e/read-receipts/index.ts index 747717908b..49a0195fd7 100644 --- a/playwright/e2e/read-receipts/index.ts +++ b/playwright/e2e/read-receipts/index.ts @@ -69,7 +69,7 @@ export class MessageBuilder { /** * Map of message content -> event. */ - messages = new Map>>(); + messages = new Map>>(); /** * Utility to find a MatrixEvent by its body content diff --git a/playwright/e2e/spaces/threads-activity-centre/index.ts b/playwright/e2e/spaces/threads-activity-centre/index.ts index bf05fc34c1..f6ac7f95d6 100644 --- a/playwright/e2e/spaces/threads-activity-centre/index.ts +++ b/playwright/e2e/spaces/threads-activity-centre/index.ts @@ -70,7 +70,7 @@ export class MessageBuilder { /** * Map of message content -> event. */ - messages = new Map>>(); + messages = new Map>>(); /** * Utility to find a MatrixEvent by its body content diff --git a/src/@types/common.ts b/src/@types/common.ts index d0ab03221d..1331ba92b5 100644 --- a/src/@types/common.ts +++ b/src/@types/common.ts @@ -35,6 +35,7 @@ export type Defaultize = P extends any Partial>> : never; +/* eslint-disable @typescript-eslint/no-unsafe-function-type */ export type DeepReadonly = T extends (infer R)[] ? DeepReadonlyArray : T extends Function @@ -42,6 +43,7 @@ export type DeepReadonly = T extends (infer R)[] : T extends object ? DeepReadonlyObject : T; +/* eslint-enable @typescript-eslint/no-unsafe-function-type */ interface DeepReadonlyArray extends ReadonlyArray> {} diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index 20e9e7add3..8bbad339c7 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -129,7 +129,7 @@ export default abstract class BasePlatform { try { const [version, deferUntil] = JSON.parse(localStorage.getItem(UPDATE_DEFER_KEY)!); return newVersion !== version || Date.now() > deferUntil; - } catch (e) { + } catch { return true; } } @@ -380,7 +380,7 @@ export default abstract class BasePlatform { try { await idbSave("pickleKey", [userId, deviceId], data); - } catch (e) { + } catch { return null; } return encodeUnpaddedBase64(randomArray); diff --git a/src/DraftCleaner.ts b/src/DraftCleaner.ts index eebc7b87d0..48a3523f61 100644 --- a/src/DraftCleaner.ts +++ b/src/DraftCleaner.ts @@ -48,7 +48,7 @@ function shouldCleanupDrafts(): boolean { return true; } return Date.now() > parsedTimestamp + DRAFT_CLEANUP_PERIOD; - } catch (error) { + } catch { return true; } } diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index 8b0b73c692..3146a9eb07 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -52,7 +52,7 @@ export const EMOJI_REGEX = (() => { // want the app to completely crash on older platforms. We use the // constructor here to avoid a syntax error on such platforms. return new RegExp("\\p{RGI_Emoji}(?!\\uFE0E)(?:(? { const BIGEMOJI_REGEX = (() => { try { return new RegExp(`^(${EMOJI_REGEX.source})+$`, "iv"); - } catch (_e) { + } catch { // Fall back, just like for EMOJI_REGEX return /(?!)/; } @@ -120,7 +120,7 @@ export function isUrlPermitted(inputUrl: string): boolean { try { // URL parser protocol includes the trailing colon return PERMITTED_URL_SCHEMES.includes(new URL(inputUrl).protocol.slice(0, -1)); - } catch (e) { + } catch { return false; } } diff --git a/src/LegacyCallHandler.tsx b/src/LegacyCallHandler.tsx index ae14b31aed..a06480e9cd 100644 --- a/src/LegacyCallHandler.tsx +++ b/src/LegacyCallHandler.tsx @@ -827,7 +827,7 @@ export default class LegacyCallHandler extends EventEmitter { try { this.addCallForRoom(roomId, call); - } catch (e) { + } catch { Modal.createDialog(ErrorDialog, { title: _t("voip|already_in_call"), description: _t("voip|already_in_call_person"), diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 0ba2ec65d7..9804ab5d82 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -211,7 +211,7 @@ class MatrixClientPegClass implements IMatrixClientPeg { const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10); const diff = Date.now() - registrationTime; return diff / 36e5 <= hours; - } catch (e) { + } catch { return false; } } @@ -220,7 +220,7 @@ class MatrixClientPegClass implements IMatrixClientPeg { try { const registrationTime = parseInt(window.localStorage.getItem("mx_registration_time")!, 10); return timestamp.getTime() <= registrationTime; - } catch (e) { + } catch { return false; } } diff --git a/src/PosthogAnalytics.ts b/src/PosthogAnalytics.ts index 78d53e959d..28e37282a5 100644 --- a/src/PosthogAnalytics.ts +++ b/src/PosthogAnalytics.ts @@ -236,7 +236,7 @@ export class PosthogAnalytics { let appVersion: string | undefined; try { appVersion = await platform?.getAppVersion(); - } catch (e) { + } catch { // this happens if no version is set i.e. in dev appVersion = "unknown"; } diff --git a/src/Presence.ts b/src/Presence.ts index 3326dac96f..11a333ce04 100644 --- a/src/Presence.ts +++ b/src/Presence.ts @@ -36,7 +36,7 @@ class Presence { try { await this.unavailableTimer.finished(); this.setState(SetPresence.Unavailable); - } catch (e) { + } catch { /* aborted, stop got called */ } } diff --git a/src/RoomNotifs.ts b/src/RoomNotifs.ts index cc027c9682..7c281d0d2d 100644 --- a/src/RoomNotifs.ts +++ b/src/RoomNotifs.ts @@ -44,7 +44,7 @@ export function getRoomNotifsState(client: MatrixClient, roomId: string): RoomNo let roomRule: IPushRule | undefined; try { roomRule = client.getRoomPushRule("global", roomId); - } catch (err) { + } catch { // Possible that the client doesn't have pushRules yet. If so, it // hasn't started either, so indicate that this room is not notifying. return null; diff --git a/src/ScalarMessaging.ts b/src/ScalarMessaging.ts index d8092953f3..cac5b561a0 100644 --- a/src/ScalarMessaging.ts +++ b/src/ScalarMessaging.ts @@ -855,14 +855,14 @@ const onMessage = function (event: MessageEvent): void { try { if (!openManagerUrl) openManagerUrl = IntegrationManagers.sharedInstance().getPrimaryManager()?.uiUrl; configUrl = new URL(openManagerUrl!); - } catch (e) { + } catch { // No integrations UI URL, ignore silently. return; } let eventOriginUrl: URL; try { eventOriginUrl = new URL(event.origin); - } catch (e) { + } catch { return; } // TODO -- Scalar postMessage API should be namespaced with event.data.api field diff --git a/src/SdkConfig.ts b/src/SdkConfig.ts index abf9933e2b..cbec03381a 100644 --- a/src/SdkConfig.ts +++ b/src/SdkConfig.ts @@ -42,6 +42,7 @@ export const DEFAULTS: DeepReadonly = { // be preferred over their config. desktopBuilds: { available: true, + // eslint-disable-next-line @typescript-eslint/no-require-imports logo: require("../res/img/element-desktop-logo.svg").default, url: "https://element.io/get-started", }, diff --git a/src/SlidingSyncManager.ts b/src/SlidingSyncManager.ts index 578a175749..eeac10b603 100644 --- a/src/SlidingSyncManager.ts +++ b/src/SlidingSyncManager.ts @@ -252,7 +252,7 @@ export class SlidingSyncManager { try { // wait until the next sync before returning as RoomView may need to know the current state await p; - } catch (err) { + } catch { logger.warn("SlidingSync setRoomVisible:", roomId, visible, "failed to confirm transaction"); } return roomId; @@ -305,7 +305,7 @@ export class SlidingSyncManager { } else { await this.slidingSync!.setListRanges(SlidingSyncManager.ListSearch, ranges); } - } catch (err) { + } catch { // do nothing, as we reject only when we get interrupted but that's fine as the next // request will include our data } finally { @@ -357,7 +357,7 @@ export class SlidingSyncManager { } const clientWellKnown = await AutoDiscovery.findClientConfig(clientDomain); proxyUrl = clientWellKnown?.["org.matrix.msc3575.proxy"]?.url; - } catch (e) { + } catch { // Either client.getDomain() is null so we've shorted out, or is invalid so `AutoDiscovery.findClientConfig` has thrown } diff --git a/src/UserActivity.ts b/src/UserActivity.ts index 61f3c93ca9..a1a090ca0e 100644 --- a/src/UserActivity.ts +++ b/src/UserActivity.ts @@ -213,7 +213,7 @@ export default class UserActivity { attachedTimers.forEach((t) => t.start()); try { await timeout.finished(); - } catch (_e) { + } catch { /* aborted */ } attachedTimers.forEach((t) => t.abort()); diff --git a/src/components/structures/FileDropTarget.tsx b/src/components/structures/FileDropTarget.tsx index b815d9aa62..5bc16e2ee4 100644 --- a/src/components/structures/FileDropTarget.tsx +++ b/src/components/structures/FileDropTarget.tsx @@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details. import React, { useEffect, useState } from "react"; import { _t } from "../../languageHandler"; +import UploadBigSvg from "../../../res/img/upload-big.svg"; interface IProps { parent: HTMLElement | null; @@ -106,11 +107,7 @@ const FileDropTarget: React.FC = ({ parent, onFileDrop }) => { if (state.dragging) { return (
- + {_t("room|drop_file_prompt")}
); diff --git a/src/components/structures/LegacyCallEventGrouper.ts b/src/components/structures/LegacyCallEventGrouper.ts index d5c5a5a0fe..3eefbdbb87 100644 --- a/src/components/structures/LegacyCallEventGrouper.ts +++ b/src/components/structures/LegacyCallEventGrouper.ts @@ -161,9 +161,11 @@ export default class LegacyCallEventGrouper extends EventEmitter { public toggleSilenced = (): void => { const silenced = LegacyCallHandler.instance.isCallSilenced(this.callId); - silenced - ? LegacyCallHandler.instance.unSilenceCall(this.callId) - : LegacyCallHandler.instance.silenceCall(this.callId); + if (silenced) { + LegacyCallHandler.instance.unSilenceCall(this.callId); + } else { + LegacyCallHandler.instance.silenceCall(this.callId); + } }; private setCallListeners(): void { diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 0f122b2d5f..0d7251c864 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -982,7 +982,7 @@ export default class MatrixChat extends React.PureComponent { try { const config = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(params.hs_url); newState.serverConfig = config; - } catch (err) { + } catch { logger.warn("Failed to load hs_url param:", params.hs_url); } } else if (params.client_secret && params.session_id && params.hs_url && params.is_url && params.sid) { diff --git a/src/components/structures/SpaceHierarchy.tsx b/src/components/structures/SpaceHierarchy.tsx index dc16d248af..d12f66e9c7 100644 --- a/src/components/structures/SpaceHierarchy.tsx +++ b/src/components/structures/SpaceHierarchy.tsx @@ -691,7 +691,7 @@ const ManageButtons: React.FC = ({ hierarchy, selected, set hierarchy.removeRelation(parentId, childId); } - } catch (e) { + } catch { setError(_t("space|failed_remove_rooms")); } setRemoving(false); @@ -724,7 +724,7 @@ const ManageButtons: React.FC = ({ hierarchy, selected, set // mutate the local state to save us having to refetch the world existingContent.suggested = content.suggested; } - } catch (e) { + } catch { setError("Failed to update some suggestions. Try again later"); } setSaving(false); diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index f4c9b639ac..b55709e8c2 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -973,7 +973,7 @@ class TimelinePanel extends React.Component { UserActivity.sharedInstance().timeWhileActiveRecently(this.readMarkerActivityTimer); try { await this.readMarkerActivityTimer.finished(); - } catch (e) { + } catch { continue; /* aborted */ } // outside of try/catch to not swallow errors @@ -988,7 +988,7 @@ class TimelinePanel extends React.Component { UserActivity.sharedInstance().timeWhileActiveNow(this.readReceiptActivityTimer); try { await this.readReceiptActivityTimer.finished(); - } catch (e) { + } catch { continue; /* aborted */ } // outside of try/catch to not swallow errors diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 4bdb6e227b..971e07193b 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -44,6 +44,7 @@ import { Icon as LiveIcon } from "../../../res/img/compound/live-8px.svg"; import { VoiceBroadcastRecording, VoiceBroadcastRecordingsStoreEvent } from "../../voice-broadcast"; import { SDKContext } from "../../contexts/SDKContext"; import { shouldShowFeedback } from "../../utils/Feedback"; +import DarkLightModeSvg from "../../../res/img/element-icons/roomlist/dark-light-mode.svg"; interface IProps { isPanelCollapsed: boolean; @@ -414,12 +415,7 @@ export default class UserMenu extends React.Component { : _t("user_menu|switch_theme_dark") } > - + {topSection} diff --git a/src/components/structures/auth/ForgotPassword.tsx b/src/components/structures/auth/ForgotPassword.tsx index 0e5cfb0f38..e0a9318e9a 100644 --- a/src/components/structures/auth/ForgotPassword.tsx +++ b/src/components/structures/auth/ForgotPassword.tsx @@ -274,7 +274,7 @@ export default class ForgotPassword extends React.Component { await this.reset.setNewPassword(this.state.password); this.setState({ phase: Phase.Done }); modal.close(); - } catch (e) { + } catch { // Email not confirmed, yet. Retry after a while. await sleep(emailCheckInterval); } diff --git a/src/components/structures/static-page-vars.ts b/src/components/structures/static-page-vars.ts index 8cd2fd4a21..aaabfafa6d 100644 --- a/src/components/structures/static-page-vars.ts +++ b/src/components/structures/static-page-vars.ts @@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details. */ // We're importing via require specifically so the svg becomes a URI rather than a DOM element. -// eslint-disable-next-line @typescript-eslint/no-var-requires +// eslint-disable-next-line @typescript-eslint/no-require-imports const matrixSvg = require("../../../res/img/matrix.svg").default; /** diff --git a/src/components/views/avatars/WidgetAvatar.tsx b/src/components/views/avatars/WidgetAvatar.tsx index 171b1b78b4..bbb673a295 100644 --- a/src/components/views/avatars/WidgetAvatar.tsx +++ b/src/components/views/avatars/WidgetAvatar.tsx @@ -20,6 +20,7 @@ interface IProps extends Omit, "name" | "url" | " } const WidgetAvatar: React.FC = ({ app, className, size = "20px", ...props }) => { + /* eslint-disable @typescript-eslint/no-require-imports */ let iconUrls = [require("../../../../res/img/element-icons/room/default_app.svg").default]; // heuristics for some better icons until Widgets support their own icons if (app.type.includes("jitsi")) { @@ -31,6 +32,7 @@ const WidgetAvatar: React.FC = ({ app, className, size = "20px", ...prop } else if (app.type.includes("clock")) { iconUrls = [require("../../../../res/img/element-icons/room/default_clock.svg").default]; } + /* eslint-enable @typescript-eslint/no-require-imports */ return ( = ({ if (error) { footer = ( <> - +
diff --git a/src/components/views/dialogs/ForwardDialog.tsx b/src/components/views/dialogs/ForwardDialog.tsx index b8a7f9d500..6e9df055cd 100644 --- a/src/components/views/dialogs/ForwardDialog.tsx +++ b/src/components/views/dialogs/ForwardDialog.tsx @@ -23,6 +23,8 @@ import { TimelineEvents, } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; +// eslint-disable-next-line no-restricted-imports +import OverflowHorizontalSvg from "@vector-im/compound-design-tokens/icons/overflow-horizontal.svg"; import { _t } from "../../../languageHandler"; import dis from "../../../dispatcher/dispatcher"; @@ -104,7 +106,7 @@ const Entry: React.FC> = ({ room, type, content, matrixClient: try { await cli.sendEvent(room.roomId, type, content); setSendState(SendState.Sent); - } catch (e) { + } catch { setSendState(SendState.Failed); } }; @@ -278,13 +280,7 @@ const ForwardDialog: React.FC = ({ matrixClient: cli, event, permalinkCr return ( - } + avatarJsx={} name={text} showPresence={false} onClick={() => setTruncateAt(totalCount)} diff --git a/src/components/views/dialogs/ModalWidgetDialog.tsx b/src/components/views/dialogs/ModalWidgetDialog.tsx index 28f06927b5..90f330c625 100644 --- a/src/components/views/dialogs/ModalWidgetDialog.tsx +++ b/src/components/views/dialogs/ModalWidgetDialog.tsx @@ -33,6 +33,7 @@ import { arrayFastClone } from "../../../utils/arrays"; import { ElementWidget } from "../../../stores/widgets/StopGapWidget"; import { ELEMENT_CLIENT_ID } from "../../../identifiers"; import SettingsStore from "../../../settings/SettingsStore"; +import WarningBadgeSvg from "../../../../res/img/element-icons/warning-badge.svg"; interface IProps { widgetDefinition: IModalWidgetOpenRequestData; @@ -185,12 +186,7 @@ export default class ModalWidgetDialog extends React.PureComponent
- + {_t("widget|modal_data_warning", { widgetDomain: parsed.hostname, })} diff --git a/src/components/views/dialogs/ShareDialog.tsx b/src/components/views/dialogs/ShareDialog.tsx index 3369850b84..f9382227e4 100644 --- a/src/components/views/dialogs/ShareDialog.tsx +++ b/src/components/views/dialogs/ShareDialog.tsx @@ -21,11 +21,12 @@ import BaseDialog from "./BaseDialog"; import CopyableText from "../elements/CopyableText"; import { XOR } from "../../../@types/common"; +/* eslint-disable @typescript-eslint/no-require-imports */ const socials = [ { name: "Facebook", img: require("../../../../res/img/social/facebook.png"), - url: (url: String) => `https://www.facebook.com/sharer/sharer.php?u=${url}`, + url: (url: string) => `https://www.facebook.com/sharer/sharer.php?u=${url}`, }, { name: "Twitter", @@ -52,6 +53,7 @@ const socials = [ url: (url: string) => `mailto:?body=${url}`, }, ]; +/* eslint-enable @typescript-eslint/no-require-imports */ interface BaseProps { /** diff --git a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx index 412d88c704..50b728f4da 100644 --- a/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx +++ b/src/components/views/dialogs/security/AccessSecretStorageDialog.tsx @@ -107,7 +107,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent = (props) => { return (
- +
{props.errorMsg || "Error"} diff --git a/src/components/views/elements/ReplyChain.tsx b/src/components/views/elements/ReplyChain.tsx index 26d75b7e60..4eb3707031 100644 --- a/src/components/views/elements/ReplyChain.tsx +++ b/src/components/views/elements/ReplyChain.tsx @@ -140,7 +140,7 @@ export default class ReplyChain extends React.Component { const inReplyToEventId = getParentEventId(ev); if (!inReplyToEventId) return null; return await this.getEvent(inReplyToEventId); - } catch (e) { + } catch { return null; } } @@ -154,7 +154,7 @@ export default class ReplyChain extends React.Component { // ask the client to fetch the event we want using the context API, only interface to do so is to ask // for a timeline with that event, but once it is loaded we can use findEventById to look up the ev map await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(), eventId); - } catch (e) { + } catch { // if it fails catch the error and return early, there's no point trying to find the event in this case. // Return null as it is falsy and thus should be treated as an error (as the event cannot be resolved). return null; diff --git a/src/components/views/elements/SSOButtons.tsx b/src/components/views/elements/SSOButtons.tsx index 30da0f5829..e2fd92e97b 100644 --- a/src/components/views/elements/SSOButtons.tsx +++ b/src/components/views/elements/SSOButtons.tsx @@ -33,6 +33,7 @@ interface ISSOButtonProps extends IProps { const getIcon = (brand: IdentityProviderBrand | string): string | null => { switch (brand) { + /* eslint-disable @typescript-eslint/no-require-imports */ case IdentityProviderBrand.Apple: return require(`../../../../res/img/element-icons/brands/apple.svg`).default; case IdentityProviderBrand.Facebook: @@ -47,6 +48,7 @@ const getIcon = (brand: IdentityProviderBrand | string): string | null => { return require(`../../../../res/img/element-icons/brands/twitter.svg`).default; default: return null; + /* eslint-enable @typescript-eslint/no-require-imports */ } }; diff --git a/src/components/views/location/Map.tsx b/src/components/views/location/Map.tsx index 1ac22b9e88..6ba25662e8 100644 --- a/src/components/views/location/Map.tsx +++ b/src/components/views/location/Map.tsx @@ -66,8 +66,8 @@ const useMapWithStyle = ({ throw new Error("Invalid geo URI"); } map.setCenter({ lon: coords.longitude, lat: coords.latitude }); - } catch (_error) { - logger.error("Could not set map center"); + } catch (e) { + logger.error("Could not set map center", e); } } }, [map, centerGeoUri]); @@ -80,8 +80,8 @@ const useMapWithStyle = ({ [bounds.east, bounds.north], ); map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 }); - } catch (_error) { - logger.error("Invalid map bounds"); + } catch (e) { + logger.error("Invalid map bounds", e); } } }, [map, bounds]); @@ -170,7 +170,7 @@ const MapComponent: React.FC = ({ return; } - onClick && onClick(); + onClick?.(); }; return ( diff --git a/src/components/views/messages/LegacyCallEvent.tsx b/src/components/views/messages/LegacyCallEvent.tsx index 4be933c295..3f24459b5b 100644 --- a/src/components/views/messages/LegacyCallEvent.tsx +++ b/src/components/views/messages/LegacyCallEvent.tsx @@ -55,7 +55,7 @@ export default class LegacyCallEvent extends React.PureComponent this.props.callEventGrouper.addListener(LegacyCallEventGrouperEvent.LengthChanged, this.onLengthChanged); this.resizeObserver = new ResizeObserver(this.resizeObserverCallback); - this.wrapperElement.current && this.resizeObserver.observe(this.wrapperElement.current); + if (this.wrapperElement.current) this.resizeObserver.observe(this.wrapperElement.current); } public componentWillUnmount(): void { diff --git a/src/components/views/messages/MFileBody.tsx b/src/components/views/messages/MFileBody.tsx index 549c6ed251..fde3ea0184 100644 --- a/src/components/views/messages/MFileBody.tsx +++ b/src/components/views/messages/MFileBody.tsx @@ -27,7 +27,7 @@ export let DOWNLOAD_ICON_URL: string; // cached copy of the download.svg asset f async function cacheDownloadIcon(): Promise { if (DOWNLOAD_ICON_URL) return; // cached already - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports const svg = await fetch(require("@vector-im/compound-design-tokens/icons/download.svg").default).then((r) => r.text(), ); diff --git a/src/components/views/messages/MStickerBody.tsx b/src/components/views/messages/MStickerBody.tsx index 50b7e69d40..b1638d5b31 100644 --- a/src/components/views/messages/MStickerBody.tsx +++ b/src/components/views/messages/MStickerBody.tsx @@ -11,6 +11,7 @@ import { MediaEventContent } from "matrix-js-sdk/src/types"; import MImageBody from "./MImageBody"; import { BLURHASH_FIELD } from "../../../utils/image-media"; +import IconsShowStickersSvg from "../../../../res/img/icons-show-stickers.svg"; export default class MStickerBody extends MImageBody { // Mostly empty to prevent default behaviour of MImageBody @@ -44,7 +45,7 @@ export default class MStickerBody extends MImageBody { aria-hidden alt="" className="mx_MStickerBody_placeholder" - src={require("../../../../res/img/icons-show-stickers.svg").default} + src={IconsShowStickersSvg} width="80" height="80" onMouseEnter={this.onImageEnter} diff --git a/src/components/views/right_panel/EncryptionPanel.tsx b/src/components/views/right_panel/EncryptionPanel.tsx index 37aad94f00..47fb995c20 100644 --- a/src/components/views/right_panel/EncryptionPanel.tsx +++ b/src/components/views/right_panel/EncryptionPanel.tsx @@ -21,6 +21,8 @@ import { RightPanelPhases } from "../../../stores/right-panel/RightPanelStorePha import RightPanelStore from "../../../stores/right-panel/RightPanelStore"; import ErrorDialog from "../dialogs/ErrorDialog"; import { useMatrixClientContext } from "../../../contexts/MatrixClientContext"; +import WarningDeprecatedSvg from "../../../../res/img/e2e/warning-deprecated.svg"; +import WarningSvg from "../../../../res/img/e2e/warning.svg"; // cancellation codes which constitute a key mismatch const MISMATCHES = ["m.key_mismatch", "m.user_error", "m.mismatched_sas"]; @@ -79,7 +81,7 @@ const EncryptionPanel: React.FC = (props: IProps) => { ) { isShowingMismatchModal.current = true; Modal.createDialog(ErrorDialog, { - headerImage: require("../../../../res/img/e2e/warning-deprecated.svg").default, + headerImage: WarningDeprecatedSvg, title: _t("encryption|messages_not_secure|title"), description: (
@@ -118,7 +120,7 @@ const EncryptionPanel: React.FC = (props: IProps) => { setRequesting(false); Modal.createDialog(ErrorDialog, { - headerImage: require("../../../../res/img/e2e/warning.svg").default, + headerImage: WarningSvg, title: _t("encryption|verification|error_starting_title"), description: _t("encryption|verification|error_starting_description"), }); diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 73bb818bb5..bb03066b88 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -1356,7 +1356,7 @@ export const useDevices = (userId: string): IDevice[] | undefined | null => { disambiguateDevices(devices); setDevices(devices); - } catch (err) { + } catch { setDevices(null); } } diff --git a/src/components/views/rooms/MemberList.tsx b/src/components/views/rooms/MemberList.tsx index ace2010e5f..993a2ba1f1 100644 --- a/src/components/views/rooms/MemberList.tsx +++ b/src/components/views/rooms/MemberList.tsx @@ -27,6 +27,8 @@ import { KnownMembership } from "matrix-js-sdk/src/types"; import { throttle } from "lodash"; import { Button, Tooltip } from "@vector-im/compound-web"; import UserAddIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-add-solid"; +// eslint-disable-next-line no-restricted-imports +import OverflowHorizontalSvg from "@vector-im/compound-design-tokens/icons/overflow-horizontal.svg"; import { _t } from "../../../languageHandler"; import dis from "../../../dispatcher/dispatcher"; @@ -237,13 +239,7 @@ export default class MemberList extends React.Component { return ( - } + avatarJsx={} name={text} showPresence={false} onClick={onClick} diff --git a/src/components/views/rooms/MessageComposer.tsx b/src/components/views/rooms/MessageComposer.tsx index e1677a179e..e44265b947 100644 --- a/src/components/views/rooms/MessageComposer.tsx +++ b/src/components/views/rooms/MessageComposer.tsx @@ -57,6 +57,7 @@ import { VoiceBroadcastInfoState } from "../../../voice-broadcast"; import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog"; import { UIFeature } from "../../../settings/UIFeature"; import { formatTimeLeft } from "../../../DateUtils"; +import RoomReplacedSvg from "../../../../res/img/room_replaced.svg"; // The prefix used when persisting editor drafts to localstorage. export const WYSIWYG_EDITOR_STATE_STORAGE_PREFIX = "mx_wysiwyg_state_"; @@ -619,7 +620,7 @@ export class MessageComposer extends React.Component { aria-hidden alt="" className="mx_MessageComposer_roomReplaced_icon" - src={require("../../../../res/img/room_replaced.svg").default} + src={RoomReplacedSvg} /> {_t("composer|room_upgraded_notice")} diff --git a/src/components/views/rooms/RoomInfoLine.tsx b/src/components/views/rooms/RoomInfoLine.tsx index 5d570abb9a..710ef61758 100644 --- a/src/components/views/rooms/RoomInfoLine.tsx +++ b/src/components/views/rooms/RoomInfoLine.tsx @@ -29,7 +29,7 @@ const RoomInfoLine: FC = ({ room }) => { if (room.getMyMembership() !== KnownMembership.Invite) return null; try { return await room.client.getRoomSummary(room.roomId); - } catch (e) { + } catch { return null; } }, [room]); diff --git a/src/components/views/rooms/Stickerpicker.tsx b/src/components/views/rooms/Stickerpicker.tsx index a930fb897b..1cd39999dc 100644 --- a/src/components/views/rooms/Stickerpicker.tsx +++ b/src/components/views/rooms/Stickerpicker.tsx @@ -26,6 +26,7 @@ import ScalarAuthClient from "../../../ScalarAuthClient"; import GenericElementContextMenu from "../context_menus/GenericElementContextMenu"; import RightPanelStore from "../../../stores/right-panel/RightPanelStore"; import { UPDATE_EVENT } from "../../../stores/AsyncStore"; +import StickerpackPlaceholderSvg from "../../../../res/img/stickerpack-placeholder.png"; // This should be below the dialog level (4000), but above the rest of the UI (1000-2000). // We sit in a context menu, so this should be given to the context menu. @@ -206,7 +207,7 @@ export default class Stickerpicker extends React.PureComponent {

{_t("stickers|empty")}

{_t("stickers|empty_add_prompt")}

- +
); } diff --git a/src/components/views/settings/AddPrivilegedUsers.tsx b/src/components/views/settings/AddPrivilegedUsers.tsx index 060ea0c9f2..c19c8fdddc 100644 --- a/src/components/views/settings/AddPrivilegedUsers.tsx +++ b/src/components/views/settings/AddPrivilegedUsers.tsx @@ -57,7 +57,7 @@ export const AddPrivilegedUsers: React.FC = ({ room, de await client.setPowerLevel(room.roomId, userIds, powerLevel); setSelectedUsers([]); setPowerLevel(defaultUserLevel); - } catch (error) { + } catch { Modal.createDialog(ErrorDialog, { title: _t("common|error"), description: _t("error|update_power_level"), diff --git a/src/components/views/settings/SetIdServer.tsx b/src/components/views/settings/SetIdServer.tsx index 5b6645b164..7a766cb5fb 100644 --- a/src/components/views/settings/SetIdServer.tsx +++ b/src/components/views/settings/SetIdServer.tsx @@ -52,7 +52,7 @@ async function checkIdentityServerUrl(u: string): Promise { } else { return _t("identity_server|error_connection"); } - } catch (e) { + } catch { return _t("identity_server|error_connection"); } } diff --git a/src/components/views/settings/UserPersonalInfoSettings.tsx b/src/components/views/settings/UserPersonalInfoSettings.tsx index 151f54cedd..c8c8729817 100644 --- a/src/components/views/settings/UserPersonalInfoSettings.tsx +++ b/src/components/views/settings/UserPersonalInfoSettings.tsx @@ -61,7 +61,7 @@ export const UserPersonalInfoSettings: React.FC = setEmails(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Email)); setPhoneNumbers(threepids.threepids.filter((a) => a.medium === ThreepidMedium.Phone)); setLoadingState("loaded"); - } catch (e) { + } catch { setLoadingState("error"); } }, [client]); diff --git a/src/components/views/settings/UserProfileSettings.tsx b/src/components/views/settings/UserProfileSettings.tsx index 18cd0870e0..403b6349c9 100644 --- a/src/components/views/settings/UserProfileSettings.tsx +++ b/src/components/views/settings/UserProfileSettings.tsx @@ -156,7 +156,7 @@ const UserProfileSettings: React.FC = ({ const { content_uri: uri } = await client.uploadContent(avatarFile); await client.setAvatarUrl(uri); setAvatarURL(uri); - } catch (e) { + } catch { setAvatarError(true); } finally { removeToast(); diff --git a/src/components/views/settings/devices/DeviceDetailHeading.tsx b/src/components/views/settings/devices/DeviceDetailHeading.tsx index 23ecdbc39c..86c9b929cf 100644 --- a/src/components/views/settings/devices/DeviceDetailHeading.tsx +++ b/src/components/views/settings/devices/DeviceDetailHeading.tsx @@ -40,7 +40,7 @@ const DeviceNameEditor: React.FC void }> = ({ devic try { await saveDeviceName(deviceName); stopEditing(); - } catch (error) { + } catch { setError(_t("settings|sessions|error_set_name")); setIsLoading(false); } diff --git a/src/components/views/settings/discovery/DiscoverySettings.tsx b/src/components/views/settings/discovery/DiscoverySettings.tsx index 1b6b299993..d240d53d7c 100644 --- a/src/components/views/settings/discovery/DiscoverySettings.tsx +++ b/src/components/views/settings/discovery/DiscoverySettings.tsx @@ -126,7 +126,7 @@ export const DiscoverySettings: React.FC = () => { ); logger.warn(e); } - } catch (e) {} + } catch {} })(); }, [client, getThreepidState]); diff --git a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx index 2b63336fa7..4abe6615d1 100644 --- a/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/VoiceUserSettingsTab.tsx @@ -101,7 +101,7 @@ export default class VoiceUserSettingsTab extends React.Component<{}, IState> { this.setState({ [kind]: deviceId }); try { await MediaDeviceHandler.instance.setDevice(deviceId, kind); - } catch (error) { + } catch { logger.error(`Failed to set device ${kind}: ${deviceId}`); // reset state to current value this.setState({ [kind]: mapDeviceKindToHandlerValue(kind) }); diff --git a/src/components/views/spaces/QuickThemeSwitcher.tsx b/src/components/views/spaces/QuickThemeSwitcher.tsx index 7e3627dd18..195fcb9899 100644 --- a/src/components/views/spaces/QuickThemeSwitcher.tsx +++ b/src/components/views/spaces/QuickThemeSwitcher.tsx @@ -63,7 +63,7 @@ const QuickThemeSwitcher: React.FC = ({ requestClose }) => { SettingsStore.setValue("use_system_theme", null, SettingLevel.DEVICE, false), ]); } - } catch (_error) { + } catch { dis.dispatch({ action: Action.RecheckTheme }); } diff --git a/src/components/views/spaces/SpaceTreeLevel.tsx b/src/components/views/spaces/SpaceTreeLevel.tsx index edbce66a74..1cb6006228 100644 --- a/src/components/views/spaces/SpaceTreeLevel.tsx +++ b/src/components/views/spaces/SpaceTreeLevel.tsx @@ -176,7 +176,7 @@ interface IItemProps extends InputHTMLAttributes { activeSpaces: SpaceKey[]; isNested?: boolean; isPanelCollapsed?: boolean; - onExpand?: Function; + onExpand?: () => void; parents?: Set; innerRef?: LegacyRef; dragHandleProps?: DraggableProvidedDragHandleProps | null; diff --git a/src/components/views/user-onboarding/UserOnboardingHeader.tsx b/src/components/views/user-onboarding/UserOnboardingHeader.tsx index 42ad147b02..1f6edbff1d 100644 --- a/src/components/views/user-onboarding/UserOnboardingHeader.tsx +++ b/src/components/views/user-onboarding/UserOnboardingHeader.tsx @@ -34,6 +34,7 @@ export function UserOnboardingHeader({ useCase }: Props): JSX.Element { let actionLabel: string; switch (useCase) { + /* eslint-disable @typescript-eslint/no-require-imports */ case UseCase.PersonalMessaging: title = _t("onboarding|personal_messaging_title"); image = require("../../../../res/img/user-onboarding/PersonalMessaging.png"); @@ -60,6 +61,7 @@ export function UserOnboardingHeader({ useCase }: Props): JSX.Element { image = require("../../../../res/img/user-onboarding/PersonalMessaging.png"); actionLabel = _t("onboarding|personal_messaging_action"); break; + /* eslint-enable @typescript-eslint/no-require-imports */ } return ( diff --git a/src/customisations/Alias.ts b/src/customisations/Alias.ts index 414f62681e..58be28ced8 100644 --- a/src/customisations/Alias.ts +++ b/src/customisations/Alias.ts @@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only Please see LICENSE files in the repository root for full details. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function getDisplayAliasForAliasSet(canonicalAlias: string | null, altAliases: string[]): string | null { // E.g. prefer one of the aliases over another return null; diff --git a/src/customisations/ComponentVisibility.ts b/src/customisations/ComponentVisibility.ts index e475d3b242..44464169f5 100644 --- a/src/customisations/ComponentVisibility.ts +++ b/src/customisations/ComponentVisibility.ts @@ -24,6 +24,7 @@ import { UIComponent } from "../settings/UIFeature"; * @returns {boolean} True (default) if the user is able to see the component, false * otherwise. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function shouldShowComponent(component: UIComponent): boolean { return true; // default to visible } diff --git a/src/customisations/Directory.ts b/src/customisations/Directory.ts index ca92c1d66e..445863eaec 100644 --- a/src/customisations/Directory.ts +++ b/src/customisations/Directory.ts @@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only Please see LICENSE files in the repository root for full details. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function requireCanonicalAliasAccessToPublish(): boolean { // Some environments may not care about this requirement and could return false return true; diff --git a/src/customisations/Lifecycle.ts b/src/customisations/Lifecycle.ts index 148b03c819..d76275e23a 100644 --- a/src/customisations/Lifecycle.ts +++ b/src/customisations/Lifecycle.ts @@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only Please see LICENSE files in the repository root for full details. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function onLoggedOutAndStorageCleared(): void { // E.g. redirect user or call other APIs after logout } diff --git a/src/customisations/RoomList.ts b/src/customisations/RoomList.ts index 917883f633..e2c2088dad 100644 --- a/src/customisations/RoomList.ts +++ b/src/customisations/RoomList.ts @@ -21,6 +21,7 @@ import { Room } from "matrix-js-sdk/src/matrix"; * @param {Room} room The room to check the visibility of. * @returns {boolean} True if the room should be visible, false otherwise. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function isRoomVisible(room: Room): boolean { return true; } diff --git a/src/customisations/WidgetPermissions.ts b/src/customisations/WidgetPermissions.ts index efdffd65b3..fa46e032dc 100644 --- a/src/customisations/WidgetPermissions.ts +++ b/src/customisations/WidgetPermissions.ts @@ -21,6 +21,7 @@ import { Capability, Widget } from "matrix-widget-api"; * @returns {Set} Resolves to the capabilities that are approved for use * by the widget. If none are approved, this should return an empty Set. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars async function preapproveCapabilities( widget: Widget, requestedCapabilities: Set, diff --git a/src/customisations/WidgetVariables.ts b/src/customisations/WidgetVariables.ts index 2d0e669e34..a6235b721b 100644 --- a/src/customisations/WidgetVariables.ts +++ b/src/customisations/WidgetVariables.ts @@ -17,6 +17,7 @@ import { ITemplateParams } from "matrix-widget-api"; * This will not be called until after isReady() resolves. * @returns {Partial>} The variables. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars function provideVariables(): Partial> { return {}; } @@ -26,6 +27,7 @@ function provideVariables(): Partial> { * to be provided. This will block widgets being rendered. * @returns {Promise} Resolves when ready. */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars async function isReady(): Promise { return; // default no waiting } diff --git a/src/hooks/useLocalStorageState.ts b/src/hooks/useLocalStorageState.ts index c09ea748ae..b926033e47 100644 --- a/src/hooks/useLocalStorageState.ts +++ b/src/hooks/useLocalStorageState.ts @@ -12,7 +12,7 @@ const getValue = (key: string, initialValue: T): T => { try { const item = window.localStorage.getItem(key); return item ? JSON.parse(item) : initialValue; - } catch (error) { + } catch { return initialValue; } }; diff --git a/src/languageHandler.tsx b/src/languageHandler.tsx index 28d6dbd3b3..dedcb60dcd 100644 --- a/src/languageHandler.tsx +++ b/src/languageHandler.tsx @@ -376,7 +376,7 @@ export function replaceByRegexes(text: string, mapping: IVariables | Tags): stri let replaced: SubstitutionValue; // If substitution is a function, call it if (mapping[regexpString] instanceof Function) { - replaced = ((mapping as Tags)[regexpString] as Function)(...capturedGroups); + replaced = ((mapping as Tags)[regexpString] as (...subs: string[]) => string)(...capturedGroups); } else { replaced = mapping[regexpString]; } diff --git a/src/linkify-matrix.ts b/src/linkify-matrix.ts index c63241c1e9..0d129ff952 100644 --- a/src/linkify-matrix.ts +++ b/src/linkify-matrix.ts @@ -148,7 +148,7 @@ export const options: Opts = { }; } } - } catch (e) { + } catch { // OK fine, it's not actually a permalink } break; @@ -215,7 +215,7 @@ export const options: Opts = { } else { return "_blank"; } - } catch (e) { + } catch { // malformed URI } } diff --git a/src/models/LocalRoom.ts b/src/models/LocalRoom.ts index d19ff0a0cc..f1f8dde1cd 100644 --- a/src/models/LocalRoom.ts +++ b/src/models/LocalRoom.ts @@ -31,7 +31,7 @@ export class LocalRoom extends Room { /** DM chat partner */ public targets: Member[] = []; /** Callbacks that should be invoked after the actual room has been created. */ - public afterCreateCallbacks: Function[] = []; + public afterCreateCallbacks: ((roomId: string) => void)[] = []; public state: LocalRoomState = LocalRoomState.NEW; public constructor(roomId: string, client: MatrixClient, myUserId: string) { diff --git a/src/rageshake/rageshake.ts b/src/rageshake/rageshake.ts index 54cd514b9b..763df51d95 100644 --- a/src/rageshake/rageshake.ts +++ b/src/rageshake/rageshake.ts @@ -525,7 +525,7 @@ export function tryInitStorage(): Promise { let indexedDB; try { indexedDB = window.indexedDB; - } catch (e) {} + } catch {} if (indexedDB) { global.mx_rage_store = new IndexedDBLogStore(indexedDB, global.mx_rage_logger); diff --git a/src/rageshake/submit-rageshake.ts b/src/rageshake/submit-rageshake.ts index c80b659ad3..ec529336d1 100644 --- a/src/rageshake/submit-rageshake.ts +++ b/src/rageshake/submit-rageshake.ts @@ -68,7 +68,7 @@ export async function collectBugReport(opts: IOpts = {}, gzipLogs = true): Promi async function getAppVersion(): Promise { try { return await PlatformPeg.get()?.getAppVersion(); - } catch (err) { + } catch { // this happens if no version is set i.e. in dev } } @@ -76,7 +76,7 @@ async function getAppVersion(): Promise { function matchesMediaQuery(query: string): string { try { return String(window.matchMedia(query).matches); - } catch (err) { + } catch { // if not supported in browser } return "UNKNOWN"; @@ -249,12 +249,12 @@ async function collectStorageStatInfo(body: FormData): Promise { if (navigator.storage && navigator.storage.persisted) { try { body.append("storageManager_persisted", String(await navigator.storage.persisted())); - } catch (e) {} + } catch {} } else if (document.hasStorageAccess) { // Safari try { body.append("storageManager_persisted", String(await document.hasStorageAccess())); - } catch (e) {} + } catch {} } if (navigator.storage && navigator.storage.estimate) { try { @@ -266,7 +266,7 @@ async function collectStorageStatInfo(body: FormData): Promise { body.append(`storageManager_usage_${k}`, String(estimate.usageDetails![k])); }); } - } catch (e) {} + } catch {} } } @@ -402,7 +402,7 @@ export async function submitFeedback( let version: string | undefined; try { version = await PlatformPeg.get()?.getAppVersion(); - } catch (err) {} // PlatformPeg already logs this. + } catch {} // PlatformPeg already logs this. const body = new FormData(); if (label) body.append("label", label); diff --git a/src/sentry.ts b/src/sentry.ts index 36c640ccd6..c454fed7ed 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -68,12 +68,12 @@ async function getStorageContext(): Promise { if (navigator.storage && navigator.storage.persisted) { try { result["storageManager_persisted"] = String(await navigator.storage.persisted()); - } catch (e) {} + } catch {} } else if (document.hasStorageAccess) { // Safari try { result["storageManager_persisted"] = String(await document.hasStorageAccess()); - } catch (e) {} + } catch {} } if (navigator.storage && navigator.storage.estimate) { try { @@ -87,7 +87,7 @@ async function getStorageContext(): Promise { }); result[`storageManager_usage`] = usageDetails.join(", "); } - } catch (e) {} + } catch {} } return result; diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 4f788ee224..1c27f03e88 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -227,6 +227,7 @@ export const SETTINGS: { [setting: string]: ISetting } = { ), feedbackLabel: "video-room-feedback", feedbackSubheading: _td("labs|video_rooms_feedbackSubheading"), + // eslint-disable-next-line @typescript-eslint/no-require-imports image: require("../../res/img/betas/video_rooms.png"), requiresRefresh: true, }, diff --git a/src/settings/controllers/NotificationControllers.ts b/src/settings/controllers/NotificationControllers.ts index 306736f404..da3ef6d859 100644 --- a/src/settings/controllers/NotificationControllers.ts +++ b/src/settings/controllers/NotificationControllers.ts @@ -34,7 +34,7 @@ export function isPushNotifyDisabled(): boolean { function getNotifier(): any { // TODO: [TS] Formal type that doesn't cause a cyclical reference. - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports let Notifier = require("../../Notifier"); // avoids cyclical references if (Notifier.default) Notifier = Notifier.default; // correct for webpack require() weirdness return Notifier; diff --git a/src/settings/handlers/LocalEchoWrapper.ts b/src/settings/handlers/LocalEchoWrapper.ts index 93266d3580..7d5050c9b8 100644 --- a/src/settings/handlers/LocalEchoWrapper.ts +++ b/src/settings/handlers/LocalEchoWrapper.ts @@ -57,7 +57,7 @@ export default class LocalEchoWrapper extends SettingsHandler { try { await handlerPromise; - } catch (e) { + } catch { // notify of a rollback this.handler.watchers?.notifyUpdate(settingName, roomId, this.level, currentValue); } finally { diff --git a/src/settings/handlers/RoomSettingsHandler.ts b/src/settings/handlers/RoomSettingsHandler.ts index f831cf19e1..d67acf5d0f 100644 --- a/src/settings/handlers/RoomSettingsHandler.ts +++ b/src/settings/handlers/RoomSettingsHandler.ts @@ -16,9 +16,7 @@ import { SettingLevel } from "../SettingLevel"; import { WatchManager } from "../WatchManager"; const DEFAULT_SETTINGS_EVENT_TYPE = "im.vector.web.settings"; -const PREVIEW_URLS_EVENT_TYPE = "org.matrix.room.preview_urls"; - -type RoomSettingsEventType = typeof DEFAULT_SETTINGS_EVENT_TYPE | typeof PREVIEW_URLS_EVENT_TYPE; +type RoomSettingsEventType = typeof DEFAULT_SETTINGS_EVENT_TYPE | "org.matrix.room.preview_urls"; /** * Gets and sets settings at the "room" level. diff --git a/src/stores/AsyncStore.ts b/src/stores/AsyncStore.ts index ddafb239e3..5697969a1d 100644 --- a/src/stores/AsyncStore.ts +++ b/src/stores/AsyncStore.ts @@ -34,7 +34,7 @@ export const UPDATE_EVENT = "update"; * To update the state, use updateState() and preferably await the result to * help prevent lock conflicts. */ -export abstract class AsyncStore extends EventEmitter { +export abstract class AsyncStore extends EventEmitter { private storeState: Readonly; private lock = new AwaitLock(); private readonly dispatcherRef: string; @@ -72,7 +72,7 @@ export abstract class AsyncStore extends EventEmitter { * Updates the state of the store. * @param {T|*} newState The state to update in the store using Object.assign() */ - protected async updateState(newState: T | Object): Promise { + protected async updateState(newState: T | object): Promise { await this.lock.acquireAsync(); try { this.storeState = Object.freeze(Object.assign({}, this.storeState, newState)); @@ -87,7 +87,7 @@ export abstract class AsyncStore extends EventEmitter { * @param {T|*} newState The new state of the store. * @param {boolean} quiet If true, the function will not raise an UPDATE_EVENT. */ - protected async reset(newState: T | Object | null = null, quiet = false): Promise { + protected async reset(newState: T | object | null = null, quiet = false): Promise { await this.lock.acquireAsync(); try { this.storeState = Object.freeze((newState || {})); diff --git a/src/stores/AsyncStoreWithClient.ts b/src/stores/AsyncStoreWithClient.ts index 7567eac9ac..418143a16c 100644 --- a/src/stores/AsyncStoreWithClient.ts +++ b/src/stores/AsyncStoreWithClient.ts @@ -13,7 +13,7 @@ import { ActionPayload } from "../dispatcher/payloads"; import { ReadyWatchingStore } from "./ReadyWatchingStore"; import { MatrixDispatcher } from "../dispatcher/dispatcher"; -export abstract class AsyncStoreWithClient extends AsyncStore { +export abstract class AsyncStoreWithClient extends AsyncStore { protected readyStore: ReadyWatchingStore; protected constructor(dispatcher: MatrixDispatcher, initialState: T = {}) { diff --git a/src/stores/MemberListStore.ts b/src/stores/MemberListStore.ts index d6d53b7a02..1455a4526f 100644 --- a/src/stores/MemberListStore.ts +++ b/src/stores/MemberListStore.ts @@ -90,7 +90,7 @@ export class MemberListStore { // load using traditional lazy loading try { await room.loadMembersIfNeeded(); - } catch (ex) { + } catch { /* already logged in RoomView */ } } diff --git a/src/toasts/IncomingLegacyCallToast.tsx b/src/toasts/IncomingLegacyCallToast.tsx index 2610477b05..bed46a0075 100644 --- a/src/toasts/IncomingLegacyCallToast.tsx +++ b/src/toasts/IncomingLegacyCallToast.tsx @@ -77,9 +77,11 @@ export default class IncomingLegacyCallToast extends React.Component { e.stopPropagation(); const callId = this.props.call.callId; - this.state.silenced - ? LegacyCallHandler.instance.unSilenceCall(callId) - : LegacyCallHandler.instance.silenceCall(callId); + if (this.state.silenced) { + LegacyCallHandler.instance.unSilenceCall(callId); + } else { + LegacyCallHandler.instance.silenceCall(callId); + } }; public render(): React.ReactNode { diff --git a/src/utils/EventUtils.ts b/src/utils/EventUtils.ts index 52a9652a6e..7c5b80697b 100644 --- a/src/utils/EventUtils.ts +++ b/src/utils/EventUtils.ts @@ -223,7 +223,7 @@ export async function fetchInitialEvent( try { const eventData = await client.fetchRoomEvent(roomId, eventId); initialEvent = new MatrixEvent(eventData); - } catch (e) { + } catch { logger.warn("Could not find initial event: " + eventId); initialEvent = null; } @@ -235,7 +235,7 @@ export async function fetchInitialEvent( const rootEvent = room?.findEventById(threadId) ?? mapper(await client.fetchRoomEvent(roomId, threadId)); try { room?.createThread(threadId, rootEvent, [initialEvent], true); - } catch (e) { + } catch { logger.warn("Could not find root event: " + threadId); } } diff --git a/src/utils/FontManager.ts b/src/utils/FontManager.ts index e74aa7833d..1ffa653a27 100644 --- a/src/utils/FontManager.ts +++ b/src/utils/FontManager.ts @@ -105,6 +105,7 @@ export async function fixupColorFonts(): Promise { colrFontCheckStarted = true; if (await isColrFontSupported()) { + // eslint-disable-next-line @typescript-eslint/no-require-imports const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2")}')`; document.fonts.add(new FontFace("Twemoji", path, {})); // For at least Chrome on Windows 10, we have to explictly add extra @@ -113,6 +114,7 @@ export async function fixupColorFonts(): Promise { document.fonts.add(new FontFace("Twemoji", path, { weight: "700" })); } else { // fall back to SBIX, generated via https://github.com/matrix-org/twemoji-colr/tree/matthew/sbix + // eslint-disable-next-line @typescript-eslint/no-require-imports const path = `url('${require("../../res/fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.woff2")}')`; document.fonts.add(new FontFace("Twemoji", path, {})); document.fonts.add(new FontFace("Twemoji", path, { weight: "600" })); diff --git a/src/utils/Singleflight.ts b/src/utils/Singleflight.ts index 153ced0cbf..2458183208 100644 --- a/src/utils/Singleflight.ts +++ b/src/utils/Singleflight.ts @@ -10,7 +10,7 @@ import { EnhancedMap } from "./maps"; // Inspired by https://pkg.go.dev/golang.org/x/sync/singleflight -const keyMap = new EnhancedMap>(); +const keyMap = new EnhancedMap>(); /** * Access class to get a singleflight context. Singleflights execute a @@ -47,7 +47,7 @@ export class Singleflight { * @param {string} key A string key relevant to that instance to namespace under. * @returns {SingleflightContext} Returns the context to execute the function. */ - public static for(instance?: Object | null, key?: string | null): SingleflightContext { + public static for(instance?: object | null, key?: string | null): SingleflightContext { if (!instance || !key) throw new Error("An instance and key must be supplied"); return new SingleflightContext(instance, key); } @@ -56,7 +56,7 @@ export class Singleflight { * Forgets all results for a given instance. * @param {Object} instance The instance to forget about. */ - public static forgetAllFor(instance: Object): void { + public static forgetAllFor(instance: object): void { keyMap.delete(instance); } @@ -72,7 +72,7 @@ export class Singleflight { class SingleflightContext { public constructor( - private instance: Object, + private instance: object, private key: string, ) {} diff --git a/src/utils/StorageAccess.ts b/src/utils/StorageAccess.ts index ee5ddbc619..bf6e559022 100644 --- a/src/utils/StorageAccess.ts +++ b/src/utils/StorageAccess.ts @@ -21,7 +21,7 @@ export function getIDBFactory(): IDBFactory | undefined { // We check `self` first because `window` returns something which doesn't work for service workers. // Note: `self?.indexedDB ?? window.indexedDB` breaks in service workers for unknown reasons. return self?.indexedDB ? self.indexedDB : window.indexedDB; - } catch (e) {} + } catch {} } let idb: IDBDatabase | null = null; diff --git a/src/utils/WidgetUtils.ts b/src/utils/WidgetUtils.ts index 0ff3a89aab..de158efcef 100644 --- a/src/utils/WidgetUtils.ts +++ b/src/utils/WidgetUtils.ts @@ -251,7 +251,7 @@ export default class WidgetUtils { // Delete existing widget with ID try { delete userWidgets[widgetId]; - } catch (e) { + } catch { logger.error(`$widgetId is non-configurable`); } diff --git a/src/utils/beacon/useOwnLiveBeacons.ts b/src/utils/beacon/useOwnLiveBeacons.ts index ace906a27b..ff0890792c 100644 --- a/src/utils/beacon/useOwnLiveBeacons.ts +++ b/src/utils/beacon/useOwnLiveBeacons.ts @@ -65,7 +65,7 @@ export const useOwnLiveBeacons = (liveBeaconIds: BeaconIdentifier[]): LiveBeacon setStoppingInProgress(true); try { await Promise.all(liveBeaconIds.map((beaconId) => OwnBeaconStore.instance.stopBeacon(beaconId))); - } catch (error) { + } catch { setStoppingInProgress(false); } }; diff --git a/src/utils/createMatrixClient.ts b/src/utils/createMatrixClient.ts index 6a4ef785fe..32274cdc44 100644 --- a/src/utils/createMatrixClient.ts +++ b/src/utils/createMatrixClient.ts @@ -25,7 +25,7 @@ const localStorage = window.localStorage; let indexedDB: IDBFactory; try { indexedDB = window.indexedDB; -} catch (e) {} +} catch {} /** * Create a new matrix client, with the persistent stores set up appropriately diff --git a/src/utils/device/snoozeBulkUnverifiedDeviceReminder.ts b/src/utils/device/snoozeBulkUnverifiedDeviceReminder.ts index 1d18bed83b..effc2a348b 100644 --- a/src/utils/device/snoozeBulkUnverifiedDeviceReminder.ts +++ b/src/utils/device/snoozeBulkUnverifiedDeviceReminder.ts @@ -26,7 +26,7 @@ export const isBulkUnverifiedDeviceReminderSnoozed = (): boolean => { const parsedTimestamp = Number.parseInt(snoozedTimestamp || "", 10); return Number.isInteger(parsedTimestamp) && parsedTimestamp + snoozePeriod > Date.now(); - } catch (error) { + } catch { return false; } }; diff --git a/src/utils/exportUtils/Exporter.ts b/src/utils/exportUtils/Exporter.ts index 053878886b..37757d8752 100644 --- a/src/utils/exportUtils/Exporter.ts +++ b/src/utils/exportUtils/Exporter.ts @@ -229,7 +229,7 @@ export default abstract class Exporter { const image = await fetch(media.srcHttp); blob = await image.blob(); } - } catch (err) { + } catch { logger.log("Error decrypting media"); } if (!blob) { diff --git a/src/utils/image-media.ts b/src/utils/image-media.ts index 2524572f66..5e0fb07678 100644 --- a/src/utils/image-media.ts +++ b/src/utils/image-media.ts @@ -76,7 +76,7 @@ export async function createThumbnail( try { canvas = new window.OffscreenCanvas(targetWidth, targetHeight); context = canvas.getContext("2d") as OffscreenCanvasRenderingContext2D; - } catch (e) { + } catch { // Fallback support for other browsers (Safari and Firefox for now) canvas = document.createElement("canvas"); canvas.width = targetWidth; diff --git a/src/utils/permalinks/Permalinks.ts b/src/utils/permalinks/Permalinks.ts index 32b72c80d1..9ecbf00b68 100644 --- a/src/utils/permalinks/Permalinks.ts +++ b/src/utils/permalinks/Permalinks.ts @@ -377,7 +377,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string { if (m) { return m[1]; } - } catch (e) { + } catch { // Not a valid URI return permalink; } @@ -396,7 +396,7 @@ export function tryTransformPermalinkToLocalHref(permalink: string): string { permalink = `#/user/${permalinkParts.userId}`; } // else not a valid permalink for our purposes - do not handle } - } catch (e) { + } catch { // Not an href we need to care about } @@ -421,7 +421,7 @@ export function getPrimaryPermalinkEntity(permalink: string): string | null { if (!permalinkParts) return null; // not processable if (permalinkParts.userId) return permalinkParts.userId; if (permalinkParts.roomIdOrAlias) return permalinkParts.roomIdOrAlias; - } catch (e) { + } catch { // no entity - not a permalink } diff --git a/src/utils/tokens/pickling.ts b/src/utils/tokens/pickling.ts index 9857ca01b4..a56915a488 100644 --- a/src/utils/tokens/pickling.ts +++ b/src/utils/tokens/pickling.ts @@ -120,7 +120,7 @@ export async function buildAndEncodePickleKey( if (pickleKeyBuf) { return encodeUnpaddedBase64(pickleKeyBuf); } - } catch (e) { + } catch { logger.error("Error decrypting pickle key"); } diff --git a/src/utils/tokens/tokens.ts b/src/utils/tokens/tokens.ts index 2bf67924f9..901da3a9a8 100644 --- a/src/utils/tokens/tokens.ts +++ b/src/utils/tokens/tokens.ts @@ -150,7 +150,7 @@ export async function persistTokenInStorage( // token if there is no token or we were unable to encrypt (e.g. if the browser doesn't // have WebCrypto). await StorageAccess.idbSave("account", storageKey, encryptedToken || token); - } catch (e) { + } catch { // if we couldn't save to indexedDB, fall back to localStorage. We // store the access token unencrypted since localStorage only saves // strings. @@ -163,7 +163,7 @@ export async function persistTokenInStorage( } else { try { await StorageAccess.idbSave("account", storageKey, token); - } catch (e) { + } catch { if (!!token) { localStorage.setItem(storageKey, token); } else { diff --git a/src/utils/tooltipify.tsx b/src/utils/tooltipify.tsx index 10172f4e3a..65ce431a97 100644 --- a/src/utils/tooltipify.tsx +++ b/src/utils/tooltipify.tsx @@ -45,7 +45,7 @@ export function tooltipifyLinks(rootNodes: ArrayLike, ignoredNodes: Ele let href = node.getAttribute("href")!; try { href = new URL(href, window.location.href).toString(); - } catch (e) { + } catch { // Not all hrefs will be valid URLs } diff --git a/src/vector/getconfig.ts b/src/vector/getconfig.ts index d09544e6eb..4a137b0c38 100644 --- a/src/vector/getconfig.ts +++ b/src/vector/getconfig.ts @@ -28,7 +28,7 @@ export async function getVectorConfig(relativeLocation = ""): Promise>): Promise { diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index 609da07ae5..84096dfaae 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -62,6 +62,7 @@ interface ExternalAPIOptions extends _ExternalAPIOptions { } // We have to trick webpack into loading our CSS for us. +// eslint-disable-next-line @typescript-eslint/no-require-imports require("./index.pcss"); const JITSI_OPENIDTOKEN_JWT_AUTH = "openidtoken-jwt"; diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index 0c5fd96341..c71865c3c1 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -265,7 +265,7 @@ export default class ElectronPlatform extends VectorBasePlatform { const notification = super.displayNotification(title, msg, avatarUrl, room, ev); - const handler = notification.onclick as Function; + const handler = notification.onclick as () => void; notification.onclick = (): void => { handler?.(); void this.ipc.call("focusWindow"); @@ -416,7 +416,7 @@ export default class ElectronPlatform extends VectorBasePlatform { public async getPickleKey(userId: string, deviceId: string): Promise { try { return await this.ipc.call("getPickleKey", userId, deviceId); - } catch (e) { + } catch { // if we can't connect to the password storage, assume there's no // pickle key return null; @@ -426,7 +426,7 @@ export default class ElectronPlatform extends VectorBasePlatform { public async createPickleKey(userId: string, deviceId: string): Promise { try { return await this.ipc.call("createPickleKey", userId, deviceId); - } catch (e) { + } catch { // if we can't connect to the password storage, assume there's no // pickle key return null; @@ -436,14 +436,14 @@ export default class ElectronPlatform extends VectorBasePlatform { public async destroyPickleKey(userId: string, deviceId: string): Promise { try { await this.ipc.call("destroyPickleKey", userId, deviceId); - } catch (e) {} + } catch {} } public async clearStorage(): Promise { try { await super.clearStorage(); await this.ipc.call("clearStorage"); - } catch (e) {} + } catch {} } public get baseUrl(): string { diff --git a/src/voice-broadcast/audio/VoiceBroadcastRecorder.ts b/src/voice-broadcast/audio/VoiceBroadcastRecorder.ts index f2685d03cb..8a6e17a1a5 100644 --- a/src/voice-broadcast/audio/VoiceBroadcastRecorder.ts +++ b/src/voice-broadcast/audio/VoiceBroadcastRecorder.ts @@ -76,7 +76,7 @@ export class VoiceBroadcastRecorder public async stop(): Promise> { try { await this.voiceRecording.stop(); - } catch (e) { + } catch { // Ignore if the recording raises any error. } diff --git a/src/voice-broadcast/utils/retrieveStartedInfoEvent.ts b/src/voice-broadcast/utils/retrieveStartedInfoEvent.ts index 77bcf83f84..cc5be144c9 100644 --- a/src/voice-broadcast/utils/retrieveStartedInfoEvent.ts +++ b/src/voice-broadcast/utils/retrieveStartedInfoEvent.ts @@ -31,7 +31,7 @@ export const retrieveStartedInfoEvent = async ( try { const relatedEventData = await client.fetchRoomEvent(roomId, relatedEventId); return new MatrixEvent(relatedEventData); - } catch (e) {} + } catch {} return null; }; diff --git a/src/widgets/Jitsi.ts b/src/widgets/Jitsi.ts index b1972b06a4..ba54eda5e1 100644 --- a/src/widgets/Jitsi.ts +++ b/src/widgets/Jitsi.ts @@ -50,7 +50,7 @@ export class Jitsi { try { const response = await fetch(`https://${this.preferredDomain}/.well-known/element/jitsi`); data = await response.json(); - } catch (error) { + } catch { return null; } if (data.auth) { diff --git a/test/setupTests.ts b/test/setupTests.ts index b875b2471f..64b8fa2909 100644 --- a/test/setupTests.ts +++ b/test/setupTests.ts @@ -35,6 +35,7 @@ beforeEach(() => { // // These are also require() calls to make sure they get called // synchronously. +/* eslint-disable @typescript-eslint/no-require-imports */ require("./setup/setupManualMocks"); // must be first require("./setup/setupLanguage"); require("./setup/setupConfig"); diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index 43807eb030..60c82ecf77 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -669,7 +669,7 @@ export function mkServerConfig( // These methods make some use of some private methods on the AsyncStoreWithClient to simplify getting into a consistent // ready state without needing to wire up a dispatcher and pretend to be a js-sdk client. -export const setupAsyncStoreWithClient = async ( +export const setupAsyncStoreWithClient = async ( store: AsyncStoreWithClient, client: MatrixClient, ) => { @@ -679,7 +679,7 @@ export const setupAsyncStoreWithClient = async ( await store.onReady(); }; -export const resetAsyncStoreWithClient = async (store: AsyncStoreWithClient) => { +export const resetAsyncStoreWithClient = async (store: AsyncStoreWithClient) => { // @ts-ignore protected access await store.onNotReady(); }; diff --git a/test/unit-tests/Terms-test.tsx b/test/unit-tests/Terms-test.tsx index 5c01dbf364..b6c2564d02 100644 --- a/test/unit-tests/Terms-test.tsx +++ b/test/unit-tests/Terms-test.tsx @@ -86,7 +86,6 @@ describe("Terms", function () { policy_the_first: POLICY_ONE, }, }); - mockClient.agreeToTerms; const interactionCallback = jest.fn(); await startTermsFlow(mockClient, [IM_SERVICE_ONE], interactionCallback); diff --git a/test/unit-tests/components/views/beacon/LeftPanelLiveShareWarning-test.tsx b/test/unit-tests/components/views/beacon/LeftPanelLiveShareWarning-test.tsx index c8ccefa5d6..03cc615307 100644 --- a/test/unit-tests/components/views/beacon/LeftPanelLiveShareWarning-test.tsx +++ b/test/unit-tests/components/views/beacon/LeftPanelLiveShareWarning-test.tsx @@ -18,7 +18,7 @@ import dispatcher from "../../../../../src/dispatcher/dispatcher"; import { Action } from "../../../../../src/dispatcher/actions"; jest.mock("../../../../../src/stores/OwnBeaconStore", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports const EventEmitter = require("events"); class MockOwnBeaconStore extends EventEmitter { public getLiveBeaconIdsWithLocationPublishError = jest.fn().mockReturnValue([]); diff --git a/test/unit-tests/components/views/polls/pollHistory/PollListItem-test.tsx b/test/unit-tests/components/views/polls/pollHistory/PollListItem-test.tsx index 7b1196bd4e..7c4cc6009f 100644 --- a/test/unit-tests/components/views/polls/pollHistory/PollListItem-test.tsx +++ b/test/unit-tests/components/views/polls/pollHistory/PollListItem-test.tsx @@ -15,7 +15,6 @@ import { makePollStartEvent, mockIntlDateTimeFormat, unmockIntlDateTimeFormat } describe("", () => { const event = makePollStartEvent("Question?", "@me:domain.org"); - event.getContent().origin; const defaultProps = { event, onClick: jest.fn() }; const getComponent = (props = {}) => render(); diff --git a/test/unit-tests/components/views/rooms/MessageComposer-test.tsx b/test/unit-tests/components/views/rooms/MessageComposer-test.tsx index 7fea00fe02..c2e0c4848e 100644 --- a/test/unit-tests/components/views/rooms/MessageComposer-test.tsx +++ b/test/unit-tests/components/views/rooms/MessageComposer-test.tsx @@ -247,11 +247,11 @@ describe("MessageComposer", () => { }); describe("UIStore interactions", () => { - let resizeCallback: Function; + let resizeCallback: (key: string, data: object) => void; beforeEach(() => { jest.spyOn(UIStore.instance, "on").mockImplementation( - (_event: string | symbol, listener: Function): any => { + (_event: string | symbol, listener: (key: string, data: object) => void): any => { resizeCallback = listener; }, ); diff --git a/test/unit-tests/components/views/rooms/RoomHeader-test.tsx b/test/unit-tests/components/views/rooms/RoomHeader-test.tsx index 6805f064cf..a7e556e452 100644 --- a/test/unit-tests/components/views/rooms/RoomHeader-test.tsx +++ b/test/unit-tests/components/views/rooms/RoomHeader-test.tsx @@ -564,7 +564,7 @@ describe("RoomHeader", () => { jest.spyOn(SdkContextClass.instance.roomViewStore, "isViewingCall").mockReturnValue(true); - render(, getWrapper()).container; + render(, getWrapper()); expect(getByLabelText(document.body, _t("voip|get_call_link"))).toBeInTheDocument(); }); diff --git a/test/unit-tests/components/views/rooms/RoomList-test.tsx b/test/unit-tests/components/views/rooms/RoomList-test.tsx index 1d69f03e6b..cb824bcdf9 100644 --- a/test/unit-tests/components/views/rooms/RoomList-test.tsx +++ b/test/unit-tests/components/views/rooms/RoomList-test.tsx @@ -210,7 +210,6 @@ describe("RoomList", () => { beforeEach(async () => { cleanup(); const rooms: Room[] = []; - RoomListStore.instance; testUtils.mkRoom(client, videoRoomPrivate, rooms); testUtils.mkRoom(client, videoRoomPublic, rooms); testUtils.mkRoom(client, videoRoomKnock, rooms); diff --git a/test/unit-tests/components/views/rooms/RoomPreviewBar-test.tsx b/test/unit-tests/components/views/rooms/RoomPreviewBar-test.tsx index f332702b2d..fb531bb3bd 100644 --- a/test/unit-tests/components/views/rooms/RoomPreviewBar-test.tsx +++ b/test/unit-tests/components/views/rooms/RoomPreviewBar-test.tsx @@ -100,7 +100,7 @@ describe("", () => { afterEach(() => { const container = document.body.firstChild; - container && document.body.removeChild(container); + if (container) document.body.removeChild(container); }); it("renders joining message", () => { diff --git a/test/unit-tests/components/views/spaces/SpacePanel-test.tsx b/test/unit-tests/components/views/spaces/SpacePanel-test.tsx index 5f83efd14e..1d1ebc194f 100644 --- a/test/unit-tests/components/views/spaces/SpacePanel-test.tsx +++ b/test/unit-tests/components/views/spaces/SpacePanel-test.tsx @@ -85,7 +85,7 @@ const drop = async (element: HTMLElement) => { }; jest.mock("../../../../../src/stores/spaces/SpaceStore", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports const EventEmitter = require("events"); class MockSpaceStore extends EventEmitter { invitedSpaces: SpaceKey[] = []; diff --git a/test/unit-tests/components/views/spaces/SpaceTreeLevel-test.tsx b/test/unit-tests/components/views/spaces/SpaceTreeLevel-test.tsx index 5ff66e7330..1e44fa6a0a 100644 --- a/test/unit-tests/components/views/spaces/SpaceTreeLevel-test.tsx +++ b/test/unit-tests/components/views/spaces/SpaceTreeLevel-test.tsx @@ -21,7 +21,7 @@ import { StaticNotificationState } from "../../../../../src/stores/notifications import { NotificationLevel } from "../../../../../src/stores/notifications/NotificationLevel"; jest.mock("../../../../../src/stores/spaces/SpaceStore", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports const EventEmitter = require("events"); class MockSpaceStore extends EventEmitter { activeSpace: SpaceKey = "!space1"; diff --git a/test/unit-tests/contexts/SdkContext-test.ts b/test/unit-tests/contexts/SdkContext-test.ts index 7ca881f817..21f356ed94 100644 --- a/test/unit-tests/contexts/SdkContext-test.ts +++ b/test/unit-tests/contexts/SdkContext-test.ts @@ -40,15 +40,11 @@ describe("SdkContextClass", () => { }); it("userProfilesStore should raise an error without a client", () => { - expect(() => { - sdkContext.userProfilesStore; - }).toThrow("Unable to create UserProfilesStore without a client"); + expect(() => sdkContext.userProfilesStore).toThrow("Unable to create UserProfilesStore without a client"); }); it("oidcClientStore should raise an error without a client", () => { - expect(() => { - sdkContext.oidcClientStore; - }).toThrow("Unable to create OidcClientStore without a client"); + expect(() => sdkContext.oidcClientStore).toThrow("Unable to create OidcClientStore without a client"); }); describe("when SDKContext has a client", () => { diff --git a/test/unit-tests/models/Call-test.ts b/test/unit-tests/models/Call-test.ts index a5e19fb004..40e929fb4a 100644 --- a/test/unit-tests/models/Call-test.ts +++ b/test/unit-tests/models/Call-test.ts @@ -358,12 +358,12 @@ describe("JitsiCall", () => { new CustomEvent("widgetapirequest", { detail: {} }), ); await waitFor(() => { - expect(callback).toHaveBeenNthCalledWith(1, ConnectionState.Disconnected, ConnectionState.Connected), - expect(callback).toHaveBeenNthCalledWith( - 2, - ConnectionState.WidgetLoading, - ConnectionState.Disconnected, - ); + expect(callback).toHaveBeenNthCalledWith(1, ConnectionState.Disconnected, ConnectionState.Connected); + expect(callback).toHaveBeenNthCalledWith( + 2, + ConnectionState.WidgetLoading, + ConnectionState.Disconnected, + ); expect(callback).toHaveBeenNthCalledWith(3, ConnectionState.Connecting, ConnectionState.WidgetLoading); }); // in video rooms we expect the call to immediately reconnect diff --git a/test/unit-tests/stores/BreadcrumbsStore-test.ts b/test/unit-tests/stores/BreadcrumbsStore-test.ts index 60c042f6a9..0b6b302ac4 100644 --- a/test/unit-tests/stores/BreadcrumbsStore-test.ts +++ b/test/unit-tests/stores/BreadcrumbsStore-test.ts @@ -49,7 +49,7 @@ describe("BreadcrumbsStore", () => { it("passes through the dynamic room precessors flag", () => { mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - store.meetsRoomRequirement; + expect(store.meetsRoomRequirement).toBeTruthy(); expect(client.getVisibleRooms).toHaveBeenCalledWith(true); }); }); @@ -57,7 +57,7 @@ describe("BreadcrumbsStore", () => { describe("And the feature_dynamic_room_predecessors is not enabled", () => { it("passes through the dynamic room precessors flag", () => { mocked(client.getVisibleRooms).mockReturnValue(fakeRooms(25)); - store.meetsRoomRequirement; + expect(store.meetsRoomRequirement).toBeTruthy(); expect(client.getVisibleRooms).toHaveBeenCalledWith(false); }); }); diff --git a/test/unit-tests/stores/OwnProfileStore-test.ts b/test/unit-tests/stores/OwnProfileStore-test.ts index c379cf2d61..290df8113d 100644 --- a/test/unit-tests/stores/OwnProfileStore-test.ts +++ b/test/unit-tests/stores/OwnProfileStore-test.ts @@ -70,7 +70,7 @@ describe("OwnProfileStore", () => { ); try { await ownProfileStore.start(); - } catch (ignore) {} + } catch {} expect(onUpdate).not.toHaveBeenCalled(); expect(ownProfileStore.displayName).toBe(client.getSafeUserId()); diff --git a/test/unit-tests/stores/RoomViewStore-test.ts b/test/unit-tests/stores/RoomViewStore-test.ts index 08dd61e245..7d397397dc 100644 --- a/test/unit-tests/stores/RoomViewStore-test.ts +++ b/test/unit-tests/stores/RoomViewStore-test.ts @@ -465,7 +465,7 @@ describe("RoomViewStore", function () { try { expect(setRoomVisible.mock.calls[i][0]).toEqual(v[0]); expect(setRoomVisible.mock.calls[i][1]).toEqual(v[1]); - } catch (err) { + } catch { throw new Error(`i=${i} got ${setRoomVisible.mock.calls[i]} want ${v}`); } }); diff --git a/test/unit-tests/stores/room-list/RoomListStore-test.ts b/test/unit-tests/stores/room-list/RoomListStore-test.ts index 24b00930f6..e8aad47a7b 100644 --- a/test/unit-tests/stores/room-list/RoomListStore-test.ts +++ b/test/unit-tests/stores/room-list/RoomListStore-test.ts @@ -353,7 +353,6 @@ describe("RoomListStore", () => { const videoRoomKnock = "!videoRoomKnock_server"; const rooms: Room[] = []; - RoomListStore.instance; mkRoom(client, videoRoomPrivate, rooms); mkRoom(client, videoRoomPublic, rooms); mkRoom(client, videoRoomKnock, rooms); diff --git a/test/unit-tests/stores/room-list/filters/SpaceFilterCondition-test.ts b/test/unit-tests/stores/room-list/filters/SpaceFilterCondition-test.ts index 323f30705c..09ea979198 100644 --- a/test/unit-tests/stores/room-list/filters/SpaceFilterCondition-test.ts +++ b/test/unit-tests/stores/room-list/filters/SpaceFilterCondition-test.ts @@ -17,7 +17,7 @@ import SpaceStore from "../../../../../src/stores/spaces/SpaceStore"; jest.mock("../../../../../src/settings/SettingsStore"); jest.mock("../../../../../src/stores/spaces/SpaceStore", () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line @typescript-eslint/no-require-imports const EventEmitter = require("events"); class MockSpaceStore extends EventEmitter { isRoomInSpace = jest.fn(); diff --git a/test/unit-tests/utils/MegolmExportEncryption-test.ts b/test/unit-tests/utils/MegolmExportEncryption-test.ts index 46f193d1b9..416f5f9bed 100644 --- a/test/unit-tests/utils/MegolmExportEncryption-test.ts +++ b/test/unit-tests/utils/MegolmExportEncryption-test.ts @@ -74,6 +74,7 @@ describe("MegolmExportEncryption", function () { subtle: webCrypto.subtle, }, }); + // eslint-disable-next-line @typescript-eslint/no-require-imports MegolmExportEncryption = require("../../../src/utils/MegolmExportEncryption"); }); diff --git a/test/unit-tests/utils/SessionLock-test.ts b/test/unit-tests/utils/SessionLock-test.ts index 5c20fc1b24..9bb5c05a6b 100644 --- a/test/unit-tests/utils/SessionLock-test.ts +++ b/test/unit-tests/utils/SessionLock-test.ts @@ -218,7 +218,9 @@ describe("SessionLock", () => { const window2 = createWindow(); // import the dependencies of getSessionLock into the new context + // eslint-disable-next-line @typescript-eslint/no-require-imports window2._uuid = require("uuid"); + // eslint-disable-next-line @typescript-eslint/no-require-imports window2._logger = require("matrix-js-sdk/src/logger"); window2.SESSION_LOCK_CONSTANTS = SESSION_LOCK_CONSTANTS; diff --git a/test/unit-tests/utils/Singleflight-test.ts b/test/unit-tests/utils/Singleflight-test.ts index 30d6525b16..7da5c8d351 100644 --- a/test/unit-tests/utils/Singleflight-test.ts +++ b/test/unit-tests/utils/Singleflight-test.ts @@ -14,7 +14,7 @@ describe("Singleflight", () => { }); it("should throw for bad context variables", () => { - const permutations: [Object | null, string | null][] = [ + const permutations: [object | null, string | null][] = [ [null, null], [{}, null], [null, "test"], diff --git a/test/unit-tests/vector/platform/ElectronPlatform-test.ts b/test/unit-tests/vector/platform/ElectronPlatform-test.ts index 9430ad006c..f6c2008de8 100644 --- a/test/unit-tests/vector/platform/ElectronPlatform-test.ts +++ b/test/unit-tests/vector/platform/ElectronPlatform-test.ts @@ -47,7 +47,9 @@ describe("ElectronPlatform", () => { setupLanguageMock(); }); - const getElectronEventHandlerCall = (eventType: string): [type: string, handler: Function] | undefined => + const getElectronEventHandlerCall = ( + eventType: string, + ): [type: string, handler: (...args: any) => void] | undefined => mockElectron.on.mock.calls.find(([type]) => type === eventType); it("flushes rageshake before quitting", () => { diff --git a/test/unit-tests/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx b/test/unit-tests/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx index 665d23aab1..c967189271 100644 --- a/test/unit-tests/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx +++ b/test/unit-tests/voice-broadcast/models/VoiceBroadcastPlayback-test.tsx @@ -162,7 +162,11 @@ describe("VoiceBroadcastPlayback", () => { jest.spyOn(playback, "removeAllListeners"); jest.spyOn(playback, "destroy"); playback.on(VoiceBroadcastPlaybackEvent.StateChanged, onStateChanged); - fakeTimers ? await flushPromisesWithFakeTimers() : await flushPromises(); + if (fakeTimers) { + await flushPromisesWithFakeTimers(); + } else { + await flushPromises(); + } return playback; }; diff --git a/test/unit-tests/voice-broadcast/models/VoiceBroadcastRecording-test.ts b/test/unit-tests/voice-broadcast/models/VoiceBroadcastRecording-test.ts index eabb7ab874..4f6bd8f47b 100644 --- a/test/unit-tests/voice-broadcast/models/VoiceBroadcastRecording-test.ts +++ b/test/unit-tests/voice-broadcast/models/VoiceBroadcastRecording-test.ts @@ -453,7 +453,7 @@ describe("VoiceBroadcastRecording", () => { describe.each([ ["pause", async () => voiceBroadcastRecording.pause()], ["toggle", async () => voiceBroadcastRecording.toggle()], - ])("and calling %s", (_case: string, action: Function) => { + ])("and calling %s", (_case: string, action: () => Promise) => { beforeEach(async () => { await action(); }); @@ -480,7 +480,7 @@ describe("VoiceBroadcastRecording", () => { describe.each([ ["pause", async () => voiceBroadcastRecording.pause()], ["toggle", async () => voiceBroadcastRecording.toggle()], - ])("and calling %s", (_case: string, action: Function) => { + ])("and calling %s", (_case: string, action: () => Promise) => { beforeEach(async () => { await action(); }); @@ -590,7 +590,7 @@ describe("VoiceBroadcastRecording", () => { describe.each([ ["resume", async () => voiceBroadcastRecording.resume()], ["toggle", async () => voiceBroadcastRecording.toggle()], - ])("and calling %s", (_case: string, action: Function) => { + ])("and calling %s", (_case: string, action: () => Promise) => { beforeEach(async () => { await action(); }); diff --git a/yarn.lock b/yarn.lock index fbdf820f70..b839359090 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2656,6 +2656,17 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@stylistic/eslint-plugin@^2.9.0": + version "2.9.0" + resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-2.9.0.tgz#5ab3326303915e020ddaf39154290e2800a84bcd" + integrity sha512-OrDyFAYjBT61122MIY1a3SfEgy3YCMgt2vL4eoPmvTwDBwyQhAXurxNQznlRD/jESNfYWfID8Ej+31LljvF7Xg== + dependencies: + "@typescript-eslint/utils" "^8.8.0" + eslint-visitor-keys "^4.1.0" + espree "^10.2.0" + estraverse "^5.3.0" + picomatch "^4.0.2" + "@svgr/babel-plugin-add-jsx-attribute@8.0.0": version "8.0.0" resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz#4001f5d5dd87fa13303e36ee106e3ff3a7eb8b22" @@ -3456,7 +3467,7 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@8.9.0", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0": +"@typescript-eslint/utils@8.9.0", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.8.0": version "8.9.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.9.0.tgz#748bbe3ea5bee526d9786d9405cf1b0df081c299" integrity sha512-PKgMmaSo/Yg/F7kIZvrgrWa1+Vwn036CdNUvYFEkYbPwOH4i8xvkaRlu148W3vtheWK9ckKRIz7PBP5oUlkrvQ== @@ -5784,10 +5795,10 @@ eslint-plugin-jsx-a11y@^6.5.1: safe-regex-test "^1.0.3" string.prototype.includes "^2.0.0" -eslint-plugin-matrix-org@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-1.2.1.tgz#76d1505daa93fb99ba4156008b9b32f57682c9b1" - integrity sha512-A3cDjhG7RHwfCS8o3bOip8hSCsxtmgk2ahvqE5v/Ic2kPEZxixY6w8zLj7hFGsrRmPSEpLWqkVLt8uvQBapiQA== +eslint-plugin-matrix-org@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-2.0.2.tgz#95b86b0f16704ab19740f7c3c62eae69e20365e6" + integrity sha512-cQy5Rjeq6uyu1mLXlPZwEJdyM0NmclrnEz68y792FSuuxzMyJNNYLGDQ5CkYW8H+PrD825HUFZ34pNXnjMOzOw== eslint-plugin-react-hooks@^4.3.0: version "4.6.2" @@ -5898,6 +5909,11 @@ eslint-visitor-keys@^4.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== +eslint-visitor-keys@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz#1f785cc5e81eb7534523d85922248232077d2f8c" + integrity sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg== + eslint@8.57.1: version "8.57.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" @@ -5951,6 +5967,15 @@ espree@^10.0.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^4.0.0" +espree@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.2.0.tgz#f4bcead9e05b0615c968e85f83816bc386a45df6" + integrity sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g== + dependencies: + acorn "^8.12.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^4.1.0" + espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"