Enable @typescript-eslint/explicit-function-return-type in /src (#9788)

* Enable `@typescript-eslint/explicit-member-accessibility` on /src

* Prettier

* Enable `@typescript-eslint/explicit-function-return-type` in /src

* Fix types

* tsc strict fixes

* Delint

* Fix test

* Fix bad merge
This commit is contained in:
Michael Telatynski 2023-01-12 13:25:14 +00:00 committed by GitHub
parent 7a36ba0fde
commit 030b7e90bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
683 changed files with 3459 additions and 3013 deletions

View file

@ -17,7 +17,8 @@ limitations under the License.
import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
import { RoomState, RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
/**
* Approximation of a membership status for a given room.
@ -84,10 +85,15 @@ export function isJoinedOrNearlyJoined(membership: string): boolean {
* NOTE: this assumes you've just created the room and there's not been an opportunity
* for other code to run, so we shouldn't miss RoomState.newMember when it comes by.
*/
export async function waitForMember(client: MatrixClient, roomId: string, userId: string, opts = { timeout: 1500 }) {
export async function waitForMember(
client: MatrixClient,
roomId: string,
userId: string,
opts = { timeout: 1500 },
): Promise<boolean> {
const { timeout } = opts;
let handler;
return new Promise((resolve) => {
let handler: (event: MatrixEvent, state: RoomState, member: RoomMember) => void;
return new Promise<boolean>((resolve) => {
// eslint-disable-next-line @typescript-eslint/naming-convention
handler = function (_, __, member: RoomMember) {
if (member.userId !== userId) return;