chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17
CI / Build & Quality Checks (push) Successful in 10m13s
CI / Build & Quality Checks (push) Successful in 10m13s
- i18next 23->26 + react-i18next 15->17 - prettier 2->3, reformat all files - replace @fontsource/inter with @fontsource-variable/inter 5, update import path - domhandler 5->6 (aligns with transitive deps) - lint-staged 16->17
This commit is contained in:
+20
-19
@@ -33,7 +33,7 @@ import {
|
||||
export const getStateEvent = (
|
||||
room: Room,
|
||||
eventType: StateEvent,
|
||||
stateKey = ''
|
||||
stateKey = '',
|
||||
): MatrixEvent | undefined =>
|
||||
room.getLiveTimeline().getState(EventTimeline.FORWARDS)?.getStateEvents(eventType, stateKey) ??
|
||||
undefined;
|
||||
@@ -43,7 +43,7 @@ export const getStateEvents = (room: Room, eventType: StateEvent): MatrixEvent[]
|
||||
|
||||
export const getAccountData = (
|
||||
mx: MatrixClient,
|
||||
eventType: AccountDataEvent
|
||||
eventType: AccountDataEvent,
|
||||
): MatrixEvent | undefined => mx.getAccountData(eventType as any);
|
||||
|
||||
export const getMDirects = (mDirectEvent: MatrixEvent): Set<string> => {
|
||||
@@ -127,7 +127,7 @@ export const getSpaceChildren = (room: Room) =>
|
||||
export const mapParentWithChildren = (
|
||||
roomToParents: RoomToParents,
|
||||
roomId: string,
|
||||
children: string[]
|
||||
children: string[],
|
||||
) => {
|
||||
const allParents = getAllParents(roomToParents, roomId);
|
||||
children.forEach((childId) => {
|
||||
@@ -153,7 +153,7 @@ export const getRoomToParents = (mx: MatrixClient): RoomToParents => {
|
||||
export const getOrphanParents = (roomToParents: RoomToParents, roomId: string): string[] => {
|
||||
const parents = getAllParents(roomToParents, roomId);
|
||||
const orphanParents = Array.from(parents).filter(
|
||||
(parentRoomId) => !roomToParents.has(parentRoomId)
|
||||
(parentRoomId) => !roomToParents.has(parentRoomId),
|
||||
);
|
||||
|
||||
return orphanParents;
|
||||
@@ -261,7 +261,7 @@ export const getUnreadInfos = (mx: MatrixClient): UnreadInfo[] => {
|
||||
export const getRoomIconSrc = (
|
||||
icons: Record<IconName, IconSrc>,
|
||||
roomType?: string,
|
||||
joinRule?: JoinRule
|
||||
joinRule?: JoinRule,
|
||||
): IconSrc => {
|
||||
if (roomType === RoomType.Space) {
|
||||
if (joinRule === JoinRule.Public) return icons.SpaceGlobe;
|
||||
@@ -302,11 +302,12 @@ export const getRoomAvatarUrl = (
|
||||
mx: MatrixClient,
|
||||
room: Room,
|
||||
size: 32 | 96 = 32,
|
||||
useAuthentication = false
|
||||
useAuthentication = false,
|
||||
): string | undefined => {
|
||||
const mxcUrl = room.getMxcAvatarUrl();
|
||||
return mxcUrl
|
||||
? mx.mxcUrlToHttp(mxcUrl, size, size, 'crop', undefined, false, useAuthentication) ?? undefined
|
||||
? (mx.mxcUrlToHttp(mxcUrl, size, size, 'crop', undefined, false, useAuthentication) ??
|
||||
undefined)
|
||||
: undefined;
|
||||
};
|
||||
|
||||
@@ -314,7 +315,7 @@ export const getDirectRoomAvatarUrl = (
|
||||
mx: MatrixClient,
|
||||
room: Room,
|
||||
size: 32 | 96 = 32,
|
||||
useAuthentication = false
|
||||
useAuthentication = false,
|
||||
): string | undefined => {
|
||||
const mxcUrl = room.getAvatarFallbackMember()?.getMxcAvatarUrl();
|
||||
|
||||
@@ -349,10 +350,10 @@ export const parseReplyFormattedBody = (
|
||||
roomId: string,
|
||||
userId: string,
|
||||
eventId: string,
|
||||
formattedBody: string
|
||||
formattedBody: string,
|
||||
): string => {
|
||||
const replyToLink = `<a href="https://matrix.to/#/${encodeURIComponent(
|
||||
roomId
|
||||
roomId,
|
||||
)}/${encodeURIComponent(eventId)}">In reply to</a>`;
|
||||
const userLink = `<a href="https://matrix.to/#/${encodeURIComponent(userId)}">${userId}</a>`;
|
||||
|
||||
@@ -369,7 +370,7 @@ export const getMemberDisplayName = (room: Room, userId: string): string | undef
|
||||
export const getMemberSearchStr = (
|
||||
member: RoomMember,
|
||||
query: string,
|
||||
mxIdToName: (mxId: string) => string
|
||||
mxIdToName: (mxId: string) => string,
|
||||
): string[] => [
|
||||
member.rawDisplayName === member.userId ? mxIdToName(member.userId) : member.rawDisplayName,
|
||||
query.startsWith('@') || query.indexOf(':') > -1 ? member.userId : mxIdToName(member.userId),
|
||||
@@ -408,7 +409,7 @@ export const getEventReactions = (timelineSet: EventTimelineSet, eventId: string
|
||||
timelineSet.relations.getChildEventsForEvent(
|
||||
eventId,
|
||||
RelationType.Annotation,
|
||||
EventType.Reaction
|
||||
EventType.Reaction,
|
||||
);
|
||||
|
||||
export const getEventEdits = (timelineSet: EventTimelineSet, eventId: string, eventType: string) =>
|
||||
@@ -416,7 +417,7 @@ export const getEventEdits = (timelineSet: EventTimelineSet, eventId: string, ev
|
||||
|
||||
export const getLatestEdit = (
|
||||
targetEvent: MatrixEvent,
|
||||
editEvents: MatrixEvent[]
|
||||
editEvents: MatrixEvent[],
|
||||
): MatrixEvent | undefined => {
|
||||
const eventByTargetSender = (rEvent: MatrixEvent) =>
|
||||
rEvent.getSender() === targetEvent.getSender();
|
||||
@@ -426,7 +427,7 @@ export const getLatestEdit = (
|
||||
export const getEditedEvent = (
|
||||
mEventId: string,
|
||||
mEvent: MatrixEvent,
|
||||
timelineSet: EventTimelineSet
|
||||
timelineSet: EventTimelineSet,
|
||||
): MatrixEvent | undefined => {
|
||||
const edits = getEventEdits(timelineSet, mEventId, mEvent.getType());
|
||||
return edits && getLatestEdit(mEvent, edits.getRelations());
|
||||
@@ -447,7 +448,7 @@ export const canEditEvent = (mx: MatrixClient, mEvent: MatrixEvent) => {
|
||||
|
||||
export const getLatestEditableEvt = (
|
||||
timeline: EventTimeline,
|
||||
canEdit: (mEvent: MatrixEvent) => boolean
|
||||
canEdit: (mEvent: MatrixEvent) => boolean,
|
||||
): MatrixEvent | undefined => {
|
||||
const events = timeline.getEvents();
|
||||
|
||||
@@ -477,7 +478,7 @@ export const getMentionContent = (userIds: string[], room: boolean): IMentions =
|
||||
export const getCommonRooms = (
|
||||
mx: MatrixClient,
|
||||
rooms: string[],
|
||||
otherUserId: string
|
||||
otherUserId: string,
|
||||
): string[] => {
|
||||
const commonRooms: string[] = [];
|
||||
|
||||
@@ -523,7 +524,7 @@ export const getAllVersionsRoomCreator = (room: Room): Set<string> => {
|
||||
export const guessPerfectParent = (
|
||||
mx: MatrixClient,
|
||||
roomId: string,
|
||||
parents: string[]
|
||||
parents: string[],
|
||||
): string | undefined => {
|
||||
if (parents.length === 1) {
|
||||
return parents[0];
|
||||
@@ -539,7 +540,7 @@ export const guessPerfectParent = (
|
||||
|
||||
const powerLevels = getStateEvent(
|
||||
r,
|
||||
StateEvent.RoomPowerLevels
|
||||
StateEvent.RoomPowerLevels,
|
||||
)?.getContent<IPowerLevelsContent>();
|
||||
|
||||
const { users_default: usersDefault, users } = powerLevels ?? {};
|
||||
@@ -562,7 +563,7 @@ export const guessPerfectParent = (
|
||||
parents.forEach((parentId) => {
|
||||
const parentSpecialUsers = getSpecialUsers(parentId);
|
||||
const matchedUsersCount = parentSpecialUsers.filter((userId) =>
|
||||
roomSpecialUsers.includes(userId)
|
||||
roomSpecialUsers.includes(userId),
|
||||
).length;
|
||||
|
||||
if (matchedUsersCount > score) {
|
||||
|
||||
Reference in New Issue
Block a user