fix(lint): replace explicit-any types + unused-expressions ternaries
Five files, all stylistic: - useFlowPilotSession.ts: typed the axios error shape with a narrow inline type instead of \`as any\`. - FlowPilotSessionPage.tsx: same — typed location.state once, then destructured. - ScriptBuilderTab.tsx: handleViewScript was a placeholder no-op; declared the args properly with \`void script; void filename\` so the signature matches ScriptBuilderChatProps without no-unused-vars firing. - TicketsPage.tsx: replaced 8 ternaries-as-statements (\`x ? f() : g()\`) with proper if/else blocks. Same control flow, satisfies no-unused-expressions, and reads better in the URL-param update paths. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -100,11 +100,13 @@ export function useFlowPilotSession(): UseFlowPilotSession {
|
||||
setCurrentStep(firstStep)
|
||||
} catch (e: unknown) {
|
||||
// Prefer the backend's detail message over the generic axios status string
|
||||
const detail = (e as any)?.response?.data?.detail
|
||||
const axiosErr = e as { response?: { status?: number; data?: { detail?: unknown } } }
|
||||
const detail = axiosErr?.response?.data?.detail
|
||||
const message = typeof detail === 'string' ? detail : (e instanceof Error ? e.message : 'Failed to start session')
|
||||
setError(message)
|
||||
// Global axios interceptor already shows a toast for 5xx — skip duplicate
|
||||
if (!(e as any)?.response?.status || (e as any)?.response?.status < 500) {
|
||||
const status = axiosErr?.response?.status
|
||||
if (!status || status < 500) {
|
||||
toast.error(message)
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user