From 3c370c6cbc46bdc2fb4ae48b9789e972f070e5be Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:49:41 +0200 Subject: [PATCH] Remove MatrixRTC realted import ES lint exceptions using a index.ts for matrixrtc (#12780) * update restricted import rules for matrixrtc * review * upgrade matrix-js-sdk * add missing import --- .eslintrc.js | 1 + src/Notifier.ts | 3 +- src/components/views/voip/CallDuration.tsx | 3 +- src/models/Call.ts | 15 +++--- src/stores/CallStore.ts | 5 +- test/Notifier-test.ts | 5 +- .../views/rooms/LegacyRoomHeader-test.tsx | 5 +- test/createRoom-test.ts | 3 +- test/models/Call-test.ts | 12 ++--- test/test-utils/test-utils.ts | 5 +- test/toasts/IncomingCallToast-test.tsx | 3 +- yarn.lock | 46 +++++++++---------- 12 files changed, 45 insertions(+), 61 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3eefd22206..444388d492 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -142,6 +142,7 @@ module.exports = { "!matrix-js-sdk/src/models/read-receipt", "!matrix-js-sdk/src/models/relations-container", "!matrix-js-sdk/src/models/related-relations", + "!matrix-js-sdk/src/matrixrtc", ], message: "Please use matrix-js-sdk/src/matrix instead", }, diff --git a/src/Notifier.ts b/src/Notifier.ts index 35362738ca..dbef9bccf4 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -32,8 +32,7 @@ import { } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { PermissionChanged as PermissionChangedEvent } from "@matrix-org/analytics-events/types/typescript/PermissionChanged"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import { MatrixClientPeg } from "./MatrixClientPeg"; import { PosthogAnalytics } from "./PosthogAnalytics"; diff --git a/src/components/views/voip/CallDuration.tsx b/src/components/views/voip/CallDuration.tsx index 03e26a819f..287b059c96 100644 --- a/src/components/views/voip/CallDuration.tsx +++ b/src/components/views/voip/CallDuration.tsx @@ -15,8 +15,7 @@ limitations under the License. */ import React, { FC, useState, useEffect, memo } from "react"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import { formatPreciseDuration } from "../../../DateUtils"; diff --git a/src/models/Call.ts b/src/models/Call.ts index 147642d873..7935025e5b 100644 --- a/src/models/Call.ts +++ b/src/models/Call.ts @@ -30,14 +30,13 @@ import { randomString } from "matrix-js-sdk/src/randomstring"; import { CallType } from "matrix-js-sdk/src/webrtc/call"; import { NamespacedValue } from "matrix-js-sdk/src/NamespacedValue"; import { IWidgetApiRequest } from "matrix-widget-api"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession, MatrixRTCSessionEvent } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; -// eslint-disable-next-line no-restricted-imports -import { CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; -// eslint-disable-next-line no-restricted-imports -import { ICallNotifyContent } from "matrix-js-sdk/src/matrixrtc/types"; +import { + MatrixRTCSession, + MatrixRTCSessionEvent, + CallMembership, + MatrixRTCSessionManagerEvents, + ICallNotifyContent, +} from "matrix-js-sdk/src/matrixrtc"; import type EventEmitter from "events"; import type { ClientWidgetApi, IWidgetData } from "matrix-widget-api"; diff --git a/src/stores/CallStore.ts b/src/stores/CallStore.ts index 0187f3d5aa..4ec2d57e91 100644 --- a/src/stores/CallStore.ts +++ b/src/stores/CallStore.ts @@ -16,10 +16,7 @@ limitations under the License. import { logger } from "matrix-js-sdk/src/logger"; import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSession, MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc"; import type { GroupCall, Room } from "matrix-js-sdk/src/matrix"; import defaultDispatcher from "../dispatcher/dispatcher"; diff --git a/test/Notifier-test.ts b/test/Notifier-test.ts index 224de7d8eb..7390415e58 100644 --- a/test/Notifier-test.ts +++ b/test/Notifier-test.ts @@ -26,10 +26,7 @@ import { SyncState, } from "matrix-js-sdk/src/matrix"; import { waitFor } from "@testing-library/react"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; -// eslint-disable-next-line no-restricted-imports -import { CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership"; +import { CallMembership, MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import BasePlatform from "../src/BasePlatform"; import Notifier from "../src/Notifier"; diff --git a/test/components/views/rooms/LegacyRoomHeader-test.tsx b/test/components/views/rooms/LegacyRoomHeader-test.tsx index f13c9fce9a..bd7bce2681 100644 --- a/test/components/views/rooms/LegacyRoomHeader-test.tsx +++ b/test/components/views/rooms/LegacyRoomHeader-test.tsx @@ -32,10 +32,7 @@ import { ClientWidgetApi, Widget } from "matrix-widget-api"; import EventEmitter from "events"; import { setupJestCanvasMock } from "jest-canvas-mock"; import { ViewRoomOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/RoomViewLifecycle"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSession, MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc"; import type { MatrixClient, MatrixEvent, RoomMember } from "matrix-js-sdk/src/matrix"; import type { MatrixCall } from "matrix-js-sdk/src/webrtc/call"; diff --git a/test/createRoom-test.ts b/test/createRoom-test.ts index 8fcf1df586..1024985292 100644 --- a/test/createRoom-test.ts +++ b/test/createRoom-test.ts @@ -17,8 +17,7 @@ limitations under the License. import { mocked, Mocked } from "jest-mock"; import { MatrixClient, Device, Preset, RoomType } from "matrix-js-sdk/src/matrix"; import { CryptoApi } from "matrix-js-sdk/src/crypto-api"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import { stubClient, setupAsyncStoreWithClient, mockPlatformPeg, getMockClientWithEventEmitter } from "./test-utils"; import { MatrixClientPeg } from "../src/MatrixClientPeg"; diff --git a/test/models/Call-test.ts b/test/models/Call-test.ts index 85f0700cb1..0b5a108f0e 100644 --- a/test/models/Call-test.ts +++ b/test/models/Call-test.ts @@ -28,12 +28,12 @@ import { } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; import { Widget } from "matrix-widget-api"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; -// eslint-disable-next-line no-restricted-imports -import { CallMembership } from "matrix-js-sdk/src/matrixrtc/CallMembership"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession, MatrixRTCSessionEvent } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { + CallMembership, + MatrixRTCSessionManagerEvents, + MatrixRTCSession, + MatrixRTCSessionEvent, +} from "matrix-js-sdk/src/matrixrtc"; import type { Mocked } from "jest-mock"; import type { MatrixClient, IMyDevice, RoomMember } from "matrix-js-sdk/src/matrix"; diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index 856d9b17b7..88e09b8ad5 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -44,10 +44,7 @@ import { ReEmitter } from "matrix-js-sdk/src/ReEmitter"; import { MediaHandler } from "matrix-js-sdk/src/webrtc/mediaHandler"; import { Feature, ServerSupport } from "matrix-js-sdk/src/feature"; import { MapperOpts } from "matrix-js-sdk/src/event-mapper"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSessionManager } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager"; -// eslint-disable-next-line no-restricted-imports -import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession"; +import { MatrixRTCSessionManager, MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc"; import type { GroupCall } from "matrix-js-sdk/src/matrix"; import type { Membership } from "matrix-js-sdk/src/types"; diff --git a/test/toasts/IncomingCallToast-test.tsx b/test/toasts/IncomingCallToast-test.tsx index d26a0893ca..8990366c0c 100644 --- a/test/toasts/IncomingCallToast-test.tsx +++ b/test/toasts/IncomingCallToast-test.tsx @@ -19,8 +19,7 @@ import { render, screen, cleanup, fireEvent, waitFor } from "@testing-library/re import { mocked, Mocked } from "jest-mock"; import { Room, RoomStateEvent, MatrixEvent, MatrixEventEvent, MatrixClient } from "matrix-js-sdk/src/matrix"; import { ClientWidgetApi, Widget } from "matrix-widget-api"; -// eslint-disable-next-line no-restricted-imports -import { ICallNotifyContent } from "matrix-js-sdk/src/matrixrtc/types"; +import { ICallNotifyContent } from "matrix-js-sdk/src/matrixrtc"; import type { RoomMember } from "matrix-js-sdk/src/matrix"; import { diff --git a/yarn.lock b/yarn.lock index c649421adf..4ad49f2a73 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1845,10 +1845,10 @@ emojibase "^15.0.0" emojibase-data "^15.0.0" -"@matrix-org/matrix-sdk-crypto-wasm@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-5.0.0.tgz#f45a7bccaad218c05bcf9e7c8ca783c9d9a07af4" - integrity sha512-37ASjCKSTU5ycGfkP+LUXG4Ok6OAf6vE+1qU6uwWhe6FwadCS3vVWzJYd/3d9BQFwsx4GhFTIAXrW4iLG85rmQ== +"@matrix-org/matrix-sdk-crypto-wasm@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@matrix-org/matrix-sdk-crypto-wasm/-/matrix-sdk-crypto-wasm-7.0.0.tgz#8d6abdb9ded8656cc9e2a7909913a34bf3fc9b3a" + integrity sha512-MOencXiW/gI5MuTtCNsuojjwT5DXCrjMqv9xOslJC9h2tPdLFFFMGr58dY5Lis4DRd9MRWcgrGowUIHOqieWTA== "@matrix-org/matrix-wysiwyg@2.37.4": version "2.37.4" @@ -3477,10 +3477,10 @@ balanced-match@^2.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-2.0.0.tgz#dc70f920d78db8b858535795867bf48f820633d9" integrity sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA== -base-x@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a" - integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw== +base-x@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-5.0.0.tgz#6d835ceae379130e1a4cb846a70ac4746f28ea9b" + integrity sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ== base64-arraybuffer@^1.0.2: version "1.0.2" @@ -3572,12 +3572,12 @@ browserslist@^4.22.2, browserslist@^4.23.0, browserslist@^4.23.1: node-releases "^2.0.14" update-browserslist-db "^1.1.0" -bs58@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279" - integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ== +bs58@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-6.0.0.tgz#a2cda0130558535dd281a2f8697df79caaf425d8" + integrity sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw== dependencies: - base-x "^4.0.0" + base-x "^5.0.0" bser@2.1.1: version "2.1.1" @@ -6632,9 +6632,9 @@ lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21: integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== loglevel@^1.7.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.1.tgz#5c621f83d5b48c54ae93b6156353f555963377b4" - integrity sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg== + version "1.9.1" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.9.1.tgz#d63976ac9bcd03c7c873116d41c2a85bafff1be7" + integrity sha512-hP3I3kCrDIMuRwAwHltphhDM1r8i55H33GgqjXbrisuJhF4kRhW1dNuxsRklp4bXl8DSdLaNLuiL4A/LWRfxvg== long@^5.2.0: version "5.2.3" @@ -6752,13 +6752,13 @@ matrix-events-sdk@0.0.1: integrity sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA== "matrix-js-sdk@github:matrix-org/matrix-js-sdk#develop": - version "33.1.0" - resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/987ec1e62fcdbd626d5abcba5e9dcdaa9eaaa758" + version "34.0.0" + resolved "https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/6b261b98c9e7fad891f777a0786830206685de57" dependencies: "@babel/runtime" "^7.12.5" - "@matrix-org/matrix-sdk-crypto-wasm" "^5.0.0" + "@matrix-org/matrix-sdk-crypto-wasm" "^7.0.0" another-json "^0.2.0" - bs58 "^5.0.0" + bs58 "^6.0.0" content-type "^1.0.4" jwt-decode "^4.0.0" loglevel "^1.7.1" @@ -8068,9 +8068,9 @@ schema-utils@^3.0.0: ajv-keywords "^3.5.2" sdp-transform@^2.14.1: - version "2.14.1" - resolved "https://registry.yarnpkg.com/sdp-transform/-/sdp-transform-2.14.1.tgz#2bb443583d478dee217df4caa284c46b870d5827" - integrity sha512-RjZyX3nVwJyCuTo5tGPx+PZWkDMCg7oOLpSlhjDdZfwUoNqG1mM8nyj31IGHyaPWXhjbP7cdK3qZ2bmkJ1GzRw== + version "2.14.2" + resolved "https://registry.yarnpkg.com/sdp-transform/-/sdp-transform-2.14.2.tgz#d2cee6a1f7abe44e6332ac6cbb94e8600f32d813" + integrity sha512-icY6jVao7MfKCieyo1AyxFYm1baiM+fA00qW/KrNNVlkxHAd34riEKuEkUe4bBb3gJwLJZM+xT60Yj1QL8rHiA== seedrandom@^3.0.5: version "3.0.5"