Skip to content

Commit fb08d9f

Browse files
authored
Merge branch 'develop' into renovate/matrix-org
2 parents 975f586 + 7d68753 commit fb08d9f

24 files changed

+425
-325
lines changed

.eslintrc.cjs

+8-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,13 @@ module.exports = {
112112
"@typescript-eslint/ban-ts-comment": "off",
113113
// We're okay with assertion errors when we ask for them
114114
"@typescript-eslint/no-non-null-assertion": "off",
115-
// We do this sometimes to brand interfaces
116-
"@typescript-eslint/no-empty-object-type": "off",
115+
"@typescript-eslint/no-empty-object-type": [
116+
"error",
117+
{
118+
// We do this sometimes to brand interfaces
119+
allowInterfaces: "with-single-extends",
120+
},
121+
],
117122

118123
"quotes": "off",
119124
// We use a `logger` intermediary module
@@ -147,6 +152,7 @@ module.exports = {
147152
// We don't need super strict typing in test utilities
148153
"@typescript-eslint/explicit-function-return-type": "off",
149154
"@typescript-eslint/explicit-member-accessibility": "off",
155+
"@typescript-eslint/no-empty-object-type": "off",
150156
},
151157
},
152158
],

.github/workflows/sonarcloud.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
# We create the status here and then update it to success/failure in the `report` stage
2929
# This provides an easy link to this workflow_run from the PR before Sonarcloud is done.
30-
- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
30+
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
3131
with:
3232
authToken: ${{ secrets.GITHUB_TOKEN }}
3333
state: pending
@@ -87,7 +87,7 @@ jobs:
8787
revision: ${{ github.event.workflow_run.head_sha }}
8888
token: ${{ secrets.SONAR_TOKEN }}
8989

90-
- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
90+
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
9191
if: always()
9292
with:
9393
authToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
steps:
117117
- name: Skip SonarCloud on merge queues
118118
if: env.ENABLE_COVERAGE == 'false'
119-
uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
119+
uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
120120
with:
121121
authToken: ${{ secrets.GITHUB_TOKEN }}
122122
state: success

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@babel/preset-typescript": "^7.12.7",
8282
"@casualbot/jest-sonar-reporter": "2.2.7",
8383
"@peculiar/webcrypto": "^1.4.5",
84-
"@stylistic/eslint-plugin": "^2.9.0",
84+
"@stylistic/eslint-plugin": "^3.0.0",
8585
"@types/bs58": "^4.0.1",
8686
"@types/content-type": "^1.1.5",
8787
"@types/debug": "^4.1.7",
@@ -96,7 +96,7 @@
9696
"debug": "^4.3.4",
9797
"eslint": "8.57.1",
9898
"eslint-config-google": "^0.14.0",
99-
"eslint-config-prettier": "^9.0.0",
99+
"eslint-config-prettier": "^10.0.0",
100100
"eslint-import-resolver-typescript": "^3.5.1",
101101
"eslint-plugin-import": "^2.26.0",
102102
"eslint-plugin-jest": "^28.0.0",

spec/test-utils/webrtc.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
import {
1818
ClientEvent,
1919
ClientEventHandlerMap,
20+
EmptyObject,
2021
EventType,
2122
GroupCall,
2223
GroupCallIntent,
@@ -466,7 +467,7 @@ export class MockCallMatrixClient extends TypedEventEmitter<EmittedEvents, Emitt
466467
[roomId: string, eventType: EventType, content: any, statekey: string]
467468
>();
468469
public sendToDevice = jest.fn<
469-
Promise<{}>,
470+
Promise<EmptyObject>,
470471
[eventType: string, contentMap: SendToDeviceContentMap, txnId?: string]
471472
>();
472473

spec/unit/rust-crypto/rust-crypto.spec.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
AccountDataEvents,
3434
Device,
3535
DeviceVerification,
36+
EmptyObject,
3637
encodeBase64,
3738
HttpApiEvent,
3839
HttpApiEventHandlerMap,
@@ -2348,7 +2349,7 @@ class DummyAccountDataClient
23482349
}
23492350
}
23502351

2351-
public async setAccountData(eventType: string, content: any): Promise<{}> {
2352+
public async setAccountData(eventType: string, content: any): Promise<EmptyObject> {
23522353
this.storage.set(eventType, content);
23532354
this.emit(
23542355
ClientEvent.AccountData,

src/@types/common.ts

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ export type NonEmptyArray<T> = [T, ...T[]];
2020
export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
2121
export type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
2222
export type Writeable<T> = { -readonly [P in keyof T]: T[P] };
23+
24+
export type EmptyObject = Record<PropertyKey, never>;

src/@types/event.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
import { IGroupCallRoomMemberState, IGroupCallRoomState } from "../webrtc/groupCall.ts";
3939
import { MSC3089EventContent } from "../models/MSC3089Branch.ts";
4040
import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon.ts";
41-
import { XOR } from "./common.ts";
41+
import { EmptyObject } from "./common.ts";
4242
import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events.ts";
4343
import {
4444
MCallAnswer,
@@ -337,7 +337,7 @@ export interface StateEvents {
337337
[EventType.RoomJoinRules]: RoomJoinRulesEventContent;
338338
[EventType.RoomMember]: RoomMemberEventContent;
339339
// XXX: Spec says this event has 3 required fields but kicking such an invitation requires sending `{}`
340-
[EventType.RoomThirdPartyInvite]: XOR<RoomThirdPartyInviteEventContent, {}>;
340+
[EventType.RoomThirdPartyInvite]: RoomThirdPartyInviteEventContent | EmptyObject;
341341
[EventType.RoomPowerLevels]: RoomPowerLevelsEventContent;
342342
[EventType.RoomName]: RoomNameEventContent;
343343
[EventType.RoomTopic]: RoomTopicEventContent;
@@ -351,13 +351,13 @@ export interface StateEvents {
351351
[EventType.SpaceChild]: SpaceChildEventContent;
352352
[EventType.SpaceParent]: SpaceParentEventContent;
353353

354-
[EventType.PolicyRuleUser]: XOR<PolicyRuleEventContent, {}>;
355-
[EventType.PolicyRuleRoom]: XOR<PolicyRuleEventContent, {}>;
356-
[EventType.PolicyRuleServer]: XOR<PolicyRuleEventContent, {}>;
354+
[EventType.PolicyRuleUser]: PolicyRuleEventContent | EmptyObject;
355+
[EventType.PolicyRuleRoom]: PolicyRuleEventContent | EmptyObject;
356+
[EventType.PolicyRuleServer]: PolicyRuleEventContent | EmptyObject;
357357

358358
// MSC3401
359359
[EventType.GroupCallPrefix]: IGroupCallRoomState;
360-
[EventType.GroupCallMemberPrefix]: XOR<IGroupCallRoomMemberState, XOR<SessionMembershipData, {}>>;
360+
[EventType.GroupCallMemberPrefix]: IGroupCallRoomMemberState | SessionMembershipData | EmptyObject;
361361

362362
// MSC3089
363363
[UNSTABLE_MSC3089_BRANCH.name]: MSC3089EventContent;
@@ -372,7 +372,7 @@ export interface StateEvents {
372372
export interface AccountDataEvents extends SecretStorageAccountDataEvents {
373373
[EventType.PushRules]: IPushRules;
374374
[EventType.Direct]: { [userId: string]: string[] };
375-
[EventType.IgnoredUserList]: { [userId: string]: {} };
375+
[EventType.IgnoredUserList]: { ignored_users: { [userId: string]: EmptyObject } };
376376
"m.secret_storage.default_key": { key: string };
377377
// Flag set by the rust SDK (Element X) and also used by us to mark that the user opted out of backup
378378
// (I don't know why it's m.org.matrix...)

src/@types/extensible_events.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ export type AnyRelation = TSNamespace<typeof REFERENCE_RELATION> | string;
9797
/**
9898
* An m.relates_to relationship
9999
*/
100-
export type RelatesToRelationship<R = never, C = never> = {
100+
export type RelatesToRelationship<R = never> = {
101101
"m.relates_to": {
102102
// See https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887 for array syntax
103103
rel_type: [R] extends [never] ? AnyRelation : TSNamespace<R>;
104104
event_id: string;
105-
} & DefaultNever<C, {}>;
105+
};
106106
};
107107

108108
/**

src/@types/global.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ declare global {
6060
};
6161
}
6262

63+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
6364
interface DummyInterfaceWeShouldntBeUsingThis {}
6465

6566
interface Navigator {

src/@types/polls.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
RelatesToRelationship,
2323
TSNamespace,
2424
} from "./extensible_events.ts";
25+
import { EmptyObject } from "./common.ts";
2526

2627
/**
2728
* Identifier for a disclosed poll.
@@ -109,7 +110,7 @@ export const M_POLL_END = new UnstableValue("m.poll.end", "org.matrix.msc3381.po
109110
/**
110111
* The event definition for an m.poll.end event (in content)
111112
*/
112-
export type PollEndEvent = EitherAnd<{ [M_POLL_END.name]: {} }, { [M_POLL_END.altName]: {} }>;
113+
export type PollEndEvent = EitherAnd<{ [M_POLL_END.name]: EmptyObject }, { [M_POLL_END.altName]: EmptyObject }>;
113114

114115
/**
115116
* The content for an m.poll.end event

0 commit comments

Comments
 (0)