Update dependency prettier to v3 (#12095)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
renovate[bot] 2024-01-02 18:56:39 +00:00 committed by GitHub
parent 773b03e15e
commit a0c8575113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 449 additions and 313 deletions

View file

@ -39,7 +39,7 @@ const getFakePosthog = (): PostHog =>
get_user_state: jest.fn(),
},
identifyUser: jest.fn(),
} as unknown as PostHog);
}) as unknown as PostHog;
interface ITestEvent extends IPosthogEvent {
eventName: "JestTestEvents";
@ -288,7 +288,7 @@ describe("PosthogAnalytics", () => {
id: "0000000",
pseudonymousAnalyticsOptIn: true,
}),
} as unknown as MatrixClient);
}) as unknown as MatrixClient;
beforeEach(async () => {
SdkConfig.put({

View file

@ -43,7 +43,7 @@ describe("AutocompleteInput", () => {
const constructMockProvider = (data: ICompletion[]) =>
({
getCompletions: jest.fn().mockImplementation(async () => data),
} as unknown as AutocompleteProvider);
}) as unknown as AutocompleteProvider;
beforeEach(() => {
TestUtils.stubClient();

View file

@ -31,7 +31,7 @@ describe("<ContextMenu />", () => {
({
windowWidth: windowSize,
windowHeight: windowSize,
} as unknown as UIStore),
}) as unknown as UIStore,
);
window.Element.prototype.getBoundingClientRect = jest.fn().mockReturnValue({
width: menuSize,

View file

@ -480,7 +480,7 @@ describe("MessageContextMenu", () => {
it("shows view in room button when the event is a thread root", () => {
const eventContent = createMessageEventContent("hello");
const mxEvent = new MatrixEvent({ type: EventType.RoomMessage, content: eventContent });
mxEvent.getThread = () => ({ rootEvent: mxEvent } as Thread);
mxEvent.getThread = () => ({ rootEvent: mxEvent }) as Thread;
const props = {
rightClick: true,
};

View file

@ -69,7 +69,7 @@ describe("<SpaceContextMenu />", () => {
client: mockClient,
getMyMembership: jest.fn(),
...props,
} as unknown as Room);
}) as unknown as Room;
const defaultProps = {
space: makeMockSpace(),

View file

@ -18,7 +18,6 @@ import React from "react";
import { MatrixClient, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { mocked, MockedObject } from "jest-mock";
import { render } from "@testing-library/react";
import * as prettier from "prettier";
import { getMockClientWithEventEmitter, mkEvent, mkMessage, mkStubRoom } from "../../../test-utils";
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
@ -225,11 +224,7 @@ describe("<TextualBody />", () => {
const ev = mkRoomTextMessage(`Visit https://matrix.to/#/${room1Id}/${defaultEvent.getId()}`);
const { container } = getComponent({ mxEvent: ev });
const content = container.querySelector(".mx_EventTile_body");
expect(
prettier.format(content.innerHTML.replace(defaultEvent.getId(), "%event_id%"), {
parser: "html",
}),
).toMatchSnapshot();
expect(content.innerHTML.replace(defaultEvent.getId(), "%event_id%")).toMatchSnapshot();
});
it("should pillify a permalink to an unknown message in the same room with the label »Message«", () => {
@ -243,11 +238,7 @@ describe("<TextualBody />", () => {
const ev = mkRoomTextMessage(`Visit https://matrix.to/#/${room2Id}/${defaultEvent.getId()}`);
const { container } = getComponent({ mxEvent: ev });
const content = container.querySelector(".mx_EventTile_body");
expect(
prettier.format(content.innerHTML.replace(defaultEvent.getId(), "%event_id%"), {
parser: "html",
}),
).toMatchSnapshot();
expect(content.innerHTML.replace(defaultEvent.getId(), "%event_id%")).toMatchSnapshot();
});
});

View file

@ -296,71 +296,9 @@ exports[`<TextualBody /> renders formatted m.text correctly pills get injected c
</span>
`;
exports[`<TextualBody /> renders plain-text m.text correctly should pillify a permalink to a message in the same room with the label »Message from Member« 1`] = `
"Visit
<span
><bdi
><a
class="mx_Pill mx_EventPill"
href="https://matrix.to/#/!room1:example.com/%event_id%"
data-state="closed"
><span
aria-label="Profile picture"
aria-hidden="true"
data-testid="avatar-img"
data-type="round"
data-color="8"
class="_avatar_1o69u_17 mx_BaseAvatar"
style="--cpd-avatar-size: 16px"
><img
loading="lazy"
alt=""
src="mxc://avatar.url/image.png"
crossorigin="anonymous"
referrerpolicy="no-referrer"
class="_image_1o69u_49"
data-type="round"
width="16px"
height="16px" /></span
><span class="mx_Pill_text">Message from Member</span></a
></bdi
></span
>
"
`;
exports[`<TextualBody /> renders plain-text m.text correctly should pillify a permalink to a message in the same room with the label »Message from Member« 1`] = `"Visit <span><bdi><a class="mx_Pill mx_EventPill" href="https://matrix.to/#/!room1:example.com/%event_id%" data-state="closed"><span aria-label="Profile picture" aria-hidden="true" data-testid="avatar-img" data-type="round" data-color="8" class="_avatar_1o69u_17 mx_BaseAvatar" style="--cpd-avatar-size: 16px;"><img loading="lazy" alt="" src="mxc://avatar.url/image.png" crossorigin="anonymous" referrerpolicy="no-referrer" class="_image_1o69u_49" data-type="round" width="16px" height="16px"></span><span class="mx_Pill_text">Message from Member</span></a></bdi></span>"`;
exports[`<TextualBody /> renders plain-text m.text correctly should pillify a permalink to an event in another room with the label »Message in Room 2« 1`] = `
"Visit
<span
><bdi
><a
class="mx_Pill mx_EventPill"
href="https://matrix.to/#/!room2:example.com/%event_id%"
data-state="closed"
><span
aria-label="Avatar"
aria-hidden="true"
data-testid="avatar-img"
data-type="round"
data-color="4"
class="_avatar_1o69u_17 mx_BaseAvatar"
style="--cpd-avatar-size: 16px"
><img
loading="lazy"
alt=""
src="mxc://avatar.url/room.png"
crossorigin="anonymous"
referrerpolicy="no-referrer"
class="_image_1o69u_49"
data-type="round"
width="16px"
height="16px" /></span
><span class="mx_Pill_text">Message in Room 2</span></a
></bdi
></span
>
"
`;
exports[`<TextualBody /> renders plain-text m.text correctly should pillify a permalink to an event in another room with the label »Message in Room 2« 1`] = `"Visit <span><bdi><a class="mx_Pill mx_EventPill" href="https://matrix.to/#/!room2:example.com/%event_id%" data-state="closed"><span aria-label="Avatar" aria-hidden="true" data-testid="avatar-img" data-type="round" data-color="4" class="_avatar_1o69u_17 mx_BaseAvatar" style="--cpd-avatar-size: 16px;"><img loading="lazy" alt="" src="mxc://avatar.url/room.png" crossorigin="anonymous" referrerpolicy="no-referrer" class="_image_1o69u_49" data-type="round" width="16px" height="16px"></span><span class="mx_Pill_text">Message in Room 2</span></a></bdi></span>"`;
exports[`<TextualBody /> renders plain-text m.text correctly should pillify a permalink to an unknown message in the same room with the label »Message« 1`] = `
<span

View file

@ -72,7 +72,7 @@ describe("<PinnedMessagesCard />", () => {
getTimelineForEvent: () => ({
getEvents: () => localPins,
}),
} as unknown as EventTimelineSet);
}) as unknown as EventTimelineSet;
// Return all pins over fetchRoomEvent
cli.fetchRoomEvent.mockImplementation((roomId, eventId) => {

View file

@ -255,7 +255,7 @@ describe("<RoomSummaryCard />", () => {
"@ernie:sesame.st": ["some-other-room-id", room.roomId],
},
}),
}[eventType]),
})[eventType],
);
getComponent();

View file

@ -68,7 +68,7 @@ const makeMockRoomMember = ({
getPrevContent: jest.fn().mockReturnValue({ membership: oldMembership, ...memberContent }),
},
},
} as unknown as RoomMember);
}) as unknown as RoomMember;
describe("<RoomPreviewBar />", () => {
const roomId = "RoomPreviewBar-test-room";

View file

@ -48,7 +48,7 @@ const constructMockProvider = (data: ICompletion[]) =>
getCompletions: jest.fn().mockImplementation(async () => data),
getName: jest.fn().mockReturnValue("test provider"),
renderCompletions: jest.fn().mockImplementation((components) => components),
} as unknown as AutocompleteProvider);
}) as unknown as AutocompleteProvider;
describe("WysiwygAutocomplete", () => {
beforeAll(() => {

View file

@ -227,7 +227,7 @@ describe("WysiwygComposer", () => {
getCompletions: jest.fn().mockImplementation(async () => data),
getName: jest.fn().mockReturnValue("test provider"),
renderCompletions: jest.fn().mockImplementation((components) => components),
} as unknown as AutocompleteProvider);
}) as unknown as AutocompleteProvider;
// for each test we will insert input simulating a user mention
const initialInput = "@abc";

View file

@ -984,7 +984,7 @@ describe("ElementCall", () => {
});
describe("create call", () => {
function setRoomMembers(memberIds: string[]) {
jest.spyOn(room, "getJoinedMembers").mockReturnValue(memberIds.map((id) => ({ userId: id } as RoomMember)));
jest.spyOn(room, "getJoinedMembers").mockReturnValue(memberIds.map((id) => ({ userId: id }) as RoomMember));
}
beforeEach(async () => {
setRoomMembers(["@user:example.com", "@user2:example.com", "@user4:example.com"]);

View file

@ -25,7 +25,10 @@ export class MockedCall extends Call {
public static readonly EVENT_TYPE = "org.example.mocked_call";
public readonly STUCK_DEVICE_TIMEOUT_MS = 1000 * 60 * 60; // 1 hour
private constructor(room: Room, public readonly event: MatrixEvent) {
private constructor(
room: Room,
public readonly event: MatrixEvent,
) {
super(
{
id: event.getStateKey()!,

View file

@ -136,7 +136,7 @@ describe("IncomingCallEvent", () => {
({
...notifyContent,
notify_type: "ring",
} as any);
}) as any;
const playMock = jest.fn();
const audio = { play: playMock, paused: true };

View file

@ -85,7 +85,7 @@ describe("shouldDisplayAsVoiceBroadcastTile", () => {
user: senderId,
content: {},
});
event.getContent = () => ({} as any);
event.getContent = () => ({}) as any;
});
itShouldReturnFalse();
@ -119,7 +119,7 @@ describe("shouldDisplayAsVoiceBroadcastTile", () => {
redacted_because: {} as unknown as IEvent,
},
});
event.getContent = () => ({} as any);
event.getContent = () => ({}) as any;
});
itShouldReturnTrue();