Apply lint rule @typescript-eslint/no-empty-object-type (#29159)

* Apply lint rule @typescript-eslint/no-empty-object-type

To avoid the footgun that is https://www.totaltypescript.com/the-empty-object-type-in-typescript

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-02-04 13:41:34 +00:00
committed by GitHub
parent 8cae1e9f5e
commit 7eb969bbc2
56 changed files with 157 additions and 158 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import { logger } from "matrix-js-sdk/src/logger";
import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler";
import { MatrixRTCSession, MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc";
import type { GroupCall, Room } from "matrix-js-sdk/src/matrix";
import type { EmptyObject, GroupCall, Room } from "matrix-js-sdk/src/matrix";
import defaultDispatcher from "../dispatcher/dispatcher";
import { UPDATE_EVENT } from "./AsyncStore";
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
@@ -26,7 +26,7 @@ export enum CallStoreEvent {
ConnectedCalls = "connected_calls",
}
export class CallStore extends AsyncStoreWithClient<{}> {
export class CallStore extends AsyncStoreWithClient<EmptyObject> {
private static _instance: CallStore;
public static get instance(): CallStore {
if (!this._instance) {
+2 -4
View File
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { Room, RoomStateEvent, MatrixEvent, ClientEvent } from "matrix-js-sdk/src/matrix";
import { Room, RoomStateEvent, MatrixEvent, ClientEvent, EmptyObject } from "matrix-js-sdk/src/matrix";
import { IWidget } from "matrix-widget-api";
import { logger } from "matrix-js-sdk/src/logger";
@@ -19,8 +19,6 @@ import WidgetUtils from "../utils/WidgetUtils";
import { UPDATE_EVENT } from "./AsyncStore";
import { IApp } from "../utils/WidgetUtils-types";
interface IState {}
export type { IApp };
export function isAppWidget(widget: IWidget | IApp): widget is IApp {
@@ -36,7 +34,7 @@ interface IRoomWidgets {
// TODO consolidate WidgetEchoStore into this
// TODO consolidate ActiveWidgetStore into this
export default class WidgetStore extends AsyncStoreWithClient<IState> {
export default class WidgetStore extends AsyncStoreWithClient<EmptyObject> {
private static readonly internalInstance = (() => {
const instance = new WidgetStore();
instance.start();
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { Room, ClientEvent, SyncState } from "matrix-js-sdk/src/matrix";
import { Room, ClientEvent, SyncState, EmptyObject } from "matrix-js-sdk/src/matrix";
import { ActionPayload } from "../../dispatcher/payloads";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
@@ -19,11 +19,9 @@ import { VisibilityProvider } from "../room-list/filters/VisibilityProvider";
import { PosthogAnalytics } from "../../PosthogAnalytics";
import SettingsStore from "../../settings/SettingsStore";
interface IState {}
export const UPDATE_STATUS_INDICATOR = Symbol("update-status-indicator");
export class RoomNotificationStateStore extends AsyncStoreWithClient<IState> {
export class RoomNotificationStateStore extends AsyncStoreWithClient<EmptyObject> {
private static readonly internalInstance = (() => {
const instance = new RoomNotificationStateStore();
instance.start();
+10 -6
View File
@@ -6,7 +6,15 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { Room, RelationType, MatrixEvent, Thread, M_POLL_START, RoomEvent } from "matrix-js-sdk/src/matrix";
import {
Room,
RelationType,
MatrixEvent,
Thread,
M_POLL_START,
RoomEvent,
EmptyObject,
} from "matrix-js-sdk/src/matrix";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
import { ActionPayload } from "../../dispatcher/payloads";
@@ -76,10 +84,6 @@ const MAX_EVENTS_BACKWARDS = 50;
type TAG_ANY = "im.vector.any"; // eslint-disable-line @typescript-eslint/naming-convention
const TAG_ANY: TAG_ANY = "im.vector.any";
interface IState {
// Empty because we don't actually use the state
}
export interface MessagePreview {
event: MatrixEvent;
isThreadReply: boolean;
@@ -117,7 +121,7 @@ const mkMessagePreview = (text: string, event: MatrixEvent): MessagePreview => {
};
};
export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
export class MessagePreviewStore extends AsyncStoreWithClient<EmptyObject> {
private static readonly internalInstance = (() => {
const instance = new MessagePreviewStore();
instance.start();
+2 -3
View File
@@ -7,6 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { logger } from "matrix-js-sdk/src/logger";
import { EmptyObject } from "matrix-js-sdk/src/matrix";
import { TagID } from "./models";
import { ListLayout } from "./ListLayout";
@@ -14,9 +15,7 @@ import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import defaultDispatcher from "../../dispatcher/dispatcher";
import { ActionPayload } from "../../dispatcher/payloads";
interface IState {}
export default class RoomListLayoutStore extends AsyncStoreWithClient<IState> {
export default class RoomListLayoutStore extends AsyncStoreWithClient<EmptyObject> {
private static internalInstance: RoomListLayoutStore;
private readonly layoutMap = new Map<TagID, ListLayout>();
+2 -6
View File
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { MatrixClient, Room, RoomState, EventType } from "matrix-js-sdk/src/matrix";
import { MatrixClient, Room, RoomState, EventType, EmptyObject } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { logger } from "matrix-js-sdk/src/logger";
@@ -32,14 +32,10 @@ import { UPDATE_EVENT } from "../AsyncStore";
import { SdkContextClass } from "../../contexts/SDKContext";
import { getChangedOverrideRoomMutePushRules } from "./utils/roomMute";
interface IState {
// state is tracked in underlying classes
}
export const LISTS_UPDATE_EVENT = RoomListStoreEvent.ListsUpdate;
export const LISTS_LOADING_EVENT = RoomListStoreEvent.ListsLoading; // unused; used by SlidingRoomListStore
export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements Interface {
export class RoomListStoreClass extends AsyncStoreWithClient<EmptyObject> implements Interface {
/**
* Set to true if you're running tests on the store. Should not be touched in
* any other environment.
+2 -6
View File
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import { Room } from "matrix-js-sdk/src/matrix";
import { EmptyObject, Room } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { MSC3575Filter, SlidingSyncEvent } from "matrix-js-sdk/src/sliding-sync";
import { Optional } from "matrix-events-sdk";
@@ -23,10 +23,6 @@ import { LISTS_LOADING_EVENT } from "./RoomListStore";
import { UPDATE_EVENT } from "../AsyncStore";
import { SdkContextClass } from "../../contexts/SDKContext";
interface IState {
// state is tracked in underlying classes
}
export const SlidingSyncSortToFilter: Record<SortAlgorithm, string[]> = {
[SortAlgorithm.Alphabetic]: ["by_name", "by_recency"],
[SortAlgorithm.Recent]: ["by_notification_level", "by_recency"],
@@ -66,7 +62,7 @@ const filterConditions: Record<TagID, MSC3575Filter> = {
export const LISTS_UPDATE_EVENT = RoomListStoreEvent.ListsUpdate;
export class SlidingRoomListStoreClass extends AsyncStoreWithClient<IState> implements Interface {
export class SlidingRoomListStoreClass extends AsyncStoreWithClient<EmptyObject> implements Interface {
private tagIdToSortAlgo: Record<TagID, SortAlgorithm> = {};
private tagMap: ITagMap = {};
private counts: Record<TagID, number> = {};
+2 -3
View File
@@ -17,6 +17,7 @@ import {
MatrixEvent,
ClientEvent,
ISendEventResponse,
EmptyObject,
} from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { logger } from "matrix-js-sdk/src/logger";
@@ -63,8 +64,6 @@ import { SwitchSpacePayload } from "../../dispatcher/payloads/SwitchSpacePayload
import { AfterLeaveRoomPayload } from "../../dispatcher/payloads/AfterLeaveRoomPayload";
import { SdkContextClass } from "../../contexts/SDKContext";
interface IState {}
const ACTIVE_SPACE_LS_KEY = "mx_active_space";
const metaSpaceOrder: MetaSpace[] = [
@@ -123,7 +122,7 @@ type SpaceStoreActions =
| SwitchSpacePayload
| AfterLeaveRoomPayload;
export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
export class SpaceStoreClass extends AsyncStoreWithClient<EmptyObject> {
// The spaces representing the roots of the various tree-like hierarchies
private rootSpaces: Room[] = [];
// Map from room/space ID to set of spaces which list it as a child
+2 -1
View File
@@ -7,6 +7,7 @@
*/
import { ClientWidgetApi, Widget } from "matrix-widget-api";
import { EmptyObject } from "matrix-js-sdk/src/matrix";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import defaultDispatcher from "../../dispatcher/dispatcher";
@@ -24,7 +25,7 @@ export enum WidgetMessagingStoreEvent {
* going to be merged with a more complete WidgetStore, but for now it's
* easiest to split this into a single place.
*/
export class WidgetMessagingStore extends AsyncStoreWithClient<{}> {
export class WidgetMessagingStore extends AsyncStoreWithClient<EmptyObject> {
private static readonly internalInstance = (() => {
const instance = new WidgetMessagingStore();
instance.start();