refactor: explicit returns + void floating promises (T3.a typeaware sweep) (#756)
Cluster T3.a — mechanical fixes for consistent-return and no-floating-promises. Files touched (15): - server/shared/tool-call-display.ts — default throw in buildCanonicalDetailDisplay switch - server/agent/prompt-attachments.ts — default throw in renderPromptAttachmentAsText switch - server/workspace-directory.ts — default throw in getSortValue switch - server/agent/mcp-server.ts — default throw in mcpCreateWorktreeInput switch - server/terminal/terminal-session-controller.ts — default return in dispatch switch - server/daemon-e2e/agent-configs.ts — default return false in isProviderAvailable switch - server/agent/agent-manager.ts — void dispatchSessionEvent fire-and-forget call - server/agent/mcp-shared.ts — void 4 notify() floating calls - app/agent-status-bar.utils.ts — default throw in getStatusSelectorHint switch - app/keyboard-shortcuts.ts — default throw in resolvePayload switch - app/resolve-agent-form.ts — default throw in resolveAgentForm switch - app/ui/dropdown-menu.tsx — void .then() + return undefined for promise/always-return - app/use-agent-form-state.ts — void refreshSnapshot() floating call - cli/worktree/create.ts — default throw in toDaemonCreateInput switch - cli/onboard.ts — return process.exit(1) to satisfy consistent-return in catch Deferred (outside 15-file cap or in EXCLUDE list): - server/worktree-session.ts — getSortValue (same pattern, cap reached) - Multiple files with other errors (unbound-method, unsafe-type-assertion) are separate clusters
This commit is contained in:
@@ -11,6 +11,8 @@ export function getStatusSelectorHint(selector: ExplainedStatusSelector): string
|
||||
return "Change model";
|
||||
case "mode":
|
||||
return "Change permission mode";
|
||||
default:
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ export function DropdownMenuContent({
|
||||
setTriggerRect(null);
|
||||
setContentSize(null);
|
||||
setPosition(null);
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Capture status bar height synchronously before async measurement.
|
||||
@@ -454,8 +454,8 @@ export function DropdownMenuContent({
|
||||
const statusBarHeight = Platform.OS === "android" ? (StatusBar.currentHeight ?? 0) : 0;
|
||||
let cancelled = false;
|
||||
|
||||
measureElement(triggerRef.current).then((rect) => {
|
||||
if (cancelled) return;
|
||||
void measureElement(triggerRef.current).then((rect) => {
|
||||
if (cancelled) return undefined;
|
||||
// On Android with statusBarTranslucent, measureInWindow returns coordinates
|
||||
// relative to below the status bar, but Modal content starts from screen top.
|
||||
// Add status bar height to align coordinate systems (same as react-native-popover-view).
|
||||
@@ -463,7 +463,7 @@ export function DropdownMenuContent({
|
||||
...rect,
|
||||
y: rect.y + statusBarHeight,
|
||||
});
|
||||
return;
|
||||
return undefined;
|
||||
});
|
||||
|
||||
return () => {
|
||||
|
||||
@@ -553,5 +553,7 @@ export function resolveAgentForm(
|
||||
|
||||
case "RESET":
|
||||
return { ...state, userModified: INITIAL_USER_MODIFIED };
|
||||
default:
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ export function useAgentFormState(options: UseAgentFormStateOptions = {}): UseAg
|
||||
}, []);
|
||||
|
||||
const refreshProviderModels = useCallback(() => {
|
||||
refreshSnapshot();
|
||||
void refreshSnapshot();
|
||||
}, [refreshSnapshot]);
|
||||
|
||||
const refetchProviderModelsIfStale = useCallback(() => {
|
||||
|
||||
@@ -1055,6 +1055,8 @@ function resolvePayload(
|
||||
return { delta: def.delta };
|
||||
case "message-input":
|
||||
return { kind: def.kind };
|
||||
default:
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user