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.
This commit is contained in:
James Brunton
2026-06-29 08:32:30 +00:00
committed by GitHub
parent 013f145462
commit 6ff910f26c
14 changed files with 69 additions and 35 deletions
@@ -150,7 +150,7 @@ const FileListItem: React.FC<FileListItemProps> = ({
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) {
@@ -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<string, unknown>) => ({
...prevData,
session: response.data,
}),
@@ -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",
@@ -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 = ({
<Select
label={t("addPageNumbers.fontName", "Font Type")}
value={parameters.fontType}
onChange={(v) => onParameterChange("fontType", (v as any) || "Times")}
onChange={(v) =>
onParameterChange(
"fontType",
(v as AddPageNumbersParameters["fontType"]) || "Times",
)
}
data={[
{ value: "Times", label: "Times Roman" },
{ value: "Helvetica", label: "Helvetica" },
@@ -260,7 +260,12 @@ export default function PageNumberPreview({
key={idx}
type="button"
className={`${styles.gridTile} ${selected || hoverTile === idx ? styles.gridTileSelected : ""} ${hoverTile === idx ? styles.gridTileHovered : ""}`}
onClick={() => onParameterChange("position", idx as any)}
onClick={() =>
onParameterChange(
"position",
idx as AddPageNumbersParameters["position"],
)
}
onMouseEnter={() => setHoverTile(idx)}
onMouseLeave={() => setHoverTile(null)}
style={{
@@ -24,19 +24,19 @@ export default function AdjustContrastBasicSettings({
<SliderWithInput
label={t("adjustContrast.contrast", "Contrast")}
value={parameters.contrast}
onChange={(v) => onParameterChange("contrast", v as any)}
onChange={(v) => onParameterChange("contrast", v)}
disabled={disabled}
/>
<SliderWithInput
label={t("adjustContrast.brightness", "Brightness")}
value={parameters.brightness}
onChange={(v) => onParameterChange("brightness", v as any)}
onChange={(v) => onParameterChange("brightness", v)}
disabled={disabled}
/>
<SliderWithInput
label={t("adjustContrast.saturation", "Saturation")}
value={parameters.saturation}
onChange={(v) => onParameterChange("saturation", v as any)}
onChange={(v) => onParameterChange("saturation", v)}
disabled={disabled}
/>
</Stack>
@@ -24,19 +24,19 @@ export default function AdjustContrastColorSettings({
<SliderWithInput
label={t("adjustContrast.red", "Red")}
value={parameters.red}
onChange={(v) => onParameterChange("red", v as any)}
onChange={(v) => onParameterChange("red", v)}
disabled={disabled}
/>
<SliderWithInput
label={t("adjustContrast.green", "Green")}
value={parameters.green}
onChange={(v) => onParameterChange("green", v as any)}
onChange={(v) => onParameterChange("green", v)}
disabled={disabled}
/>
<SliderWithInput
label={t("adjustContrast.blue", "Blue")}
value={parameters.blue}
onChange={(v) => onParameterChange("blue", v as any)}
onChange={(v) => onParameterChange("blue", v)}
disabled={disabled}
/>
</Stack>
@@ -523,10 +523,10 @@ export const useComparePanZoom = ({
};
el.addEventListener("scroll", onScroll, { passive: true });
return () => {
el.removeEventListener("wheel", onStart as any);
el.removeEventListener("mousedown", onStart as any);
el.removeEventListener("touchstart", onStart as any);
el.removeEventListener("scroll", onScroll as any);
el.removeEventListener("wheel", onStart);
el.removeEventListener("mousedown", onStart);
el.removeEventListener("touchstart", onStart);
el.removeEventListener("scroll", onScroll);
if (timeout != null) window.clearTimeout(timeout);
};
};
@@ -26,9 +26,8 @@ const ExtractImagesSettings = ({
value={parameters.format}
onChange={(value) => {
const allowedFormats = ["png", "jpg", "gif"] as const;
const format = allowedFormats.includes(value as any)
? (value as (typeof allowedFormats)[number])
: "png";
const candidate = value as (typeof allowedFormats)[number];
const format = allowedFormats.includes(candidate) ? candidate : "png";
onParameterChange("format", format);
}}
data={[
@@ -26,7 +26,7 @@ export function useDocumentReady() {
let mounted = true;
const unsubOpen = documentManagerCapability.onDocumentOpened?.(
(event: any) => {
(event: { documentId?: string; id?: string }) => {
if (mounted && (event?.documentId || event?.id)) {
setDocumentReady(true);
}
@@ -33,7 +33,7 @@ export function useAutomationForm({
const getToolName = useCallback(
(operation: string) => {
const tool = toolRegistry?.[operation as ToolId] as any;
const tool = toolRegistry?.[operation as ToolId];
return tool?.name || t(`tools.${operation}.name`, operation);
},
[toolRegistry, t],
@@ -368,7 +368,7 @@ export const extractContentFromPdf = async (
const prevX = prev.transform[4];
const approxLine = Math.max(
10,
Math.abs((curr as any).height ?? 0) * 0.9,
Math.abs((curr as { height?: number }).height ?? 0) * 0.9,
);
const looksLikeParagraph = dy > approxLine * 1.8;
const likelySoftWrap = currX < prevX && dy < approxLine * 0.6;
@@ -20,8 +20,8 @@ const buildFormData = (
formData.append("fileInput", file);
});
// Provide stable client file IDs (align with files order)
const clientIds: string[] = files.map((f: any) =>
String((f as any).fileId || f.name),
const clientIds: string[] = files.map((f) =>
String((f as { fileId?: string }).fileId || f.name),
);
formData.append("clientFileIds", JSON.stringify(clientIds));
formData.append("sortType", "orderProvided"); // Always use orderProvided since UI handles sorting
+28 -8
View File
@@ -207,18 +207,38 @@ export default defineConfig(
},
},
// Stricter rules that not all sub-folders are conformant to yet.
// Keep this non-type-aware: `parserOptions.project`/`projectService` here OOMs
// the lint step (builds the whole TS program); tsc covers type correctness.
{
files: srcGlobs,
ignores: [
"editor/src/core/components/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/contexts/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/services/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/annotation/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/pageEditor/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/pageEditor/commands/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/pageEditor/hooks/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/shared/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/shared/config/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/shared/config/configSections/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/shared/pageEditor/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/addStamp/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/automate/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/bookletImposition/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/certSign/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/pdfTextEditor/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/tools/shared/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/components/viewer/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/contexts/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/contexts/file/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/contexts/viewer/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/signing/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/tools/adjustContrast/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/tools/convert/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/tools/removePassword/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/hooks/tools/shared/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/services/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/tools/annotate/useAnnotationSelection.ts",
"editor/src/core/types/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/utils/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/types/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/utils/*.{js,mjs,jsx,ts,tsx}",
],
rules: {
"@typescript-eslint/no-explicit-any": "error",