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:
@@ -165,7 +165,9 @@ export function ScriptBuilderTab({
|
|||||||
|
|
||||||
// onViewScript is required by ScriptBuilderChat — provide a no-op for now
|
// onViewScript is required by ScriptBuilderChat — provide a no-op for now
|
||||||
// (inline preview is a future extension).
|
// (inline preview is a future extension).
|
||||||
const handleViewScript = (_script: string, _filename: string | null) => {
|
const handleViewScript = (script: string, filename: string | null) => {
|
||||||
|
void script
|
||||||
|
void filename
|
||||||
// Future: open inline preview panel
|
// Future: open inline preview panel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,11 +100,13 @@ export function useFlowPilotSession(): UseFlowPilotSession {
|
|||||||
setCurrentStep(firstStep)
|
setCurrentStep(firstStep)
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
// Prefer the backend's detail message over the generic axios status string
|
// 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')
|
const message = typeof detail === 'string' ? detail : (e instanceof Error ? e.message : 'Failed to start session')
|
||||||
setError(message)
|
setError(message)
|
||||||
// Global axios interceptor already shows a toast for 5xx — skip duplicate
|
// 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)
|
toast.error(message)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ export default function FlowPilotSessionPage() {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const prefill = (location.state as { prefill?: string } | null)?.prefill || ''
|
const prefill = (location.state as { prefill?: string } | null)?.prefill || ''
|
||||||
const psaTicketId = (location.state as any)?.psaTicketId as string | undefined
|
const locationState = location.state as { psaTicketId?: string; psaTicket?: PSATicketInfo } | null
|
||||||
const psaTicket = (location.state as any)?.psaTicket as PSATicketInfo | undefined
|
const psaTicketId = locationState?.psaTicketId
|
||||||
|
const psaTicket = locationState?.psaTicket
|
||||||
const isPickup = searchParams.get('pickup') === 'true'
|
const isPickup = searchParams.get('pickup') === 'true'
|
||||||
const fp = useFlowPilotSession()
|
const fp = useFlowPilotSession()
|
||||||
const branching = useBranching()
|
const branching = useBranching()
|
||||||
|
|||||||
@@ -141,23 +141,42 @@ export default function TicketsPage() {
|
|||||||
|
|
||||||
function updateFilters(updated: Partial<TicketFilters>) {
|
function updateFilters(updated: Partial<TicketFilters>) {
|
||||||
const next = new URLSearchParams(searchParams)
|
const next = new URLSearchParams(searchParams)
|
||||||
if ('search' in updated) updated.search ? next.set('search', updated.search!) : next.delete('search')
|
if ('search' in updated) {
|
||||||
if ('board_id' in updated) updated.board_id ? next.set('board', String(updated.board_id)) : next.delete('board')
|
if (updated.search) next.set('search', updated.search)
|
||||||
if ('status_id' in updated) updated.status_id ? next.set('status', String(updated.status_id)) : next.delete('status')
|
else next.delete('search')
|
||||||
if ('priority' in updated) updated.priority ? next.set('priority', updated.priority!) : next.delete('priority')
|
}
|
||||||
if ('company_id' in updated) updated.company_id ? next.set('company', String(updated.company_id)) : next.delete('company')
|
if ('board_id' in updated) {
|
||||||
if ('assigned' in updated) {
|
if (updated.board_id) next.set('board', String(updated.board_id))
|
||||||
const a = updated.assigned
|
else next.delete('board')
|
||||||
a === 'all' ? next.delete('assigned') : next.set('assigned', String(a))
|
}
|
||||||
|
if ('status_id' in updated) {
|
||||||
|
if (updated.status_id) next.set('status', String(updated.status_id))
|
||||||
|
else next.delete('status')
|
||||||
|
}
|
||||||
|
if ('priority' in updated) {
|
||||||
|
if (updated.priority) next.set('priority', updated.priority)
|
||||||
|
else next.delete('priority')
|
||||||
|
}
|
||||||
|
if ('company_id' in updated) {
|
||||||
|
if (updated.company_id) next.set('company', String(updated.company_id))
|
||||||
|
else next.delete('company')
|
||||||
|
}
|
||||||
|
if ('assigned' in updated) {
|
||||||
|
if (updated.assigned === 'all') next.delete('assigned')
|
||||||
|
else next.set('assigned', String(updated.assigned))
|
||||||
|
}
|
||||||
|
if ('include_closed' in updated) {
|
||||||
|
if (updated.include_closed) next.set('closed', 'true')
|
||||||
|
else next.delete('closed')
|
||||||
}
|
}
|
||||||
if ('include_closed' in updated) updated.include_closed ? next.set('closed', 'true') : next.delete('closed')
|
|
||||||
next.delete('page') // reset to 1 on filter change
|
next.delete('page') // reset to 1 on filter change
|
||||||
setSearchParams(next)
|
setSearchParams(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePage(p: number) {
|
function updatePage(p: number) {
|
||||||
const next = new URLSearchParams(searchParams)
|
const next = new URLSearchParams(searchParams)
|
||||||
p === 1 ? next.delete('page') : next.set('page', String(p))
|
if (p === 1) next.delete('page')
|
||||||
|
else next.set('page', String(p))
|
||||||
setSearchParams(next)
|
setSearchParams(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user