Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Consume more imports from matrix-js-sdk/src/matrix #11449

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,6 @@ 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/@types",
"!matrix-js-sdk/src/@types/global",
"!matrix-js-sdk/src/@types/auth",
"!matrix-js-sdk/src/@types/beacon",
"!matrix-js-sdk/src/@types/threepids",
"!matrix-js-sdk/src/@types/polls",
"!matrix-js-sdk/src/@types/crypto",
"!matrix-js-sdk/src/@types/local_notifications",
"!matrix-js-sdk/src/@types/location",
"!matrix-js-sdk/src/@types/topic",
"!matrix-js-sdk/src/@types/registration",
"!matrix-js-sdk/src/@types/read_receipts",
"!matrix-js-sdk/src/@types/extensible_events",
"!matrix-js-sdk/src/@types/IIdentityServerProvider",
],
message: "Please use matrix-js-sdk/src/matrix instead",
},
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/read-receipts/read-receipts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ limitations under the License.

/// <reference types="cypress" />

import type { MatrixClient, MatrixEvent, ISendEventResponse } from "matrix-js-sdk/src/matrix";
import type { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import type { MatrixClient, MatrixEvent, ISendEventResponse, ReceiptType } from "matrix-js-sdk/src/matrix";
import { HomeserverInstance } from "../../plugins/utils/homeserver";

describe("Read receipts", () => {
Expand Down
1 change: 1 addition & 0 deletions cypress/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
import "../src/@types/global";
import "../src/@types/svg";
import "../src/@types/raw-loader";
// eslint-disable-next-line no-restricted-imports
import "matrix-js-sdk/src/@types/global";
import type {
MatrixClient,
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import type {
UploadOpts,
ICreateRoomOpts,
ISendEventResponse,
ReceiptType,
} from "matrix-js-sdk/src/matrix";
import type { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import Chainable = Cypress.Chainable;
import { UserCredentials } from "./login";

Expand Down
1 change: 1 addition & 0 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// eslint-disable-next-line no-restricted-imports
import "matrix-js-sdk/src/@types/global"; // load matrix-js-sdk's type extensions first
import "@types/modernizr";

Expand Down
2 changes: 1 addition & 1 deletion src/AddThreepid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
MatrixClient,
MatrixError,
HTTPError,
IThreepid,
} from "matrix-js-sdk/src/matrix";
import { IThreepid } from "matrix-js-sdk/src/@types/threepids";

import Modal from "./Modal";
import { _t, UserFriendlyError } from "./languageHandler";
Expand Down
10 changes: 8 additions & 2 deletions src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { createClient, MatrixClient, LoginFlow } from "matrix-js-sdk/src/matrix";
import {
createClient,
MatrixClient,
LoginFlow,
DELEGATED_OIDC_COMPATIBILITY,
ILoginFlow,
LoginRequest,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { DELEGATED_OIDC_COMPATIBILITY, ILoginFlow, LoginRequest } from "matrix-js-sdk/src/@types/auth";

import { IMatrixClientCreds } from "./MatrixClientPeg";
import SecurityCustomisations from "./customisations/Security";
Expand Down
2 changes: 1 addition & 1 deletion src/Notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
SyncState,
SyncStateData,
IRoomTimelineData,
M_LOCATION,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { M_LOCATION } from "matrix-js-sdk/src/@types/location";
import { PermissionChanged as PermissionChangedEvent } from "@matrix-org/analytics-events/types/typescript/PermissionChanged";

import { MatrixClientPeg } from "./MatrixClientPeg";
Expand Down
3 changes: 1 addition & 2 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ limitations under the License.
*/

import * as React from "react";
import { User, IContent, Direction, ContentHelpers } from "matrix-js-sdk/src/matrix";
import { User, IContent, Direction, ContentHelpers, MRoomTopicEventContent } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { MRoomTopicEventContent } from "matrix-js-sdk/src/@types/topic";

import dis from "./dispatcher/dispatcher";
import { _t, _td, UserFriendlyError } from "./languageHandler";
Expand Down
3 changes: 2 additions & 1 deletion src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import {
JoinRule,
EventType,
MsgType,
M_POLL_START,
M_POLL_END,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { removeDirectionOverrideChars } from "matrix-js-sdk/src/utils";
import { M_POLL_START, M_POLL_END } from "matrix-js-sdk/src/@types/polls";
import { PollStartEvent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";

import { _t } from "./languageHandler";
Expand Down
3 changes: 1 addition & 2 deletions src/Unread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { M_BEACON } from "matrix-js-sdk/src/@types/beacon";
import { M_BEACON, Room, Thread, MatrixEvent, EventType, MatrixClient } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { Room, Thread, MatrixEvent, EventType, MatrixClient } from "matrix-js-sdk/src/matrix";

import shouldHideEvent from "./shouldHideEvent";
import { haveRendererForEvent } from "./events/EventTileFactory";
Expand Down
3 changes: 1 addition & 2 deletions src/boundThreepids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { IThreepid, ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";
import { IThreepid, ThreepidMedium, MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";

import IdentityAuthClient from "./IdentityAuthClient";

Expand Down
11 changes: 9 additions & 2 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ limitations under the License.
import React, { createRef, ReactNode, TransitionEvent } from "react";
import ReactDOM from "react-dom";
import classNames from "classnames";
import { Room, MatrixClient, RoomStateEvent, EventStatus, MatrixEvent, EventType } from "matrix-js-sdk/src/matrix";
import {
Room,
MatrixClient,
RoomStateEvent,
EventStatus,
MatrixEvent,
EventType,
M_BEACON_INFO,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
import { isSupportedReceiptType } from "matrix-js-sdk/src/utils";
import { Optional } from "matrix-events-sdk";

Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import {
TimelineWindow,
Thread,
ThreadEvent,
ReceiptType,
} from "matrix-js-sdk/src/matrix";
import { debounce, findLastIndex, throttle } from "lodash";
import { logger } from "matrix-js-sdk/src/logger";
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";

import SettingsStore from "../../settings/SettingsStore";
import { Layout } from "../../settings/enums/Layout";
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import {
MatrixClient,
SSOFlow,
SSOAction,
RegisterResponse,
} from "matrix-js-sdk/src/matrix";
import React, { Fragment, ReactNode } from "react";
import classNames from "classnames";
import { logger } from "matrix-js-sdk/src/logger";
import { RegisterResponse } from "matrix-js-sdk/src/@types/registration";

import { _t } from "../../../languageHandler";
import { adminContactStrings, messageForResourceLimitError, resourceLimitStrings } from "../../../utils/ErrorUtils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
RelationType,
Relations,
Thread,
M_POLL_START,
} from "matrix-js-sdk/src/matrix";
import { M_POLL_START } from "matrix-js-sdk/src/@types/polls";

import { MatrixClientPeg } from "../../../MatrixClientPeg";
import dis from "../../../dispatcher/dispatcher";
Expand Down
6 changes: 4 additions & 2 deletions src/components/views/dialogs/ForwardDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ import {
EventType,
MatrixClient,
ContentHelpers,
ILocationContent,
LocationAssetType,
M_TIMESTAMP,
M_BEACON,
} from "matrix-js-sdk/src/matrix";
import { ILocationContent, LocationAssetType, M_TIMESTAMP } from "matrix-js-sdk/src/@types/location";
import { M_BEACON } from "matrix-js-sdk/src/@types/beacon";

import { _t } from "../../../languageHandler";
import dis from "../../../dispatcher/dispatcher";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { NotificationCountType, Room, Thread } from "matrix-js-sdk/src/matrix";
import { NotificationCountType, Room, Thread, ReceiptType } from "matrix-js-sdk/src/matrix";
import React, { useContext } from "react";
import { ReceiptType } from "matrix-js-sdk/src/@types/read_receipts";
import { ReadReceipt } from "matrix-js-sdk/src/models/read-receipt";

import MatrixClientContext from "../../../../contexts/MatrixClientContext";
Expand Down
7 changes: 4 additions & 3 deletions src/components/views/elements/PollCreateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ limitations under the License.
*/

import React, { ChangeEvent, createRef } from "react";
import { Room, MatrixEvent } from "matrix-js-sdk/src/matrix";
import {
Room,
MatrixEvent,
KnownPollKind,
M_POLL_KIND_DISCLOSED,
M_POLL_KIND_UNDISCLOSED,
M_POLL_START,
} from "matrix-js-sdk/src/@types/polls";
IPartialEvent,
} from "matrix-js-sdk/src/matrix";
import { PollStartEvent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";
import { IPartialEvent } from "matrix-js-sdk/src/@types/extensible_events";

import ScrollableBaseModal, { IScrollableBaseState } from "../dialogs/ScrollableBaseModal";
import QuestionDialog from "../dialogs/QuestionDialog";
Expand Down
10 changes: 8 additions & 2 deletions src/components/views/elements/SSOButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ limitations under the License.
import React from "react";
import { chunk } from "lodash";
import classNames from "classnames";
import { MatrixClient, IdentityProviderBrand, SSOFlow, SSOAction } from "matrix-js-sdk/src/matrix";
import {
MatrixClient,
IdentityProviderBrand,
SSOFlow,
SSOAction,
IIdentityProvider,
DELEGATED_OIDC_COMPATIBILITY,
} from "matrix-js-sdk/src/matrix";
import { Signup } from "@matrix-org/analytics-events/types/typescript/Signup";
import { IIdentityProvider, DELEGATED_OIDC_COMPATIBILITY } from "matrix-js-sdk/src/@types/auth";

import PlatformPeg from "../../../PlatformPeg";
import AccessibleButton from "./AccessibleButton";
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/messages/MBeaconBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import {
RelationType,
IRedactOpts,
ContentHelpers,
M_BEACON,
} from "matrix-js-sdk/src/matrix";
import { randomString } from "matrix-js-sdk/src/randomstring";
import { M_BEACON } from "matrix-js-sdk/src/@types/beacon";
import classNames from "classnames";

import MatrixClientContext from "../../../contexts/MatrixClientContext";
Expand Down
12 changes: 10 additions & 2 deletions src/components/views/messages/MPollBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ limitations under the License.

import React, { ReactNode } from "react";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixEvent, MatrixClient, Relations, Poll, PollEvent } from "matrix-js-sdk/src/matrix";
import { M_POLL_KIND_DISCLOSED, M_POLL_RESPONSE, M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import {
MatrixEvent,
MatrixClient,
Relations,
Poll,
PollEvent,
M_POLL_KIND_DISCLOSED,
M_POLL_RESPONSE,
M_POLL_START,
} from "matrix-js-sdk/src/matrix";
import { RelatedRelations } from "matrix-js-sdk/src/models/related-relations";
import { PollStartEvent, PollAnswerSubevent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";
import { PollResponseEvent } from "matrix-js-sdk/src/extensible_events_v1/PollResponseEvent";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/messages/MPollEndBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { useEffect, useState, useContext, ForwardRefExoticComponent } from "react";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { M_TEXT } from "matrix-js-sdk/src/@types/extensible_events";
import { MatrixEvent, M_TEXT } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";

import { Icon as PollIcon } from "../../../../res/img/element-icons/room/composer/poll.svg";
Expand Down
10 changes: 8 additions & 2 deletions src/components/views/messages/MessageActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ limitations under the License.
*/

import React, { ReactElement, useCallback, useContext, useEffect } from "react";
import { EventStatus, MatrixEvent, MatrixEventEvent, MsgType, RelationType } from "matrix-js-sdk/src/matrix";
import {
EventStatus,
MatrixEvent,
MatrixEventEvent,
MsgType,
RelationType,
M_BEACON_INFO,
} from "matrix-js-sdk/src/matrix";
import classNames from "classnames";
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";

import { Icon as ContextMenuIcon } from "../../../../res/img/element-icons/context-menu.svg";
import { Icon as EditIcon } from "../../../../res/img/element-icons/room/message-bar/edit.svg";
Expand Down
13 changes: 9 additions & 4 deletions src/components/views/messages/MessageEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ limitations under the License.
*/

import React, { createRef } from "react";
import { EventType, MsgType, MatrixEventEvent } from "matrix-js-sdk/src/matrix";
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
import { M_LOCATION } from "matrix-js-sdk/src/@types/location";
import { M_POLL_END, M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import {
EventType,
MsgType,
MatrixEventEvent,
M_BEACON_INFO,
M_LOCATION,
M_POLL_END,
M_POLL_START,
} from "matrix-js-sdk/src/matrix";

import SettingsStore from "../../../settings/SettingsStore";
import { Mjolnir } from "../../../mjolnir/Mjolnir";
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/polls/pollHistory/fetchPastPolls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

import { useCallback, useEffect, useState } from "react";
import { M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import {
M_POLL_START,
MatrixClient,
Direction,
EventTimeline,
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/rooms/MessageComposerButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import classNames from "classnames";
import { IEventRelation, Room, MatrixClient, THREAD_RELATION_TYPE } from "matrix-js-sdk/src/matrix";
import { M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import { IEventRelation, Room, MatrixClient, THREAD_RELATION_TYPE, M_POLL_START } from "matrix-js-sdk/src/matrix";
import React, { createContext, ReactElement, ReactNode, useContext, useRef } from "react";

import { _t } from "../../../languageHandler";
Expand Down
13 changes: 10 additions & 3 deletions src/components/views/settings/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ limitations under the License.
*/

import React, { ReactNode } from "react";
import { IAnnotatedPushRule, IPusher, PushRuleAction, PushRuleKind, RuleId } from "matrix-js-sdk/src/matrix";
import { IThreepid, ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import {
IAnnotatedPushRule,
IPusher,
PushRuleAction,
PushRuleKind,
RuleId,
IThreepid,
ThreepidMedium,
LocalNotificationSettings,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { LocalNotificationSettings } from "matrix-js-sdk/src/@types/local_notifications";

import Spinner from "../elements/Spinner";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/settings/SetIdServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

import React, { ReactNode } from "react";
import { logger } from "matrix-js-sdk/src/logger";
import { IThreepid } from "matrix-js-sdk/src/@types/threepids";
import { IThreepid } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
import { MatrixClientPeg } from "../../../MatrixClientPeg";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/settings/account/EmailAddresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ limitations under the License.
*/

import React from "react";
import { ThreepidMedium } from "matrix-js-sdk/src/@types/threepids";
import { ThreepidMedium, MatrixError } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixError } from "matrix-js-sdk/src/matrix";

import { _t, UserFriendlyError } from "../../../../languageHandler";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
Expand Down
Loading