From 6ff910f26cf619ddf9c29f541fe2b12c042a3848 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Mon, 29 Jun 2026 09:32:30 +0100 Subject: [PATCH] Expand `any` type linting in frontend (#6808) # Description of Changes Continued effort to expand linting scope to ban the `any` type in our codebase. This PR pulls in a lot of subfolders into the linting scope, because the excluded list was getting short enough that it was feasible to move a layer down. I then fixed all the trivially fixable `any` type violations in the subfolders, which just required local changes to the one file. The aim of this PR is more to expand the scope to all the folders we can that already avoid `any` types, rather than actually fix violations. --- .../components/fileManager/FileListItem.tsx | 2 +- .../components/shared/signing/SignPopout.tsx | 8 +++-- .../addAttachments/AddAttachmentsSettings.tsx | 4 +-- .../AddPageNumbersAppearanceSettings.tsx | 12 +++++-- .../addPageNumbers/PageNumberPreview.tsx | 7 +++- .../AdjustContrastBasicSettings.tsx | 6 ++-- .../AdjustContrastColorSettings.tsx | 6 ++-- .../tools/compare/hooks/useComparePanZoom.ts | 8 ++--- .../extractImages/ExtractImagesSettings.tsx | 5 ++- .../viewer/hooks/useDocumentReady.ts | 2 +- .../hooks/tools/automate/useAutomationForm.ts | 2 +- .../hooks/tools/compare/operationUtils.ts | 2 +- .../hooks/tools/merge/useMergeOperation.ts | 4 +-- frontend/eslint.config.mjs | 36 ++++++++++++++----- 14 files changed, 69 insertions(+), 35 deletions(-) diff --git a/frontend/editor/src/core/components/fileManager/FileListItem.tsx b/frontend/editor/src/core/components/fileManager/FileListItem.tsx index 6cf1251d65..ae22ced51f 100644 --- a/frontend/editor/src/core/components/fileManager/FileListItem.tsx +++ b/frontend/editor/src/core/components/fileManager/FileListItem.tsx @@ -150,7 +150,7 @@ const FileListItem: React.FC = ({ shareLinks?: Array<{ token?: string }>; }>(`/api/v1/storage/files/${file.remoteStorageId}`, { suppressErrorToast: true, - } as any); + }); const links = response.data?.shareLinks ?? []; const token = links[links.length - 1]?.token; if (!token) { diff --git a/frontend/editor/src/core/components/shared/signing/SignPopout.tsx b/frontend/editor/src/core/components/shared/signing/SignPopout.tsx index aece0cb2da..a904c87246 100644 --- a/frontend/editor/src/core/components/shared/signing/SignPopout.tsx +++ b/frontend/editor/src/core/components/shared/signing/SignPopout.tsx @@ -536,8 +536,10 @@ const SignPopout = ({ pdfFile = new File([pdfResponse.data], session.documentName, { type: "application/pdf", }); - } catch (pdfError: any) { - if (pdfError?.response?.status === 404) { + } catch (pdfError: unknown) { + const status = (pdfError as { response?: { status?: number } }) + ?.response?.status; + if (status === 404) { // Finalized but signed PDF not available - backend issue alert({ alertType: "warning", @@ -760,7 +762,7 @@ const SignPopout = ({ // Update workbench data, preserving PDF and callbacks setCustomWorkbenchViewData( SESSION_DETAIL_WORKBENCH_ID, - (prevData: any) => ({ + (prevData: Record) => ({ ...prevData, session: response.data, }), diff --git a/frontend/editor/src/core/components/tools/addAttachments/AddAttachmentsSettings.tsx b/frontend/editor/src/core/components/tools/addAttachments/AddAttachmentsSettings.tsx index 9df438b429..4eaca5caa6 100644 --- a/frontend/editor/src/core/components/tools/addAttachments/AddAttachmentsSettings.tsx +++ b/frontend/editor/src/core/components/tools/addAttachments/AddAttachmentsSettings.tsx @@ -105,8 +105,8 @@ const AddAttachmentsSettings = ({ fontWeight: 400, lineHeight: 1.2, display: "-webkit-box", - WebkitLineClamp: 2 as any, - WebkitBoxOrient: "vertical" as any, + WebkitLineClamp: 2, + WebkitBoxOrient: "vertical", overflow: "hidden", whiteSpace: "normal", wordBreak: "break-word", diff --git a/frontend/editor/src/core/components/tools/addPageNumbers/AddPageNumbersAppearanceSettings.tsx b/frontend/editor/src/core/components/tools/addPageNumbers/AddPageNumbersAppearanceSettings.tsx index 79931d1295..627f7c1b9e 100644 --- a/frontend/editor/src/core/components/tools/addPageNumbers/AddPageNumbersAppearanceSettings.tsx +++ b/frontend/editor/src/core/components/tools/addPageNumbers/AddPageNumbersAppearanceSettings.tsx @@ -36,7 +36,10 @@ const AddPageNumbersAppearanceSettings = ({ label={t("addPageNumbers.selectText.2", "Margin")} value={parameters.customMargin} onChange={(v) => - onParameterChange("customMargin", (v as any) || "medium") + onParameterChange( + "customMargin", + (v as AddPageNumbersParameters["customMargin"]) || "medium", + ) } data={[ { value: "small", label: t("sizes.small", "Small") }, @@ -95,7 +98,12 @@ const AddPageNumbersAppearanceSettings = ({