LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-4184 [MISC] Enable Biome recommended, a11y and hooks lint rules and remove dead eslint-disable comments (#2303)
Jaseem Jase3647808158f
diff --git a/frontend/README.md b/frontend/README.mdindex 15a5f78d9..5c57d5ddd 100644--- a/frontend/README.md+++ b/frontend/README.md@@ -131,7 +131,7 @@ The project uses [Biome](https://biomejs.dev/) for linting and formatting - a fa- `bun run lint:all` - Run all Biome checks with auto-fix on all files- `bun run lint:changed` - Run Biome checks only on changed files-**Configuration:** Biome is configured via `biome.json` in the frontend directory.+**Configuration:** Biome is configured via `biome.json` in the frontend directory. Rules with existing violations run as warnings until they are cleaned up — see [docs/biome-rule-ratchet.md](docs/biome-rule-ratchet.md).**Note:** Make sure to run `bun install` first to install the required dependencies.diff --git a/frontend/biome.json b/frontend/biome.jsonindex 98f2ba8c3..eb98923c0 100644--- a/frontend/biome.json+++ b/frontend/biome.json@@ -17,8 +17,22 @@},"linter": {"enabled": true,+ "domains": { "react": "recommended" },"rules": {- "recommended": false,+ "recommended": true,+ "a11y": {+ "noLabelWithoutControl": "warn",+ "noNoninteractiveElementInteractions": "warn",+ "noRedundantRoles": "warn",+ "noStaticElementInteractions": "warn",+ "useAriaPropsSupportedByRole": "warn",+ "useButtonType": "warn",+ "useFocusableInteractive": "warn",+ "useGenericFontNames": "warn",+ "useKeyWithClickEvents": "warn",+ "useSemanticElements": "warn",+ "useValidAnchor": "warn"+ },"complexity": {"noAdjacentSpacesInRegex": "error","noArguments": "error",@@ -45,15 +59,21 @@"noUnreachableSuper": "error","noUnsafeFinally": "error","noUnsafeOptionalChaining": "error",+ "noUnusedImports": "warn","noUnusedLabels": "error","noUnusedVariables": "warn",+ "useExhaustiveDependencies": "warn",+ "useHookAtTopLevel": "warn","useIsNan": "error","useJsxKeyInIterable": "error","useValidForDirection": "error","useValidTypeof": "error","useYield": "error"},- "security": { "noDangerouslySetInnerHtmlWithChildren": "error" },+ "security": {+ "noDangerouslySetInnerHtml": "warn",+ "noDangerouslySetInnerHtmlWithChildren": "error"+ },"style": {"useArrayLiterals": "error","useBlockStatements": "warn",@@ -62,6 +82,8 @@"useSingleVarDeclarator": "error"},"suspicious": {+ "noArrayIndexKey": "warn",+ "noAssignInExpressions": "warn","noAsyncPromiseExecutor": "error","noCatchAssign": "error","noClassAssign": "error",@@ -86,6 +108,7 @@"noPrototypeBuiltins": "error","noRedeclare": "error","noShadowRestrictedNames": "error",+ "noShorthandPropertyOverrides": "warn","noSparseArray": "error","noUnsafeNegation": "error","noUselessRegexBackrefs": "error",diff --git a/frontend/docs/biome-rule-ratchet.md b/frontend/docs/biome-rule-ratchet.mdnew file mode 100644index 000000000..b83e7ff99--- /dev/null+++ b/frontend/docs/biome-rule-ratchet.md@@ -0,0 +1,84 @@+# Biome rule ratchet: warn now, error once clean++`biome.json` runs Biome's `recommended` set plus the React domain (hooks rules),+the whole `a11y` group and `noUnusedImports`. JSON allows no comments, so this+file records why some of those rules are `warn` and how each one becomes `error`.++## How severities are chosen++- **Recommended rules with no violations keep their default severity** — mostly+ `error`. They are enforced from day one, so nothing new can regress them.+- **Rules that already had violations are pinned to `warn`** in `biome.json`.+ `biome ci` does not fail on warnings, so CI stays green while the violations+ are burned down.+- **Every rule in the table below is headed for `error`**, whatever its+ default. `noUnusedImports` defaults to `warn`, so promoting it means setting it+ to `error` explicitly, not just deleting its entry.+- **Other recommended rules whose default is `warn` or `info`** (e.g.+ `noImportantStyles`, `noUnusedFunctionParameters`, `useLiteralKeys`) are left at+ that default and are not part of the ratchet.++## Both repos share this config++Cloud CI copies OSS `main`'s `frontend/`, overlays the cloud `src/plugins`, and+runs `biome ci src/plugins/` with this file. So a rule can only move to `error`+here once it is at **zero in OSS `src/` AND in cloud `src/plugins/`** — otherwise+the OSS change turns cloud `main` red with no cloud commit involved.++## Baseline++Measured with Biome 2.3.13 against OSS `f9dc6656` and cloud `7276f203`, after+this change. Only the rules pinned to `warn` are listed.++| Rule | OSS | Cloud | Follow-up |+|---|---:|---:|---|+| `correctness/useExhaustiveDependencies` | 431 | 530 | UN-4202 |+| `correctness/useHookAtTopLevel` | 15 | 10 | UN-4201 |+| `suspicious/noArrayIndexKey` | 8 | 28 | UN-4203 |+| `suspicious/noAssignInExpressions` | 13 | 1 | UN-4204 |+| `correctness/noUnusedImports` | 6 | 6 | UN-4204 |+| `suspicious/noShorthandPropertyOverrides` | 2 | 1 | UN-4204 |+| `security/noDangerouslySetInnerHtml` | 0 | 1 | UN-4204 |+| `a11y/noStaticElementInteractions` | 10 | 15 | UN-4194 |+| `a11y/noNoninteractiveElementInteractions` | 8 | 14 | UN-4194 |+| `a11y/useKeyWithClickEvents` | 5 | 14 | UN-4194 |+| `a11y/useSemanticElements` | 6 | 3 | UN-4194 |+| `a11y/useFocusableInteractive` | 3 | 0 | UN-4194 |+| `a11y/noLabelWithoutControl` | 2 | 0 | UN-4194 |+| `a11y/noRedundantRoles` | 2 | 0 | UN-4194 |+| `a11y/useAriaPropsSupportedByRole` | 1 | 0 | UN-4194 |+| `a11y/useButtonType` | 1 | 0 | UN-4194 |+| `a11y/useGenericFontNames` | 0 | 1 | UN-4194 |+| `a11y/useValidAnchor` | 0 | 1 | UN-4194 |++Reproduce a count (swap the rule; use `src/plugins/` in the cloud overlay):++```bash+cd frontend+bunx biome lint src/ --only=correctness/useHookAtTopLevel --max-diagnostics=none+```++## Order++1. **`useHookAtTopLevel`** (UN-4201) — a conditional hook call breaks React's hook order,+ so each hit is a potential bug, not style.+2. **Quick wins** (UN-4204) — small counts, mostly mechanical. `noUnusedImports` is a safe+ fix (`bun run check:fix`).+3. **a11y** (UN-4194) — the interaction rules share one cause: click handlers on+ `div`/`span`. Fixing each element usually clears three or four rules at once.+4. **`noArrayIndexKey`** (UN-4203) — give each list item a stable key.+5. **`useExhaustiveDependencies`** (UN-4202) — the bulk. Split it by area. Each fix changes+ when an effect runs, so review it as a behaviour change, not a lint fix.++## Promoting a rule++When a rule reaches zero in both repos, delete its `warn` entry from+`biome.json`, or set it to `error` if the rule's default is not `error`, in the+same PR as the last fix, and remove its row above. Land the cloud fixes first.++## Suppressions++Use `// biome-ignore <category>: <reason>` only where the code is deliberately+correct. Put it on the line before the hook or element Biome reports. The reason+must say why the code is right as written — "intentional" is not a reason.+`eslint-disable` comments do nothing under Biome; do not add them.diff --git a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsxindex 7fb50b6f9..44021630f 100644--- a/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx+++ b/frontend/src/components/custom-tools/custom-synonyms/CustomSynonyms.jsx@@ -132,8 +132,6 @@ function CustomSynonyms() {),};});- // handleChange/handleDelete close over `synonyms`, which is in the deps.- // eslint-disable-next-line react-hooks/exhaustive-deps}, [synonyms, isPublicSource]);const handleChange = (index, propertyName, value) => {diff --git a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsxindex 116e076ed..62060e54a 100644--- a/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx+++ b/frontend/src/components/custom-tools/list-of-tools/ListOfTools.jsx@@ -215,11 +215,11 @@ function ListOfTools({ segmentOptions, segmentValue, onSegmentChange }) {);fetchRef.current = getListOfTools;+ // biome-ignore lint/correctness/useExhaustiveDependencies: initial fetch on mount only; later fetches go through requestListuseEffect(() => {setSearchTerm("");setDisplayList(undefined);requestList(1, DEFAULT_PAGE_SIZE, "", sort.sortBy, sort.order);- // eslint-disable-next-line react-hooks/exhaustive-deps}, []);const handleAddNewTool = (body) => {diff --git a/frontend/src/components/custom-tools/prompt-card/Header.jsx b/frontend/src/components/custom-tools/prompt-card/Header.jsxindex 0f8e28d19..7690c6984 100644--- a/frontend/src/components/custom-tools/prompt-card/Header.jsx+++ b/frontend/src/components/custom-tools/prompt-card/Header.jsx@@ -68,7 +68,6 @@ try {// Sibling plugin loaded but this hook didn't — surface so the no-op fallback// doesn't silently disable the run gate.if (lookupPluginLoadError && LookupMenuItem) {- // eslint-disable-next-line no-consoleconsole.warn("[Header] lookup-studio plugin loaded but usePromptRunGate failed to import",lookupPluginLoadError,@@ -369,7 +368,6 @@ function Header({}return dropdownItems;- // eslint-disable-next-line react-hooks/exhaustive-deps}, [isDisablePrompt, required, enforceType, webhookEnabled, webhookUrl]);return (diff --git a/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx b/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsxindex 30aacb194..738e1832b 100644--- a/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx+++ b/frontend/src/components/custom-tools/prompt-card/PromptOutput.jsx@@ -72,7 +72,6 @@ const resolveCopyText = (promptOutputId, fallbackText) => {const enriched = getEnrichedCopyText(promptOutputId);return typeof enriched === "string" && enriched ? enriched : fallbackText;} catch (err) {- // eslint-disable-next-line no-consoleconsole.warn("[PromptOutput] getEnrichedCopyText threw:", err);return fallbackText;}diff --git a/frontend/src/components/groups/GroupMemberManager.jsx b/frontend/src/components/groups/GroupMemberManager.jsxindex dd01c2d13..8bd673b29 100644--- a/frontend/src/components/groups/GroupMemberManager.jsx+++ b/frontend/src/components/groups/GroupMemberManager.jsx@@ -52,12 +52,12 @@ function GroupMemberManager({ open, group, onClose }) {.finally(() => setLoading(false));};+ // biome-ignore lint/correctness/useExhaustiveDependencies: loadMembers is recreated every render; reload only when the dialog opens or the group changesuseEffect(() => {if (open) {loadMembers();setPendingAddIds([]);}- // eslint-disable-next-line react-hooks/exhaustive-deps}, [open, group?.id]);const memberIds = new Set(members.map((m) => m.user_id));diff --git a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsxindex bfad3a663..9cc0beed9 100644--- a/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx+++ b/frontend/src/components/tool-settings/tool-settings/ToolSettings.jsx@@ -196,6 +196,7 @@ function ToolSettings({ type }) {);fetchRef.current = getAdapters;+ // biome-ignore lint/correctness/useExhaustiveDependencies: reset only when the adapter type changes, not when resetList's identity doesuseEffect(() => {setDisplayList(undefined);if (!type) {@@ -205,7 +206,6 @@ function ToolSettings({ type }) {// together so the new type starts clean and later refreshes don't replay// the previous type's view.resetList();- // eslint-disable-next-line react-hooks/exhaustive-deps}, [type]);// New/edited adapters land on some page under the active sort — refetch thediff --git a/frontend/src/components/ui/calendar.tsx b/frontend/src/components/ui/calendar.tsxindex 801e02522..1a8bcb1aa 100644--- a/frontend/src/components/ui/calendar.tsx+++ b/frontend/src/components/ui/calendar.tsx@@ -4,7 +4,7 @@ import {ChevronRight,ChevronUp,} from "lucide-react";-import * as React from "react";+import type * as React from "react";import { DayPicker } from "react-day-picker";import { cn } from "@/lib/utils";diff --git a/frontend/src/components/ui/shims/antd-layout.tsx b/frontend/src/components/ui/shims/antd-layout.tsxindex 4e91c539d..63a5e543d 100644--- a/frontend/src/components/ui/shims/antd-layout.tsx+++ b/frontend/src/components/ui/shims/antd-layout.tsx@@ -202,7 +202,7 @@ const Space = React.forwardRef<HTMLDivElement, SpaceProps>(function Space(>{items.map((child, i) => (// The wrapper div is the whole point: existing CSS selects it.- // eslint-disable-next-line react/no-array-index-key+ // biome-ignore lint/suspicious/noArrayIndexKey: children carry no identity of their own; a wrapper's position is its identity, as in antd's Space<div key={i} className="ant-space-item">{child}{split && i < items.length - 1 ? split : null}diff --git a/frontend/src/helpers/GetStaticData.js b/frontend/src/helpers/GetStaticData.jsindex 9e067896c..4a0b5b28d 100644--- a/frontend/src/helpers/GetStaticData.js+++ b/frontend/src/helpers/GetStaticData.js@@ -78,8 +78,8 @@ const formatBytes = (bytes, decimals = 1) => {const i = Math.floor(Math.log(bytes) / Math.log(k));return sizes[i]- ? `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`- : `${bytes / Math.pow(k, i - 1)} ${sizes.at(-1)}`;+ ? `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`+ : `${bytes / k ** (i - 1)} ${sizes.at(-1)}`;};const O_AUTH_PROVIDERS = {@@ -394,7 +394,6 @@ const onboardCompleted = (adaptersList) => {const formattedDateTime = (ISOdateTime) => {if (ISOdateTime) {const validIsoDate = moment.utc(ISOdateTime).toISOString();- // eslint-disable-next-line new-capconst zone = Intl.DateTimeFormat().resolvedOptions().timeZone;return momentTz.tz(validIsoDate, zone).format("lll z");} else {@@ -662,7 +661,6 @@ function formatSecondsToHMS(seconds) {const formattedDateTimeWithSeconds = (ISOdateTime) => {if (ISOdateTime) {- // eslint-disable-next-line new-capconst zone = Intl.DateTimeFormat().resolvedOptions().timeZone;const zonedDate = parseISO(ISOdateTime);return format(zonedDate, "MMM d, yyyy h:mm:ss a zzz", { timeZone: zone });diff --git a/frontend/src/helpers/pdfWorkerConfig.js b/frontend/src/helpers/pdfWorkerConfig.jsindex e3f34852e..30322d7a7 100644--- a/frontend/src/helpers/pdfWorkerConfig.js+++ b/frontend/src/helpers/pdfWorkerConfig.js@@ -1,4 +1,3 @@// Load the worker file from the installed pdfjs-dist package// The ?url suffix tells Webpack 5 to return the URL of the asset-// eslint-disable-next-line import/no-unresolvedexport { default as PDF_WORKER_URL } from "pdfjs-dist/build/pdf.worker.min.js?url";diff --git a/frontend/src/hooks/useMetricsData.js b/frontend/src/hooks/useMetricsData.jsindex f12d6c177..c03726bf5 100644--- a/frontend/src/hooks/useMetricsData.js+++ b/frontend/src/hooks/useMetricsData.js@@ -76,7 +76,7 @@ function useMetricsOverview(startDate = null, endDate = null) {setLoading(false);setError(null);}- }, [orgId, startDate, endDate]); // eslint-disable-line react-hooks/exhaustive-deps+ }, [orgId, startDate, endDate]);// refetch bypasses cacheconst refetch = useCallback(() => fetchOverview(true), [fetchOverview]);@@ -127,7 +127,7 @@ function useRecentActivity(limit = 10) {setLoading(false);setError(null);}- }, [orgId, limit]); // eslint-disable-line react-hooks/exhaustive-deps+ }, [orgId, limit]);return { data, loading, error, refetch: fetchActivity };}@@ -204,7 +204,7 @@ function useDeploymentUsage(deploymentType, startDate, endDate) {setLoading(false);setError(null);}- }, [orgId, deploymentType, startDate, endDate]); // eslint-disable-line react-hooks/exhaustive-deps+ }, [orgId, deploymentType, startDate, endDate]);// refetch bypasses both frontend and backend cachesconst refetch = useCallback(() => fetchUsage(true), [fetchUsage]);@@ -275,7 +275,7 @@ function useSubscriptionUsage() {setLoading(false);setError(null);}- }, [orgId]); // eslint-disable-line react-hooks/exhaustive-deps+ }, [orgId]);return { data, loading, error, refetch: fetchUsage };}diff --git a/frontend/src/hooks/usePromptOutput.js b/frontend/src/hooks/usePromptOutput.jsindex c27a0dbf5..6f4ef40e4 100644--- a/frontend/src/hooks/usePromptOutput.js+++ b/frontend/src/hooks/usePromptOutput.js@@ -31,7 +31,6 @@ try {handleLookupOutput = mod.handleLookupOutput;} catch (error) {// Surface chunk-load failures — silent catch hid them.- // eslint-disable-next-line no-consoleconsole.warn("[usePromptOutput] handleLookupOutput unavailable:", error);}@@ -41,7 +40,6 @@ try {const mod = await import("../plugins/lookup-enriched-toggle/helpers");getEnrichmentFromItem = mod.getEnrichmentFromItem;} catch (error) {- // eslint-disable-next-line no-consoleconsole.warn("[usePromptOutput] getEnrichmentFromItem unavailable:", error);}@@ -155,7 +153,6 @@ const usePromptOutput = () => {handleLookupOutput(item.prompt_output_id, enrichment);}} catch (err) {- // eslint-disable-next-line no-consoleconsole.warn("[usePromptOutput] lookup enrichment failed:", err);}diff --git a/frontend/src/layouts/page-layout/PageLayout.jsx b/frontend/src/layouts/page-layout/PageLayout.jsxindex 54de5c161..7a5c6a483 100644--- a/frontend/src/layouts/page-layout/PageLayout.jsx+++ b/frontend/src/layouts/page-layout/PageLayout.jsx@@ -24,7 +24,6 @@ try {// Missing plugin is the expected case; surface anything else so a// broken plugin doesn't silently unmount its UI.if (!isModuleMissing(err)) {- // eslint-disable-next-line no-consoleconsole.error("[marketplace] MarketplacePendingBanner import failed unexpectedly",err,diff --git a/frontend/src/pages/ConnectorsPage.jsx b/frontend/src/pages/ConnectorsPage.jsxindex d637a7273..71c242d67 100644--- a/frontend/src/pages/ConnectorsPage.jsx+++ b/frontend/src/pages/ConnectorsPage.jsx@@ -155,10 +155,10 @@ function ConnectorsPage() {);fetchRef.current = getConnectors;+ // biome-ignore lint/correctness/useExhaustiveDependencies: initial fetch on mount only; later fetches go through requestList and fetchUsersuseEffect(() => {requestList(1, DEFAULT_PAGE_SIZE, "", sort.sortBy, sort.order);fetchUsers();- // eslint-disable-next-line react-hooks/exhaustive-deps}, []);const fetchUsers = async () => {diff --git a/frontend/src/routes/Router.jsx b/frontend/src/routes/Router.jsxindex 7bf1858fe..05bcea6b1 100644--- a/frontend/src/routes/Router.jsx+++ b/frontend/src/routes/Router.jsx@@ -131,7 +131,6 @@ try {llmWhispererRouter = mod.useLlmWhispererRoutes;} catch (err) {if (!isModuleMissing(err)) {- // eslint-disable-next-line no-consoleconsole.error("[llm-whisperer] routes import failed unexpectedly", err);}}@@ -142,7 +141,6 @@ try {verticalsRouter = mod.useVerticalsRoutes;} catch (err) {if (!isModuleMissing(err)) {- // eslint-disable-next-line no-consoleconsole.error("[verticals] routes import failed unexpectedly", err);}}diff --git a/frontend/src/routes/useMainAppRoutes.jsx b/frontend/src/routes/useMainAppRoutes.jsxindex 42c4d0461..b8234c44b 100644--- a/frontend/src/routes/useMainAppRoutes.jsx+++ b/frontend/src/routes/useMainAppRoutes.jsx@@ -196,7 +196,6 @@ try {PRODUCT_NAMES = mod.PRODUCT_NAMES ?? {};} catch (err) {if (!isModuleMissing(err)) {- // eslint-disable-next-line no-consoleconsole.error("[llm-whisperer] helper import failed unexpectedly", err);}}