chore: upgrade i18next 26, prettier 3, fontsource-variable, domhandler 6, lint-staged 17

- 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:
Lotus Bot
2026-05-21 23:30:50 -04:00
parent b3666fa876
commit 61a1f008d0
363 changed files with 1443 additions and 1419 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ export function AutoDiscovery({ userId, baseUrl, children }: AutoDiscoveryProps)
useCallback(async () => {
const server = getMxIdServer(userId);
return autoDiscovery(fetch, server ?? userId);
}, [userId])
}, [userId]),
);
const [, info] = state.status === AsyncStatus.Success ? state.data : [];
@@ -25,7 +25,7 @@ export function AutoDiscovery({ userId, baseUrl, children }: AutoDiscoveryProps)
base_url: baseUrl,
},
}),
[baseUrl]
[baseUrl],
);
return <AutoDiscoveryInfoProvider value={info ?? fallback}>{children}</AutoDiscoveryInfoProvider>;
+4 -4
View File
@@ -100,7 +100,7 @@ function InviteNotifications() {
noti.close();
};
},
[navigate]
[navigate],
);
const playSound = useCallback(() => {
@@ -169,7 +169,7 @@ function MessageNotifications() {
notifRef.current?.close();
notifRef.current = noti;
},
[navigate]
[navigate],
);
const playSound = useCallback(() => {
@@ -183,7 +183,7 @@ function MessageNotifications() {
room,
toStartOfTimeline,
removed,
data
data,
) => {
if (mx.getSyncState() !== 'SYNCING') return;
if (document.hasFocus() && (selectedRoomId === room?.roomId || notificationSelected)) return;
@@ -218,7 +218,7 @@ function MessageNotifications() {
notify({
roomName: room.name ?? 'Unknown',
roomAvatar: avatarMxc
? mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined)
: undefined,
username: getMemberDisplayName(room, sender) ?? getMxIdLocalPart(sender) ?? sender,
roomId: room.roomId,
+3 -3
View File
@@ -154,11 +154,11 @@ export function ClientRoot({ children }: ClientRootProps) {
throw new Error('No session Found!');
}
return initClient(session);
}, [])
}, []),
);
const mx = loadState.status === AsyncStatus.Success ? loadState.data : undefined;
const [startState, startMatrix] = useAsyncCallback<void, Error, [MatrixClient]>(
useCallback((m) => startClient(m), [])
useCallback((m) => startClient(m), []),
);
useLogoutListener(mx);
@@ -181,7 +181,7 @@ export function ClientRoot({ children }: ClientRootProps) {
if (state === 'PREPARED') {
setLoading(false);
}
}, [])
}, []),
);
return (
+1 -1
View File
@@ -27,7 +27,7 @@ export function SyncStatus({ mx }: SyncStatusProps) {
}
return { current, previous };
});
}, [])
}, []),
);
if (
+5 -5
View File
@@ -195,10 +195,10 @@ export function Direct() {
if (a.size !== b.size) return false;
for (const id of a) if (!b.has(id)) return false;
return true;
}
},
),
[]
)
[],
),
);
const navigate = useNavigate();
@@ -224,7 +224,7 @@ export function Direct() {
});
const handleCategoryClick = useCategoryHandler(setClosedCategories, (categoryId) =>
closedCategories.has(categoryId)
closedCategories.has(categoryId),
);
return (
@@ -289,7 +289,7 @@ export function Direct() {
linkPath={getDirectRoomPath(getCanonicalAliasOrRoomId(mx, roomId))}
notificationMode={getRoomNotificationMode(
notificationPreferences,
room.roomId
room.roomId,
)}
/>
</VirtualTile>
+1 -1
View File
@@ -45,7 +45,7 @@ export function AddServer() {
const serverInputRef = useRef<HTMLInputElement>(null);
const [exploreState] = useAsyncCallback(
useCallback((server: string) => mx.publicRooms({ server, limit: 1 }), [mx])
useCallback((server: string) => mx.publicRooms({ server, limit: 1 }), [mx]),
);
const getInputServer = (): string | undefined => {
+3 -3
View File
@@ -55,7 +55,7 @@ const useServerSearchParams = (searchParams: URLSearchParams): ExploreServerPath
type: searchParams.get('type') ?? undefined,
instance: searchParams.get('instance') ?? undefined,
}),
[searchParams]
[searchParams],
);
type RoomTypeFilter = {
@@ -78,7 +78,7 @@ const useRoomTypeFilters = (): RoomTypeFilter[] =>
value: 'null',
},
],
[]
[],
);
const FALLBACK_ROOMS_LIMIT = 24;
@@ -393,7 +393,7 @@ export function PublicRooms() {
room_types: roomType !== undefined ? [roomType] : undefined,
},
third_party_instance_id: serverSearchParams.instance,
}
},
);
}, [mx, server, serverSearchParams]);
+7 -7
View File
@@ -222,10 +222,10 @@ export function Home() {
if (a.size !== b.size) return false;
for (const id of a) if (!b.has(id)) return false;
return true;
}
},
),
[]
)
[],
),
);
const navigate = useNavigate();
@@ -239,7 +239,7 @@ export function Home() {
const items = Array.from(rooms).sort(
closedCategories.has(DEFAULT_CATEGORY_ID)
? factoryRoomIdByActivity(mx)
: factoryRoomIdByAtoZ(mx)
: factoryRoomIdByAtoZ(mx),
);
if (closedCategories.has(DEFAULT_CATEGORY_ID)) {
return items.filter((rId) => roomsWithUnreadSet.has(rId) || rId === selectedRoomId);
@@ -255,7 +255,7 @@ export function Home() {
});
const handleCategoryClick = useCategoryHandler(setClosedCategories, (categoryId) =>
closedCategories.has(categoryId)
closedCategories.has(categoryId),
);
return (
@@ -313,7 +313,7 @@ export function Home() {
? withSearchParam<_RoomSearchParams>(path, {
viaServers: encodeSearchParamValueArray(viaServers),
})
: path
: path,
);
}}
/>
@@ -372,7 +372,7 @@ export function Home() {
linkPath={getHomeRoomPath(getCanonicalAliasOrRoomId(mx, roomId))}
notificationMode={getRoomNotificationMode(
notificationPreferences,
room.roomId
room.roomId,
)}
/>
</VirtualTile>
+10 -10
View File
@@ -107,7 +107,7 @@ const makeInviteData = (mx: MatrixClient, room: Room, useAuthentication: boolean
const senderId = memberEvent?.getSender();
const senderName = senderId
? getMemberDisplayName(room, senderId) ?? getMxIdLocalPart(senderId) ?? senderId
? (getMemberDisplayName(room, senderId) ?? getMxIdLocalPart(senderId) ?? senderId)
: undefined;
const inviteTs = memberEvent?.getTs();
const reason =
@@ -177,10 +177,10 @@ function InviteCard({
await addRoomIdToMDirect(mx, invite.roomId, dmUserId);
}
onNavigate(invite.roomId, invite.isSpace);
}, [mx, invite, userId, onNavigate])
}, [mx, invite, userId, onNavigate]),
);
const [leaveState, leave] = useAsyncCallback<Record<string, never>, MatrixError, []>(
useCallback(() => mx.leave(invite.roomId), [mx, invite])
useCallback(() => mx.leave(invite.roomId), [mx, invite]),
);
const joining =
@@ -482,7 +482,7 @@ function UnknownInvites({
const roomIds = invites.map((invite) => invite.roomId);
await rateLimitedActions(roomIds, (roomId) => mx.leave(roomId));
}, [mx, invites])
}, [mx, invites]),
);
const declining = declineAllStatus.status === AsyncStatus.Loading;
@@ -560,7 +560,7 @@ function SpamInvites({
const roomIds = invites.map((invite) => invite.roomId);
await rateLimitedActions(roomIds, (roomId) => mx.leave(roomId));
}, [mx, invites])
}, [mx, invites]),
);
const [reportAllStatus, reportAll] = useAsyncCallback(
@@ -568,18 +568,18 @@ function SpamInvites({
const roomIds = invites.map((invite) => invite.roomId);
await rateLimitedActions(roomIds, (roomId) => mx.reportRoom(roomId, 'Spam Invite'));
}, [mx, invites])
}, [mx, invites]),
);
const ignoredUsers = useIgnoredUsers();
const unignoredUsers = Array.from(new Set(invites.map((invite) => invite.senderId))).filter(
(user) => !ignoredUsers.includes(user)
(user) => !ignoredUsers.includes(user),
);
const [blockAllStatus, blockAll] = useAsyncCallback(
useCallback(
() => mx.setIgnoredUsers([...ignoredUsers, ...unignoredUsers]),
[mx, ignoredUsers, unignoredUsers]
)
[mx, ignoredUsers, unignoredUsers],
),
);
const declining = declineAllStatus.status === AsyncStatus.Loading;
@@ -736,7 +736,7 @@ export function Invites() {
const [compact, setCompact] = useState(document.body.clientWidth <= COMPACT_CARD_WIDTH);
useElementSizeObserver(
useCallback(() => containerRef.current, []),
useCallback((width) => setCompact(width <= COMPACT_CARD_WIDTH), [])
useCallback((width) => setCompact(width <= COMPACT_CARD_WIDTH), []),
);
const screenSize = useScreenSizeContext();
+21 -21
View File
@@ -111,7 +111,7 @@ type SilentReloadTimeline = () => Promise<void>;
const groupNotifications = (
notifications: INotification[],
allowRooms: Set<string>
allowRooms: Set<string>,
): RoomNotificationsGroup[] => {
const groups: RoomNotificationsGroup[] = [];
notifications.forEach((notification) => {
@@ -133,7 +133,7 @@ const groupNotifications = (
const useNotificationTimeline = (
paginationLimit: number,
onlyHighlight?: boolean
onlyHighlight?: boolean,
): [NotificationTimeline, LoadTimeline, SilentReloadTimeline] => {
const mx = useMatrixClient();
const allRooms = useAtomValue(allRoomsAtom);
@@ -149,10 +149,10 @@ const useNotificationTimeline = (
return mx.http.authedRequest<INotificationsResponse>(
Method.Get,
'/notifications',
queryParams
queryParams,
);
},
[mx]
[mx],
);
const loadTimeline: LoadTimeline = useCallback(
@@ -163,7 +163,7 @@ const useNotificationTimeline = (
const data = await fetchNotifications(
from,
paginationLimit,
onlyHighlight ? 'highlight' : undefined
onlyHighlight ? 'highlight' : undefined,
);
const groups = groupNotifications(data.notifications, allJoinedRooms);
@@ -177,7 +177,7 @@ const useNotificationTimeline = (
return currentTimeline;
});
},
[paginationLimit, onlyHighlight, fetchNotifications, allJoinedRooms]
[paginationLimit, onlyHighlight, fetchNotifications, allJoinedRooms],
);
/**
@@ -188,7 +188,7 @@ const useNotificationTimeline = (
const data = await fetchNotifications(
undefined,
paginationLimit,
onlyHighlight ? 'highlight' : undefined
onlyHighlight ? 'highlight' : undefined,
);
const groups = groupNotifications(data.notifications, allJoinedRooms);
setNotificationTimeline({
@@ -243,10 +243,10 @@ function RoomNotificationsGroupComp({
() => ({
...LINKIFY_OPTS,
render: factoryRenderLinkifyWithMention((href) =>
renderMatrixMention(mx, room.roomId, href, makeMentionCustomProps(mentionClickHandler))
renderMatrixMention(mx, room.roomId, href, makeMentionCustomProps(mentionClickHandler)),
),
}),
[mx, room, mentionClickHandler]
[mx, room, mentionClickHandler],
);
const htmlReactParserOptions = useMemo<HTMLReactParserOptions>(
() =>
@@ -256,7 +256,7 @@ function RoomNotificationsGroupComp({
handleSpoilerClick: spoilerClickHandler,
handleMentionClick: mentionClickHandler,
}),
[mx, room, linkifyOpts, mentionClickHandler, spoilerClickHandler, useAuthentication]
[mx, room, linkifyOpts, mentionClickHandler, spoilerClickHandler, useAuthentication],
);
const renderMatrixEvent = useMatrixEventRenderer<[IRoomEvent, string, GetContentCallback]>(
@@ -318,7 +318,7 @@ function RoomNotificationsGroupComp({
const editedEvent = getEditedEvent(
evt.event_id,
mEvent,
evtTimeline.getTimelineSet()
evtTimeline.getTimelineSet(),
);
const getContent = (() =>
editedEvent?.getContent()['m.new_content'] ??
@@ -395,7 +395,7 @@ function RoomNotificationsGroupComp({
</Text>
</Box>
);
}
},
);
const handleOpenClick: MouseEventHandler = (evt) => {
@@ -484,14 +484,14 @@ function RoomNotificationsGroupComp({
userId={event.sender}
src={
senderAvatarMxc
? mxcUrlToHttp(
? (mxcUrlToHttp(
mx,
senderAvatarMxc,
useAuthentication,
48,
48,
'crop'
) ?? undefined
'crop',
) ?? undefined)
: undefined
}
alt={displayName}
@@ -550,13 +550,13 @@ function RoomNotificationsGroupComp({
}
const useNotificationsSearchParams = (
searchParams: URLSearchParams
searchParams: URLSearchParams,
): InboxNotificationsPathSearchParams =>
useMemo(
() => ({
only: searchParams.get('only') ?? undefined,
}),
[searchParams]
[searchParams],
);
const DEFAULT_REFRESH_MS = 7000;
@@ -585,7 +585,7 @@ export function Notifications() {
setSearchParams(
new URLSearchParams({
only: 'highlight',
})
}),
);
return;
}
@@ -594,7 +594,7 @@ export function Notifications() {
const [notificationTimeline, _loadTimeline, silentReloadTimeline] = useNotificationTimeline(
24,
onlyHighlight
onlyHighlight,
);
const [timelineState, loadTimeline] = useAsyncCallback(_loadTimeline);
@@ -610,12 +610,12 @@ export function Notifications() {
useCallback(() => {
silentReloadTimeline();
}, [silentReloadTimeline]),
refreshIntervalTime
refreshIntervalTime,
);
const handleScrollTopVisibility = useCallback(
(onTop: boolean) => setRefreshIntervalTime(onTop ? DEFAULT_REFRESH_MS : -1),
[]
[],
);
useEffect(() => {
+1 -1
View File
@@ -121,7 +121,7 @@ export function CreateTab() {
? withSearchParam<_RoomSearchParams>(path, {
viaServers: encodeSearchParamValueArray(viaServers),
})
: path
: path,
);
}}
/>
+1 -1
View File
@@ -20,7 +20,7 @@ export function SettingsTab() {
const displayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
const avatarUrl = profile.avatarUrl
? mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined
? (mxcUrlToHttp(mx, profile.avatarUrl, useAuthentication, 96, 96, 'crop') ?? undefined)
: undefined;
const openSettings = () => setSettings(true);
+13 -13
View File
@@ -116,7 +116,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
const allChild = useSpaceChildren(
allRoomsAtom,
room.roomId,
useRecursiveChildScopeFactory(mx, roomToParents)
useRecursiveChildScopeFactory(mx, roomToParents),
);
const unread = useRoomsUnread(allChild, roomToUnreadAtom);
@@ -221,7 +221,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
</Box>
</Menu>
);
}
},
);
type InstructionType = Instruction['type'];
@@ -236,7 +236,7 @@ const useDraggableItem = (
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>,
onDragging: (item?: SidebarDraggable) => void,
dragHandleRef?: RefObject<HTMLElement>
dragHandleRef?: RefObject<HTMLElement>,
): boolean => {
const [dragging, setDragging] = useState(false);
@@ -266,7 +266,7 @@ const useDraggableItem = (
const useDropTarget = (
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>
targetRef: RefObject<HTMLElement>,
): Instruction | undefined => {
const [dropState, setDropState] = useState<Instruction>();
@@ -293,7 +293,7 @@ const useDropTarget = (
indentPerLevel: 0,
mode: 'standard',
block,
}
},
);
const instruction: Instruction | null = extractInstruction(insData);
@@ -315,7 +315,7 @@ const useDropTarget = (
function useDropTargetInstruction<T extends InstructionType>(
item: SidebarDraggable,
targetRef: RefObject<HTMLElement>,
instructionType: T
instructionType: T,
): T | undefined {
const [dropState, setDropState] = useState<T>();
@@ -351,8 +351,8 @@ const useDnDMonitor = (
onReorder: (
draggable: SidebarDraggable,
container: SidebarDraggable,
instruction: InstructionType
) => void
instruction: InstructionType,
) => void,
) => {
useEffect(() => {
const scrollElement = scrollRef.current;
@@ -377,7 +377,7 @@ const useDnDMonitor = (
}),
autoScrollForElements({
element: scrollElement,
})
}),
);
}, [scrollRef, onDragging, onReorder]);
};
@@ -412,7 +412,7 @@ function SpaceTab({
spaceId: space.roomId,
}
: space.roomId,
[folder, space]
[folder, space],
);
useDraggableItem(spaceDraggable, targetRef, onDragging);
@@ -754,8 +754,8 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent);
},
[mx, sidebarItems, setOpenedFolder, localEchoSidebarItem, orphanSpaces]
)
[mx, sidebarItems, setOpenedFolder, localEchoSidebarItem, orphanSpaces],
),
);
const selectedSpaceId = useSelectedSpace();
@@ -800,7 +800,7 @@ export function SpaceTabs({ scrollRef }: SpaceTabsProps) {
localEchoSidebarItem(parseSidebar(mx, orphanSpaces, newSpacesContent));
mx.setAccountData(AccountDataEvent.CinnySpaces, newSpacesContent);
},
[mx, sidebarItems, orphanSpaces, localEchoSidebarItem]
[mx, sidebarItems, orphanSpaces, localEchoSidebarItem],
);
if (sidebarItems.length === 0) return null;
@@ -29,7 +29,7 @@ function UnverifiedIndicator() {
const verificationStatus = useDeviceVerificationStatus(
crypto,
mx.getSafeUserId(),
currentDevice?.device_id
currentDevice?.device_id,
);
const unverified = verificationStatus === VerificationStatus.Unverified;
@@ -37,7 +37,7 @@ function UnverifiedIndicator() {
const unverifiedDeviceCount = useUnverifiedDeviceCount(
crypto,
mx.getSafeUserId(),
otherDevicesId
otherDevicesId,
);
const [settings, setSettings] = useState(false);
+1 -1
View File
@@ -23,7 +23,7 @@ export function SpaceSearch() {
const rooms = useSpaceChildren(
allRoomsAtom,
space.roomId,
useRecursiveChildRoomScopeFactory(mx, mDirects, roomToParents)
useRecursiveChildRoomScopeFactory(mx, mDirects, roomToParents),
);
return (
+11 -11
View File
@@ -109,7 +109,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(({ room, requestClo
const allChild = useSpaceChildren(
allRoomsAtom,
room.roomId,
useRecursiveChildScopeFactory(mx, roomToParents)
useRecursiveChildScopeFactory(mx, roomToParents),
);
const unread = useRoomsUnread(allChild, roomToUnreadAtom);
@@ -252,7 +252,7 @@ function SpaceHeader() {
const joinRules = useStateEvent(
space,
StateEvent.RoomJoinRules
StateEvent.RoomJoinRules,
)?.getContent<RoomJoinRulesEventContent>();
const handleOpenMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
@@ -325,7 +325,7 @@ export function SpaceTombstone({ roomId, replacementRoomId }: SpaceTombstoneProp
return mx.joinRoom(replacementRoomId, {
viaServers: via,
});
}, [mx, roomId, replacementRoomId])
}, [mx, roomId, replacementRoomId]),
);
const replacementRoom = mx.getRoom(replacementRoomId);
@@ -403,10 +403,10 @@ export function Space() {
if (a.size !== b.size) return false;
for (const id of a) if (!b.has(id)) return false;
return true;
}
},
),
[]
)
[],
),
);
const allRooms = useAtomValue(allRoomsAtom);
const allJoinedRooms = useMemo(() => new Set(allRooms), [allRooms]);
@@ -427,7 +427,7 @@ export function Space() {
}
return undefined;
},
[mx, allJoinedRooms]
[mx, allJoinedRooms],
);
const hierarchy = useSpaceJoinedHierarchy(
@@ -444,12 +444,12 @@ export function Space() {
callEmbed?.roomId === roomId;
return !showRoomAnyway;
},
[space.roomId, closedCategories, roomsWithUnreadSet, selectedRoomId, callEmbed]
[space.roomId, closedCategories, roomsWithUnreadSet, selectedRoomId, callEmbed],
),
useCallback(
(sId) => closedCategories.has(makeNavCategoryId(space.roomId, sId)),
[closedCategories, space.roomId]
)
[closedCategories, space.roomId],
),
);
const virtualizer = useVirtualizer({
@@ -460,7 +460,7 @@ export function Space() {
});
const handleCategoryClick = useCategoryHandler(setClosedCategories, (categoryId) =>
closedCategories.has(categoryId)
closedCategories.has(categoryId),
);
const getToLink = (roomId: string) =>