From f25e6813bb33eda3aa0bcd959d2c718222357758 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 1 Mar 2022 20:42:05 +0000 Subject: [PATCH] Mandate use of js-sdk/src/matrix import over js-sdk/src (#7933) --- .eslintrc.js | 30 +++++++++++++++++++ src/AddThreepid.ts | 2 +- src/ContentMessages.tsx | 2 +- .../security/CreateSecretStorageDialog.tsx | 2 +- src/components/structures/UploadBar.tsx | 2 +- .../context_menus/ThreadListContextMenu.tsx | 2 +- src/components/views/dialogs/ExportDialog.tsx | 2 +- .../views/messages/DownloadActionButton.tsx | 2 +- .../messages/MKeyVerificationRequest.tsx | 2 +- src/components/views/messages/UnknownBody.tsx | 2 +- .../views/messages/ViewSourceEvent.tsx | 2 +- src/components/views/rooms/RoomDetailList.tsx | 2 +- src/components/views/rooms/RoomHeader.tsx | 2 +- .../views/settings/CrossSigningPanel.tsx | 2 +- src/index.ts | 2 +- src/indexing/BaseEventIndexManager.ts | 2 +- src/models/IUpload.ts | 2 +- src/sendTimePerformanceMetrics.ts | 2 +- src/stores/ActiveWidgetStore.ts | 2 +- src/stores/AutoRageshakeStore.ts | 2 +- src/utils/MediaEventHelper.ts | 2 +- test/CallHandler-test.ts | 2 +- test/DecryptionFailureTracker-test.js | 2 +- test/DeviceListener-test.ts | 2 +- test/Terms-test.js | 2 +- test/TextForEvent-test.ts | 2 +- .../structures/CallEventGrouper-test.ts | 2 +- test/components/structures/GroupView-test.js | 2 +- .../structures/MessagePanel-test.js | 2 +- .../structures/ThreadPanel-test.tsx | 2 +- .../context_menus/SpaceContextMenu-test.tsx | 2 +- .../views/dialogs/ExportDialog-test.tsx | 2 +- .../views/groups/GroupMemberList-test.js | 2 +- .../MKeyVerificationConclusion-test.js | 2 +- .../views/messages/MPollBody-test.tsx | 2 +- .../views/right_panel/UserInfo-test.tsx | 2 +- .../views/rooms/RoomHeader-test.tsx | 2 +- test/components/views/rooms/RoomList-test.js | 2 +- .../views/rooms/RoomPreviewBar-test.tsx | 2 +- .../views/settings/CryptographyPanel-test.tsx | 2 +- .../views/settings/Notifications-test.tsx | 2 +- .../views/spaces/SpacePanel-test.tsx | 2 +- .../SpaceSettingsVisibilityTab-test.tsx | 2 +- test/stores/VoiceRecordingStore-test.ts | 2 +- test/stores/WidgetLayoutStore-test.ts | 2 +- .../previews/PollStartEventPreview-test.ts | 2 +- test/test-utils/test-utils.ts | 2 +- test/test-utils/threads.ts | 2 +- test/test-utils/wrappers.tsx | 2 +- test/utils/export-test.tsx | 2 +- 50 files changed, 79 insertions(+), 49 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2fb1cc943d..a0f5715573 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -40,6 +40,36 @@ module.exports = { ), ], + // Ban matrix-js-sdk/src imports in favour of matrix-js-sdk/src/matrix imports to prevent unleashing hell. + "no-restricted-imports": ["error", { + "paths": [{ + "name": "matrix-js-sdk", + "message": "Please use matrix-js-sdk/src/matrix instead", + }, { + "name": "matrix-js-sdk/", + "message": "Please use matrix-js-sdk/src/matrix instead", + }, { + "name": "matrix-js-sdk/src", + "message": "Please use matrix-js-sdk/src/matrix instead", + }, { + "name": "matrix-js-sdk/src/", + "message": "Please use matrix-js-sdk/src/matrix instead", + }, { + "name": "matrix-js-sdk/src/index", + "message": "Please use matrix-js-sdk/src/matrix instead", + }, { + "name": "matrix-react-sdk", + "message": "Please use matrix-react-sdk/src/index instead", + }, { + "name": "matrix-react-sdk/", + "message": "Please use matrix-react-sdk/src/index instead", + }], + "patterns": [{ + "group": ["matrix-js-sdk/lib", "matrix-js-sdk/lib/", "matrix-js-sdk/lib/**"], + "message": "Please use matrix-js-sdk/src/* instead", + }], + }], + // There are too many a11y violations to fix at once // Turn violated rules off until they are fixed "jsx-a11y/alt-text": "off", diff --git a/src/AddThreepid.ts b/src/AddThreepid.ts index ab4c04c725..4c84294f7a 100644 --- a/src/AddThreepid.ts +++ b/src/AddThreepid.ts @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IRequestMsisdnTokenResponse, IRequestTokenResponse } from "matrix-js-sdk/src"; +import { IRequestMsisdnTokenResponse, IRequestTokenResponse } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from './MatrixClientPeg'; import Modal from './Modal'; diff --git a/src/ContentMessages.tsx b/src/ContentMessages.tsx index 364cd2040c..8b0ddc8368 100644 --- a/src/ContentMessages.tsx +++ b/src/ContentMessages.tsx @@ -24,7 +24,7 @@ import encrypt from "browser-encrypt-attachment"; import extractPngChunks from "png-chunks-extract"; import { IAbortablePromise, IImageInfo } from "matrix-js-sdk/src/@types/partials"; import { logger } from "matrix-js-sdk/src/logger"; -import { IEventRelation, ISendEventResponse } from "matrix-js-sdk/src"; +import { IEventRelation, ISendEventResponse } from "matrix-js-sdk/src/matrix"; import { IEncryptedFile, IMediaEventInfo } from "./customisations/models/IMediaEventContent"; import dis from './dispatcher/dispatcher'; diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index 4bf53a0ce3..53df137f6d 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -20,7 +20,7 @@ import FileSaver from 'file-saver'; import { logger } from "matrix-js-sdk/src/logger"; import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup"; import { TrustInfo } from "matrix-js-sdk/src/crypto/backup"; -import { CrossSigningKeys } from "matrix-js-sdk/src"; +import { CrossSigningKeys } from "matrix-js-sdk/src/matrix"; import { IRecoveryKey } from "matrix-js-sdk/src/crypto/api"; import { CryptoEvent } from "matrix-js-sdk/src/crypto"; diff --git a/src/components/structures/UploadBar.tsx b/src/components/structures/UploadBar.tsx index b488870840..eb4ef51681 100644 --- a/src/components/structures/UploadBar.tsx +++ b/src/components/structures/UploadBar.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import { Room } from "matrix-js-sdk/src/models/room"; import filesize from "filesize"; -import { IEventRelation } from 'matrix-js-sdk/src'; +import { IEventRelation } from 'matrix-js-sdk/src/matrix'; import ContentMessages from '../../ContentMessages'; import dis from "../../dispatcher/dispatcher"; diff --git a/src/components/views/context_menus/ThreadListContextMenu.tsx b/src/components/views/context_menus/ThreadListContextMenu.tsx index c2d560c0f7..bf615a34b2 100644 --- a/src/components/views/context_menus/ThreadListContextMenu.tsx +++ b/src/components/views/context_menus/ThreadListContextMenu.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { useCallback, useEffect } from "react"; -import { MatrixEvent } from "matrix-js-sdk/src"; +import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { ButtonEvent } from "../elements/AccessibleButton"; import dis from '../../../dispatcher/dispatcher'; diff --git a/src/components/views/dialogs/ExportDialog.tsx b/src/components/views/dialogs/ExportDialog.tsx index 918bc733c1..b64bc6a14f 100644 --- a/src/components/views/dialogs/ExportDialog.tsx +++ b/src/components/views/dialogs/ExportDialog.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { useRef, useState, Dispatch, SetStateAction } from "react"; -import { Room } from "matrix-js-sdk/src"; +import { Room } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { _t } from "../../../languageHandler"; diff --git a/src/components/views/messages/DownloadActionButton.tsx b/src/components/views/messages/DownloadActionButton.tsx index 86bed15384..b4ed4af0d3 100644 --- a/src/components/views/messages/DownloadActionButton.tsx +++ b/src/components/views/messages/DownloadActionButton.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "matrix-js-sdk/src"; +import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import React from "react"; import classNames from "classnames"; diff --git a/src/components/views/messages/MKeyVerificationRequest.tsx b/src/components/views/messages/MKeyVerificationRequest.tsx index 1e53acd047..457fbfc819 100644 --- a/src/components/views/messages/MKeyVerificationRequest.tsx +++ b/src/components/views/messages/MKeyVerificationRequest.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from 'react'; -import { MatrixEvent } from 'matrix-js-sdk/src'; +import { MatrixEvent } from 'matrix-js-sdk/src/matrix'; import { logger } from "matrix-js-sdk/src/logger"; import { VerificationRequestEvent } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; diff --git a/src/components/views/messages/UnknownBody.tsx b/src/components/views/messages/UnknownBody.tsx index b09afa54e9..d9e70ff241 100644 --- a/src/components/views/messages/UnknownBody.tsx +++ b/src/components/views/messages/UnknownBody.tsx @@ -16,7 +16,7 @@ limitations under the License. */ import React, { forwardRef } from "react"; -import { MatrixEvent } from "matrix-js-sdk/src"; +import { MatrixEvent } from "matrix-js-sdk/src/matrix"; interface IProps { mxEvent: MatrixEvent; diff --git a/src/components/views/messages/ViewSourceEvent.tsx b/src/components/views/messages/ViewSourceEvent.tsx index 8e61b119c4..ad833936e4 100644 --- a/src/components/views/messages/ViewSourceEvent.tsx +++ b/src/components/views/messages/ViewSourceEvent.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from 'react'; -import { MatrixEvent, MatrixEventEvent } from 'matrix-js-sdk/src'; +import { MatrixEvent, MatrixEventEvent } from 'matrix-js-sdk/src/matrix'; import classNames from 'classnames'; import { replaceableComponent } from "../../../utils/replaceableComponent"; diff --git a/src/components/views/rooms/RoomDetailList.tsx b/src/components/views/rooms/RoomDetailList.tsx index 8503ef30fd..50a8f69d5e 100644 --- a/src/components/views/rooms/RoomDetailList.tsx +++ b/src/components/views/rooms/RoomDetailList.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from 'react'; -import { Room } from 'matrix-js-sdk/src'; +import { Room } from 'matrix-js-sdk/src/matrix'; import classNames from 'classnames'; import dis from '../../../dispatcher/dispatcher'; diff --git a/src/components/views/rooms/RoomHeader.tsx b/src/components/views/rooms/RoomHeader.tsx index 20eac5b1d7..7eb0f4de60 100644 --- a/src/components/views/rooms/RoomHeader.tsx +++ b/src/components/views/rooms/RoomHeader.tsx @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import classNames from 'classnames'; import { throttle } from 'lodash'; -import { MatrixEvent, Room, RoomStateEvent } from 'matrix-js-sdk/src'; +import { MatrixEvent, Room, RoomStateEvent } from 'matrix-js-sdk/src/matrix'; import { CallType } from "matrix-js-sdk/src/webrtc/call"; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/settings/CrossSigningPanel.tsx b/src/components/views/settings/CrossSigningPanel.tsx index 16f4acca7c..e5e018be6a 100644 --- a/src/components/views/settings/CrossSigningPanel.tsx +++ b/src/components/views/settings/CrossSigningPanel.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React from 'react'; -import { ClientEvent, MatrixEvent } from 'matrix-js-sdk/src'; +import { ClientEvent, MatrixEvent } from 'matrix-js-sdk/src/matrix'; import { logger } from "matrix-js-sdk/src/logger"; import { CryptoEvent } from "matrix-js-sdk/src/crypto"; diff --git a/src/index.ts b/src/index.ts index f78f25914b..c57722376f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,7 @@ import Skinner, { ISkinObject } from './Skinner'; // Import the js-sdk so the proper `request` object can be set. This does some // magic with the browser injection to make all subsequent imports work fine. -import "matrix-js-sdk"; +import "matrix-js-sdk/src/browser-index"; export function loadSkin(skinObject: ISkinObject): void { Skinner.load(skinObject); diff --git a/src/indexing/BaseEventIndexManager.ts b/src/indexing/BaseEventIndexManager.ts index 64576e4412..8caa8a20dd 100644 --- a/src/indexing/BaseEventIndexManager.ts +++ b/src/indexing/BaseEventIndexManager.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { IMatrixProfile, IEventWithRoomId as IMatrixEvent, IResultRoomEvents } from "matrix-js-sdk/src/@types/search"; -import { Direction } from "matrix-js-sdk/src"; +import { Direction } from "matrix-js-sdk/src/matrix"; // The following interfaces take their names and member names from seshat and the spec /* eslint-disable camelcase */ diff --git a/src/models/IUpload.ts b/src/models/IUpload.ts index a3599195d8..715a71037f 100644 --- a/src/models/IUpload.ts +++ b/src/models/IUpload.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { IEventRelation } from "matrix-js-sdk/src"; +import { IEventRelation } from "matrix-js-sdk/src/matrix"; import { IAbortablePromise } from "matrix-js-sdk/src/@types/partials"; export interface IUpload { diff --git a/src/sendTimePerformanceMetrics.ts b/src/sendTimePerformanceMetrics.ts index ee5caa05a9..020f8c895e 100644 --- a/src/sendTimePerformanceMetrics.ts +++ b/src/sendTimePerformanceMetrics.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "matrix-js-sdk/src"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; /** * Decorates the given event content object with the "send start time". The diff --git a/src/stores/ActiveWidgetStore.ts b/src/stores/ActiveWidgetStore.ts index bb81f9c487..492332d3db 100644 --- a/src/stores/ActiveWidgetStore.ts +++ b/src/stores/ActiveWidgetStore.ts @@ -15,7 +15,7 @@ limitations under the License. */ import EventEmitter from 'events'; -import { MatrixEvent, RoomStateEvent } from "matrix-js-sdk/src"; +import { MatrixEvent, RoomStateEvent } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from '../MatrixClientPeg'; import { WidgetMessagingStore } from "./widgets/WidgetMessagingStore"; diff --git a/src/stores/AutoRageshakeStore.ts b/src/stores/AutoRageshakeStore.ts index 0ac60dbdf4..26c66549f0 100644 --- a/src/stores/AutoRageshakeStore.ts +++ b/src/stores/AutoRageshakeStore.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { ClientEvent, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src"; +import { ClientEvent, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/matrix"; import { sleep } from "matrix-js-sdk/src/utils"; import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync"; diff --git a/src/utils/MediaEventHelper.ts b/src/utils/MediaEventHelper.ts index 24680668d9..80487eecc1 100644 --- a/src/utils/MediaEventHelper.ts +++ b/src/utils/MediaEventHelper.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "matrix-js-sdk/src"; +import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { EventType, MsgType } from "matrix-js-sdk/src/@types/event"; import { logger } from "matrix-js-sdk/src/logger"; diff --git a/test/CallHandler-test.ts b/test/CallHandler-test.ts index 7affcb9d82..e0696fa287 100644 --- a/test/CallHandler-test.ts +++ b/test/CallHandler-test.ts @@ -16,7 +16,7 @@ limitations under the License. import './skinned-sdk'; -import { IProtocol } from 'matrix-js-sdk/src'; +import { IProtocol } from 'matrix-js-sdk/src/matrix'; import { CallEvent, CallState, CallType } from 'matrix-js-sdk/src/webrtc/call'; import EventEmitter from 'events'; diff --git a/test/DecryptionFailureTracker-test.js b/test/DecryptionFailureTracker-test.js index 4eedf60a0d..430cb80e50 100644 --- a/test/DecryptionFailureTracker-test.js +++ b/test/DecryptionFailureTracker-test.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from 'matrix-js-sdk'; +import { MatrixEvent } from 'matrix-js-sdk/src/matrix'; import './skinned-sdk'; // Must be first for skinning to work import { DecryptionFailureTracker } from '../src/DecryptionFailureTracker'; diff --git a/test/DeviceListener-test.ts b/test/DeviceListener-test.ts index e591899c55..957e622b35 100644 --- a/test/DeviceListener-test.ts +++ b/test/DeviceListener-test.ts @@ -17,7 +17,7 @@ limitations under the License. import { EventEmitter } from "events"; import { mocked } from "jest-mock"; -import { Room } from "matrix-js-sdk"; +import { Room } from "matrix-js-sdk/src/matrix"; import './skinned-sdk'; import DeviceListener from "../src/DeviceListener"; diff --git a/test/Terms-test.js b/test/Terms-test.js index 8e9b651299..2bd5b6f43d 100644 --- a/test/Terms-test.js +++ b/test/Terms-test.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import * as Matrix from 'matrix-js-sdk'; +import * as Matrix from 'matrix-js-sdk/src/matrix'; import { startTermsFlow, Service } from '../src/Terms'; import { stubClient } from './test-utils'; diff --git a/test/TextForEvent-test.ts b/test/TextForEvent-test.ts index 1cdf958338..749dc8d113 100644 --- a/test/TextForEvent-test.ts +++ b/test/TextForEvent-test.ts @@ -1,6 +1,6 @@ import './skinned-sdk'; -import { EventType, MatrixEvent } from "matrix-js-sdk"; +import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix"; import TestRenderer from 'react-test-renderer'; import { getSenderName, textForEvent } from "../src/TextForEvent"; diff --git a/test/components/structures/CallEventGrouper-test.ts b/test/components/structures/CallEventGrouper-test.ts index 0eef27851d..587a69e16c 100644 --- a/test/components/structures/CallEventGrouper-test.ts +++ b/test/components/structures/CallEventGrouper-test.ts @@ -15,7 +15,7 @@ limitations under the License. */ import "../../skinned-sdk"; -import { MatrixClient } from 'matrix-js-sdk'; +import { MatrixClient } from 'matrix-js-sdk/src/matrix'; import { EventType } from "matrix-js-sdk/src/@types/event"; import { CallState } from "matrix-js-sdk/src/webrtc/call"; diff --git a/test/components/structures/GroupView-test.js b/test/components/structures/GroupView-test.js index 9d46b2fe71..1b7c9185b5 100644 --- a/test/components/structures/GroupView-test.js +++ b/test/components/structures/GroupView-test.js @@ -18,7 +18,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import ReactTestUtils from 'react-dom/test-utils'; import MockHttpBackend from 'matrix-mock-request'; -import Matrix from 'matrix-js-sdk'; +import * as Matrix from 'matrix-js-sdk/src/matrix'; import { MatrixClientPeg } from '../../../src/MatrixClientPeg'; import sdk from '../../skinned-sdk'; diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index baaf262ace..7bf74ce88b 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -18,7 +18,7 @@ limitations under the License. import React from 'react'; import ReactDOM from "react-dom"; import { EventEmitter } from "events"; -import Matrix from 'matrix-js-sdk'; +import * as Matrix from 'matrix-js-sdk/src/matrix'; import FakeTimers from '@sinonjs/fake-timers'; import { mount } from "enzyme"; diff --git a/test/components/structures/ThreadPanel-test.tsx b/test/components/structures/ThreadPanel-test.tsx index ebdbaf1bc5..bf9de71a75 100644 --- a/test/components/structures/ThreadPanel-test.tsx +++ b/test/components/structures/ThreadPanel-test.tsx @@ -22,7 +22,7 @@ import { Room, UNSTABLE_FILTER_RELATION_SENDERS, UNSTABLE_FILTER_RELATION_TYPES, -} from 'matrix-js-sdk'; +} from 'matrix-js-sdk/src/matrix'; import { mocked } from 'jest-mock'; import '../../skinned-sdk'; diff --git a/test/components/views/context_menus/SpaceContextMenu-test.tsx b/test/components/views/context_menus/SpaceContextMenu-test.tsx index ff6def1902..249a74ce45 100644 --- a/test/components/views/context_menus/SpaceContextMenu-test.tsx +++ b/test/components/views/context_menus/SpaceContextMenu-test.tsx @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; -import { Room } from 'matrix-js-sdk'; +import { Room } from 'matrix-js-sdk/src/matrix'; import { mocked } from 'jest-mock'; import { act } from 'react-dom/test-utils'; diff --git a/test/components/views/dialogs/ExportDialog-test.tsx b/test/components/views/dialogs/ExportDialog-test.tsx index 9a41502578..252acc7526 100644 --- a/test/components/views/dialogs/ExportDialog-test.tsx +++ b/test/components/views/dialogs/ExportDialog-test.tsx @@ -18,7 +18,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { mocked } from 'jest-mock'; import { act } from "react-dom/test-utils"; -import { Room } from 'matrix-js-sdk'; +import { Room } from 'matrix-js-sdk/src/matrix'; import '../../../skinned-sdk'; import ExportDialog from '../../../../src/components/views/dialogs/ExportDialog'; diff --git a/test/components/views/groups/GroupMemberList-test.js b/test/components/views/groups/GroupMemberList-test.js index 1afee21cdf..bdb7713fd4 100644 --- a/test/components/views/groups/GroupMemberList-test.js +++ b/test/components/views/groups/GroupMemberList-test.js @@ -18,7 +18,7 @@ import React from "react"; import ReactDOM from "react-dom"; import ReactTestUtils from "react-dom/test-utils"; import MockHttpBackend from "matrix-mock-request"; -import Matrix from "matrix-js-sdk"; +import * as Matrix from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from "../../../../src/MatrixClientPeg"; import sdk from "../../../skinned-sdk"; diff --git a/test/components/views/messages/MKeyVerificationConclusion-test.js b/test/components/views/messages/MKeyVerificationConclusion-test.js index b06e242f4e..025dc82d45 100644 --- a/test/components/views/messages/MKeyVerificationConclusion-test.js +++ b/test/components/views/messages/MKeyVerificationConclusion-test.js @@ -2,7 +2,7 @@ import '../../../skinned-sdk'; // Must be first for skinning to work import React from 'react'; import TestRenderer from 'react-test-renderer'; import { EventEmitter } from 'events'; -import { MatrixEvent } from 'matrix-js-sdk'; +import { MatrixEvent } from 'matrix-js-sdk/src/matrix'; import * as TestUtils from '../../../test-utils'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; diff --git a/test/components/views/messages/MPollBody-test.tsx b/test/components/views/messages/MPollBody-test.tsx index c460e476b1..69cf16ab47 100644 --- a/test/components/views/messages/MPollBody-test.tsx +++ b/test/components/views/messages/MPollBody-test.tsx @@ -16,7 +16,7 @@ limitations under the License. import React from "react"; import { mount, ReactWrapper } from "enzyme"; -import { Callback, IContent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk"; +import { Callback, IContent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix"; import { ISendEventResponse } from "matrix-js-sdk/src/@types/requests"; import { Relations } from "matrix-js-sdk/src/models/relations"; import { RelatedRelations } from "matrix-js-sdk/src/models/related-relations"; diff --git a/test/components/views/right_panel/UserInfo-test.tsx b/test/components/views/right_panel/UserInfo-test.tsx index 0e086b5799..84587bee5c 100644 --- a/test/components/views/right_panel/UserInfo-test.tsx +++ b/test/components/views/right_panel/UserInfo-test.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; import { act } from "react-dom/test-utils"; -import { Room, User } from 'matrix-js-sdk'; +import { Room, User } from 'matrix-js-sdk/src/matrix'; import { Phase, VerificationRequest } from 'matrix-js-sdk/src/crypto/verification/request/VerificationRequest'; import "../../../skinned-sdk"; diff --git a/test/components/views/rooms/RoomHeader-test.tsx b/test/components/views/rooms/RoomHeader-test.tsx index e126642bb7..e27376e0c1 100644 --- a/test/components/views/rooms/RoomHeader-test.tsx +++ b/test/components/views/rooms/RoomHeader-test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Room, PendingEventOrdering, MatrixEvent, MatrixClient } from 'matrix-js-sdk'; +import { Room, PendingEventOrdering, MatrixEvent, MatrixClient } from 'matrix-js-sdk/src/matrix'; import "../../../skinned-sdk"; import * as TestUtils from '../../../test-utils'; diff --git a/test/components/views/rooms/RoomList-test.js b/test/components/views/rooms/RoomList-test.js index a99b20e3dd..28d4409122 100644 --- a/test/components/views/rooms/RoomList-test.js +++ b/test/components/views/rooms/RoomList-test.js @@ -1,7 +1,7 @@ import React from 'react'; import ReactTestUtils from 'react-dom/test-utils'; import ReactDOM from 'react-dom'; -import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk'; +import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk/src/matrix'; import * as TestUtils from '../../../test-utils'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; diff --git a/test/components/views/rooms/RoomPreviewBar-test.tsx b/test/components/views/rooms/RoomPreviewBar-test.tsx index db3f8336a9..132b0e1cc9 100644 --- a/test/components/views/rooms/RoomPreviewBar-test.tsx +++ b/test/components/views/rooms/RoomPreviewBar-test.tsx @@ -21,7 +21,7 @@ import { findRenderedDOMComponentWithClass, act, } from 'react-dom/test-utils'; -import { Room, RoomMember, MatrixError, IContent } from 'matrix-js-sdk'; +import { Room, RoomMember, MatrixError, IContent } from 'matrix-js-sdk/src/matrix'; import "../../../skinned-sdk"; import { stubClient } from '../../../test-utils'; diff --git a/test/components/views/settings/CryptographyPanel-test.tsx b/test/components/views/settings/CryptographyPanel-test.tsx index f4936b81f2..c3bf816bd7 100644 --- a/test/components/views/settings/CryptographyPanel-test.tsx +++ b/test/components/views/settings/CryptographyPanel-test.tsx @@ -2,7 +2,7 @@ import '../../../skinned-sdk'; import React, { ReactElement } from 'react'; import ReactDOM from 'react-dom'; -import { MatrixClient } from 'matrix-js-sdk'; +import { MatrixClient } from 'matrix-js-sdk/src/matrix'; import { MatrixClientPeg } from '../../../../src/MatrixClientPeg'; import * as TestUtils from '../../../test-utils'; diff --git a/test/components/views/settings/Notifications-test.tsx b/test/components/views/settings/Notifications-test.tsx index 40032413eb..87ca86681e 100644 --- a/test/components/views/settings/Notifications-test.tsx +++ b/test/components/views/settings/Notifications-test.tsx @@ -15,7 +15,7 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; import '../../../skinned-sdk'; -import { IPushRule, IPushRules, RuleId } from 'matrix-js-sdk'; +import { IPushRule, IPushRules, RuleId } from 'matrix-js-sdk/src/matrix'; import { ThreepidMedium } from 'matrix-js-sdk/src/@types/threepids'; import { act } from 'react-dom/test-utils'; diff --git a/test/components/views/spaces/SpacePanel-test.tsx b/test/components/views/spaces/SpacePanel-test.tsx index d9226ae221..7f2c3a95b7 100644 --- a/test/components/views/spaces/SpacePanel-test.tsx +++ b/test/components/views/spaces/SpacePanel-test.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from 'react'; import { mount } from 'enzyme'; import { mocked } from 'jest-mock'; -import { MatrixClient } from 'matrix-js-sdk'; +import { MatrixClient } from 'matrix-js-sdk/src/matrix'; import { act } from "react-dom/test-utils"; import '../../../skinned-sdk'; diff --git a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx index 6c6bb3466a..0d7518a2a3 100644 --- a/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx +++ b/test/components/views/spaces/SpaceSettingsVisibilityTab-test.tsx @@ -6,7 +6,7 @@ import { Simulate, } from 'react-dom/test-utils'; import { act } from "react-dom/test-utils"; -import { EventType, MatrixClient, Room } from 'matrix-js-sdk'; +import { EventType, MatrixClient, Room } from 'matrix-js-sdk/src/matrix'; import { GuestAccess, HistoryVisibility, JoinRule } from 'matrix-js-sdk/src/@types/partials'; import _SpaceSettingsVisibilityTab from "../../../../src/components/views/spaces/SpaceSettingsVisibilityTab"; diff --git a/test/stores/VoiceRecordingStore-test.ts b/test/stores/VoiceRecordingStore-test.ts index 15a2096a6a..1c8bb86cb3 100644 --- a/test/stores/VoiceRecordingStore-test.ts +++ b/test/stores/VoiceRecordingStore-test.ts @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient } from "matrix-js-sdk"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; import "../skinned-sdk"; // Must be first for skinning to work import { VoiceRecording } from '../../src/audio/VoiceRecording'; diff --git a/test/stores/WidgetLayoutStore-test.ts b/test/stores/WidgetLayoutStore-test.ts index bff3d97386..139c31b176 100644 --- a/test/stores/WidgetLayoutStore-test.ts +++ b/test/stores/WidgetLayoutStore-test.ts @@ -15,7 +15,7 @@ limitations under the License. */ import "../skinned-sdk"; // Must be first for skinning to work -import { Room } from "matrix-js-sdk"; +import { Room } from "matrix-js-sdk/src/matrix"; import WidgetStore, { IApp } from "../../src/stores/WidgetStore"; import { Container, WidgetLayoutStore } from "../../src/stores/widgets/WidgetLayoutStore"; diff --git a/test/stores/room-list/previews/PollStartEventPreview-test.ts b/test/stores/room-list/previews/PollStartEventPreview-test.ts index 94a0e34051..a24de59ccc 100644 --- a/test/stores/room-list/previews/PollStartEventPreview-test.ts +++ b/test/stores/room-list/previews/PollStartEventPreview-test.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixEvent } from "matrix-js-sdk"; +import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { POLL_ANSWER, M_TEXT, M_POLL_KIND_DISCLOSED, M_POLL_START } from "matrix-events-sdk"; import { PollStartEventPreview } from "../../../../src/stores/room-list/previews/PollStartEventPreview"; diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index b0c7ae3e47..a894faf550 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -13,7 +13,7 @@ import { RoomState, EventType, IEventRelation, -} from 'matrix-js-sdk'; +} from 'matrix-js-sdk/src/matrix'; import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg'; import dis from '../../src/dispatcher/dispatcher'; diff --git a/test/test-utils/threads.ts b/test/test-utils/threads.ts index 1fa2e3a70b..1df62e51d7 100644 --- a/test/test-utils/threads.ts +++ b/test/test-utils/threads.ts @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import { MatrixClient, MatrixEvent, RelationType, Room } from "matrix-js-sdk"; +import { MatrixClient, MatrixEvent, RelationType, Room } from "matrix-js-sdk/src/matrix"; import { Thread } from "matrix-js-sdk/src/models/thread"; import { mkMessage, MessageEventProps } from "./test-utils"; diff --git a/test/test-utils/wrappers.tsx b/test/test-utils/wrappers.tsx index 97b85a8eff..070e2313ef 100644 --- a/test/test-utils/wrappers.tsx +++ b/test/test-utils/wrappers.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import React, { RefCallback } from "react"; -import { MatrixClient } from "matrix-js-sdk"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg'; import MatrixClientContext from "../../src/contexts/MatrixClientContext"; diff --git a/test/utils/export-test.tsx b/test/utils/export-test.tsx index a9d0f00e2b..c1128d2271 100644 --- a/test/utils/export-test.tsx +++ b/test/utils/export-test.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { renderToString } from "react-dom/server"; -import { IContent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk"; +import { IContent, MatrixClient, MatrixEvent, Room } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from "../../src/MatrixClientPeg"; import { IExportOptions, ExportType, ExportFormat } from "../../src/utils/exportUtils/exportUtils";