chore(ui): remove the bare-fetch lint rule (#29712)

* fix(ui): only flag bare fetch() outside React Query queryFn/mutationFn

The frontend lint rule banned every fetch() call by static AST name match,
so a fetch wrapped in a React Query queryFn/mutationFn tripped it just like
a loose fetch in a component. esquery (no-restricted-syntax) can't express
"has ancestor", so this replaces that selector with a small custom rule
(local/no-bare-fetch) that exempts a fetch lexically inside a queryFn or
mutationFn and reports everything else.

Re-baselined eslint-suppressions.json under the new rule id (same 44 files /
331 violations) so existing code keeps its grandfathered suppressions.

Adds a RuleTester suite covering wrapped (valid) vs unwrapped, the standalone
*Api.ts function pattern, queryKey, and computed-key cases.

* chore(ui): remove the bare-fetch lint rule

Drop the fetch lint gate (and its 331 grandfathered suppressions) ahead of
the networking refactor. The plan is to centralize all fetching in a single
shared http client and enforce that with a location-based rule, so keeping a
fetch rule in place now would only block CI while functions are routed
through the new client. Removing it unblocks that work; the location-based
rule lands with the client in a follow-up.
This commit is contained in:
ryan-crabbe-berri 2026-06-04 18:58:38 -07:00 committed by GitHub
parent 770fff7058
commit 41e90a6ada
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 209 deletions

View File

@ -4,86 +4,11 @@
"count": 1
}
},
"src/app/(dashboard)/hooks/accessGroups/useAccessGroupDetails.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/accessGroups/useDeleteAccessGroup.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/blogPosts/useBlogPosts.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/cloudzero/useCloudZeroCreate.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/cloudzero/useCloudZeroDryRun.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/cloudzero/useCloudZeroExport.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/cloudzero/useCloudZeroSettings.ts": {
"no-restricted-syntax": {
"count": 3
}
},
"src/app/(dashboard)/hooks/configOverrides/hashicorpVaultApi.ts": {
"no-restricted-syntax": {
"count": 4
}
},
"src/app/(dashboard)/hooks/guardrails/useRegisterGuardrail.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/healthReadiness/useHealthReadinessDetails.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/keys/useKeyAliases.test.ts": {
"react/display-name": {
"count": 1
}
},
"src/app/(dashboard)/hooks/keys/useKeys.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/keys/useResetKeySpend.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/models/useModels.ts": {
"max-params": {
"count": 1
@ -94,76 +19,26 @@
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useCreateProject.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useDeleteProject.test.ts": {
"react/display-name": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useDeleteProject.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useProjectDetails.test.ts": {
"react/display-name": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useProjectDetails.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useProjects.test.ts": {
"react/display-name": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useProjects.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useUpdateProject.test.ts": {
"react/display-name": {
"count": 1
}
},
"src/app/(dashboard)/hooks/projects/useUpdateProject.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/proxyConfig/useProxyConfig.ts": {
"no-restricted-syntax": {
"count": 2
}
},
"src/app/(dashboard)/hooks/router/useRouterFields.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/storeModelInDB/useStoreModelInDB.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/storeRequestInSpendLogs/useStoreRequestInSpendLogs.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/app/(dashboard)/hooks/teams/useTeams.ts": {
"no-restricted-syntax": {
"count": 2
}
},
"src/app/(dashboard)/layout.tsx": {
"react-hooks/set-state-in-effect": {
"count": 1
@ -356,11 +231,6 @@
"count": 1
}
},
"src/components/CostTrackingSettings/pricing_calculator/use_multi_cost_estimate.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/CostTrackingSettings/provider_discount_table.test.tsx": {
"unused-imports/no-unused-imports": {
"count": 1
@ -381,16 +251,6 @@
"count": 1
}
},
"src/components/CostTrackingSettings/use_discount_config.ts": {
"no-restricted-syntax": {
"count": 2
}
},
"src/components/CostTrackingSettings/use_margin_config.ts": {
"no-restricted-syntax": {
"count": 2
}
},
"src/components/CreateUserButton.tsx": {
"no-restricted-imports": {
"count": 1
@ -702,9 +562,6 @@
}
},
"src/components/WebRTCTester.jsx": {
"no-restricted-syntax": {
"count": 2
},
"react/no-unescaped-entities": {
"count": 2
}
@ -973,9 +830,6 @@
"no-restricted-imports": {
"count": 1
},
"no-restricted-syntax": {
"count": 3
},
"react-hooks/immutability": {
"count": 1
}
@ -1178,9 +1032,6 @@
"no-restricted-imports": {
"count": 1
},
"no-restricted-syntax": {
"count": 1
},
"react-hooks/set-state-in-effect": {
"count": 1
}
@ -1253,11 +1104,6 @@
"count": 1
}
},
"src/components/mcp_tools/ByokCredentialModal.tsx": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/mcp_tools/MCPLogoSelector.test.tsx": {
"unused-imports/no-unused-imports": {
"count": 1
@ -1502,9 +1348,6 @@
"src/components/networking.tsx": {
"max-params": {
"count": 23
},
"no-restricted-syntax": {
"count": 270
}
},
"src/components/object_permissions_view.tsx": {
@ -1621,11 +1464,6 @@
"count": 13
}
},
"src/components/playground/chat_ui/CodeInterpreterOutput.tsx": {
"no-restricted-syntax": {
"count": 2
}
},
"src/components/playground/chat_ui/CodeInterpreterTool.tsx": {
"no-restricted-imports": {
"count": 1
@ -1657,9 +1495,6 @@
"src/components/playground/llm_calls/a2a_send_message.tsx": {
"max-params": {
"count": 2
},
"no-restricted-syntax": {
"count": 2
}
},
"src/components/playground/llm_calls/anthropic_messages.tsx": {
@ -1685,14 +1520,6 @@
"src/components/playground/llm_calls/embeddings_api.tsx": {
"max-params": {
"count": 1
},
"no-restricted-syntax": {
"count": 1
}
},
"src/components/playground/llm_calls/fetch_agents.tsx": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/playground/llm_calls/image_edits.tsx": {
@ -1708,9 +1535,6 @@
"src/components/playground/llm_calls/interactions_api.tsx": {
"max-params": {
"count": 1
},
"no-restricted-syntax": {
"count": 1
}
},
"src/components/playground/llm_calls/responses_api.tsx": {
@ -1904,11 +1728,6 @@
"count": 1
}
},
"src/components/prompts/prompt_editor_view/conversation_panel/useConversation.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/prompts/prompt_info.tsx": {
"no-restricted-imports": {
"count": 1
@ -1970,11 +1789,6 @@
"count": 1
}
},
"src/components/survey/SurveyModal.tsx": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/tag_management/TagTable.tsx": {
"no-restricted-imports": {
"count": 1
@ -2037,11 +1851,6 @@
"count": 1
}
},
"src/components/team/useMyTeamMember.ts": {
"no-restricted-syntax": {
"count": 1
}
},
"src/components/templates/key_edit_view.tsx": {
"no-restricted-imports": {
"count": 1
@ -2069,9 +1878,6 @@
"no-restricted-imports": {
"count": 1
},
"no-restricted-syntax": {
"count": 3
},
"react-hooks/immutability": {
"count": 1
}
@ -2223,9 +2029,6 @@
}
},
"src/components/workflow_runs/index.tsx": {
"no-restricted-syntax": {
"count": 3
},
"react-hooks/set-state-in-effect": {
"count": 1
}
@ -2235,11 +2038,6 @@
"count": 1
}
},
"src/contexts/ThemeContext.tsx": {
"no-restricted-syntax": {
"count": 1
}
},
"src/data/claimsCompliancePrompts.ts": {
"max-params": {
"count": 1

View File

@ -32,13 +32,6 @@ const eslintConfig = [
"max-depth": ["warn", 4],
"max-params": ["error", 4],
"max-nested-callbacks": ["error", 4],
"no-restricted-syntax": [
"error",
{
selector: "CallExpression[callee.name='fetch']",
message: "Use React Query (@tanstack/react-query) for data fetching instead of a raw fetch().",
},
],
"no-restricted-imports": [
"error",
{