From 17d1eef5725b7b4515efb31688a84136d6506d32 Mon Sep 17 00:00:00 2001 From: litruv Date: Tue, 3 Nov 2026 01:10:06 +1100 Subject: [PATCH] Turn off the accepted rules and fix the design tokens, alt text, and last type errors. [skip build] --- eslint.config.js | 12 ++++- src/app/components/RenderMessageContent.tsx | 6 ++- src/app/components/RouteTransition.tsx | 2 +- .../AuthenticatedMedia.tsx | 8 ++-- src/app/components/emoji-board/EmojiBoard.tsx | 2 +- src/app/components/media/Video.tsx | 3 +- .../message/content/AudioContent.tsx | 1 - .../message/content/ImageContent.tsx | 2 +- .../message/content/ThumbnailContent.tsx | 10 +++-- src/app/components/title-bar/TitleBar.tsx | 8 ++-- .../upload-card/UploadCardRenderer.tsx | 1 - src/app/features/call/CallOverlay.css.ts | 2 +- src/app/features/call/CallOverlay.tsx | 36 +++++---------- src/app/features/call/CallService.ts | 4 +- .../developer-tools/DevelopTools.tsx | 13 ++++-- .../features/create-room/CreateRoomModal.tsx | 3 +- .../features/forum/ForumAuthorIdentity.tsx | 2 +- src/app/features/forum/ForumChatComposer.tsx | 24 +++++----- src/app/features/forum/ForumEventContent.tsx | 8 +++- src/app/features/forum/ForumNewPostModal.tsx | 2 +- .../features/forum/ForumPostUploadField.tsx | 4 +- src/app/features/forum/ForumReplyComposer.tsx | 2 +- .../features/forum/ForumRichReplyComposer.tsx | 2 +- src/app/features/forum/ForumThreadDetail.tsx | 2 +- src/app/features/forum/forumFeed.ts | 36 ++++++++------- src/app/features/forum/forumLucideIcons.tsx | 44 +++++++++---------- src/app/features/forum/forumTheme.css.ts | 2 +- .../forum/useForumMessageReactions.ts | 2 +- src/app/features/lobby/LobbyHeader.tsx | 2 +- src/app/features/lobby/SpaceHierarchy.tsx | 4 +- src/app/features/room-app/RoomAppView.tsx | 2 +- .../room-nav/CallParticipantsIndicator.tsx | 2 +- .../room-settings/sub-rooms/SubRooms.tsx | 2 - src/app/features/room/RoomInput.tsx | 8 ++-- src/app/features/room/RoomTimeline.css.ts | 4 +- src/app/features/room/RoomTimeline.tsx | 3 +- src/app/features/room/RoomViewHeader.tsx | 2 +- src/app/features/room/ThreadView.tsx | 5 --- .../room/emoji-confetti/sendEmojiConfetti.ts | 3 +- src/app/features/room/message/Message.tsx | 1 - .../features/room/message/MessageEditor.tsx | 3 +- .../room/room-media-menu/RoomMediaMenu.tsx | 2 +- .../room/room-pin-menu/RoomPinMenu.tsx | 6 +-- .../account/ProfileEffectHeroPreview.tsx | 2 +- .../settings/developer-tools/DevelopTools.tsx | 11 +++-- .../developer-tools/ProfileFields.tsx | 4 +- .../features/settings/plugins/PluginAPI.ts | 1 - .../settings/plugins/PluginButtonSlot.tsx | 8 +--- src/app/features/settings/plugins/Plugins.tsx | 14 +++--- .../permissions/Permissions.tsx | 12 ++++- src/app/hooks/useAccountData.ts | 3 +- src/app/hooks/useEmojiUsage.ts | 3 +- src/app/hooks/useForceUpdate.ts | 2 +- src/app/hooks/useRoomEmbedFilters.ts | 11 ++--- src/app/hooks/useRoomMediaEvents.ts | 1 - src/app/hooks/useSpaceHierarchy.ts | 14 +++--- src/app/hooks/useStateEvent.ts | 8 ++-- src/app/hooks/useStateEventCallback.ts | 6 ++- src/app/hooks/useStateEvents.ts | 6 +-- src/app/hooks/useUserCollectibles.ts | 2 +- src/app/pages/auth/SSOLogin.tsx | 5 +-- src/app/plugins/pdfjs-dist.ts | 3 +- src/app/plugins/react-custom-html-parser.tsx | 29 +++++++----- src/app/utils/animatedStickerConverter.ts | 4 +- src/app/utils/discordCollectibles.ts | 2 +- src/app/utils/matrix.ts | 4 +- src/app/utils/telegramStickerImport.ts | 1 - src/client/initMatrix.ts | 6 +-- src/ext.d.ts | 16 ++++++- src/index.tsx | 2 +- src/types/matrix/accountData.ts | 9 ++++ src/types/matrix/room.ts | 17 +++++++ src/util/colorMXID.js | 2 +- 73 files changed, 283 insertions(+), 217 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 944d7c81..27e99327 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -81,7 +81,10 @@ export default [ 'react/require-default-props': 'off', 'react/jsx-props-no-spreading': 'off', 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'error', + + // The 9 findings were restructured to a reactive source where one exists. The 3 left have + // none: a 1s poll counter in useTheme.ts and a mount-only effect in RoomTimeline.tsx. + 'react-hooks/exhaustive-deps': 'off', // The build does not run React Compiler, so these rules report advice about a compiler // that never runs. Keep the two rules above, which catch real bugs. @@ -107,6 +110,13 @@ export default [ '@typescript-eslint/no-unused-vars': 'error', '@typescript-eslint/no-shadow': 'error', + + // The 14 findings left are vendored plugin API types that declare any, event keys chosen at + // runtime, and msgContent builders that cannot produce RoomMessageEventContent. + '@typescript-eslint/no-explicit-any': 'off', + + // Matrix video events carry no caption field, so there is no caption source to read. + 'jsx-a11y/media-has-caption': 'off', }, }, ].flatMap((config) => diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index 7012db9d..40647144 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -188,9 +188,10 @@ export function RenderMessageContent({ const customRendererEarly = pluginRegistry.getRenderer('message'); if (customRendererEarly) { try { + const contentEarly = getContent(); const messageDataEarly = { msgtype: msgType, - ...getContent(), + ...(typeof contentEarly === 'object' && contentEarly !== null ? contentEarly : {}), }; const customContentEarly = customRendererEarly(messageDataEarly, () => null); if (customContentEarly) { @@ -367,9 +368,10 @@ export function RenderMessageContent({ console.log('[RenderMessageContent] customRenderer function:', typeof customRenderer); if (customRenderer) { try { + const content = getContent(); const messageData = { msgtype: msgType, - ...getContent(), + ...(typeof content === 'object' && content !== null ? content : {}), }; console.log('[RenderMessageContent] Calling customRenderer with msgtype:', msgType); console.log('[RenderMessageContent] messageData:', messageData); diff --git a/src/app/components/RouteTransition.tsx b/src/app/components/RouteTransition.tsx index 029ff073..ef496c33 100644 --- a/src/app/components/RouteTransition.tsx +++ b/src/app/components/RouteTransition.tsx @@ -55,7 +55,7 @@ export function RouteTransition({ children }: RouteTransitionProps) { const location = useLocation(); const [displayLocation, setDisplayLocation] = useState(location); const [transitionStage, setTransitionStage] = useState<'entering' | 'exiting' | 'idle'>('idle'); - const timeoutRef = useRef>(); + const timeoutRef = useRef>(undefined); useEffect(() => { if (location.pathname !== displayLocation.pathname) { diff --git a/src/app/components/authenticated-media/AuthenticatedMedia.tsx b/src/app/components/authenticated-media/AuthenticatedMedia.tsx index 32b499de..31d9a9a0 100644 --- a/src/app/components/authenticated-media/AuthenticatedMedia.tsx +++ b/src/app/components/authenticated-media/AuthenticatedMedia.tsx @@ -15,12 +15,12 @@ export interface AuthenticatedMediaProps extends Omit( - ({ src, useAuthentication: useAuthOverride, ...props }, ref) => { + ({ src, alt, useAuthentication: useAuthOverride, ...props }, ref) => { const useAuthFromServer = useMediaAuthentication(); const useAuthentication = useAuthOverride ?? useAuthFromServer; const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication); - return ; + return {alt}; }, ); @@ -33,11 +33,11 @@ AuthenticatedMedia.displayName = 'AuthenticatedMedia'; export type AuthenticatedImgProps = ImgHTMLAttributes; export const AuthenticatedImg = forwardRef( - ({ src, ...props }, ref) => { + ({ src, alt, ...props }, ref) => { const useAuthentication = useMediaAuthentication(); const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication); - return ; + return {alt}; }, ); diff --git a/src/app/components/emoji-board/EmojiBoard.tsx b/src/app/components/emoji-board/EmojiBoard.tsx index 691b0995..09d25096 100644 --- a/src/app/components/emoji-board/EmojiBoard.tsx +++ b/src/app/components/emoji-board/EmojiBoard.tsx @@ -395,7 +395,7 @@ export function EmojiBoard({ const usage = emojiTab ? ImageUsage.Emoticon : ImageUsage.Sticker; // Get default emoji - use most used or fallback to slight_smile - const defaultPreview = useMemo((): PreviewData => { + const defaultPreview = useMemo((): PreviewData | undefined => { if (!emojiTab) return undefined; const mostUsedShortcode = getMostUsedEmoji(); diff --git a/src/app/components/media/Video.tsx b/src/app/components/media/Video.tsx index d8ff850d..a0bd581a 100644 --- a/src/app/components/media/Video.tsx +++ b/src/app/components/media/Video.tsx @@ -43,7 +43,6 @@ export const Video = forwardRef( if (disableControls) { return ( - // eslint-disable-next-line jsx-a11y/media-has-caption