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
|
||||
// (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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -19,8 +19,9 @@ export default function FlowPilotSessionPage() {
|
||||
const navigate = useNavigate()
|
||||
const location = useLocation()
|
||||
const prefill = (location.state as { prefill?: string } | null)?.prefill || ''
|
||||
const psaTicketId = (location.state as any)?.psaTicketId as string | undefined
|
||||
const psaTicket = (location.state as any)?.psaTicket as PSATicketInfo | undefined
|
||||
const locationState = location.state as { psaTicketId?: string; psaTicket?: PSATicketInfo } | null
|
||||
const psaTicketId = locationState?.psaTicketId
|
||||
const psaTicket = locationState?.psaTicket
|
||||
const isPickup = searchParams.get('pickup') === 'true'
|
||||
const fp = useFlowPilotSession()
|
||||
const branching = useBranching()
|
||||
|
||||
@@ -141,23 +141,42 @@ export default function TicketsPage() {
|
||||
|
||||
function updateFilters(updated: Partial<TicketFilters>) {
|
||||
const next = new URLSearchParams(searchParams)
|
||||
if ('search' in updated) updated.search ? next.set('search', updated.search!) : next.delete('search')
|
||||
if ('board_id' in updated) updated.board_id ? next.set('board', String(updated.board_id)) : next.delete('board')
|
||||
if ('status_id' in updated) updated.status_id ? next.set('status', String(updated.status_id)) : next.delete('status')
|
||||
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 ('assigned' in updated) {
|
||||
const a = updated.assigned
|
||||
a === 'all' ? next.delete('assigned') : next.set('assigned', String(a))
|
||||
if ('search' in updated) {
|
||||
if (updated.search) next.set('search', updated.search)
|
||||
else next.delete('search')
|
||||
}
|
||||
if ('board_id' in updated) {
|
||||
if (updated.board_id) next.set('board', String(updated.board_id))
|
||||
else next.delete('board')
|
||||
}
|
||||
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
|
||||
setSearchParams(next)
|
||||
}
|
||||
|
||||
function updatePage(p: number) {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user