chore: apply oxlint autofix (safe level)
Auto-fixed 102 warnings (6040 → 5938) across 57 files. Main categories:
- preserve-caught-error: add { cause: error } to re-thrown errors
- unicorn/no-array-reverse: .reverse() → .toReversed()
- unicorn/no-useless-fallback-in-spread: drop unnecessary ?? {} in spreads
- oxc/no-map-spread: rewrite object spread in .map() to Object.assign
- react-hooks/exhaustive-deps: trim module-level constants from dep arrays
Ran npm run format after to clean up whitespace from lint mutations.
This commit is contained in:
@@ -618,7 +618,7 @@ export function CombinedModelSelector({
|
||||
});
|
||||
|
||||
return () => cancelAnimationFrame(frame);
|
||||
}, [isOpen, platformIsWeb]);
|
||||
}, [isOpen]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -287,14 +287,14 @@ export function FileExplorerPane({
|
||||
directoryPaths.unshift(".");
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
...directoryPaths.map((path) =>
|
||||
await Promise.all(
|
||||
directoryPaths.map((path) =>
|
||||
requestDirectoryListing(path, {
|
||||
recordHistory: false,
|
||||
setCurrentPath: false,
|
||||
}),
|
||||
),
|
||||
]);
|
||||
);
|
||||
return null;
|
||||
},
|
||||
enabled: false,
|
||||
|
||||
@@ -2158,7 +2158,6 @@ export function SidebarWorkspaceList({
|
||||
serverId,
|
||||
shortcutIndexByWorkspaceKey,
|
||||
showShortcutBadges,
|
||||
platformIsNative,
|
||||
creatingWorkspaceIds,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -122,8 +122,9 @@ export function createStreamStrategy(config: StreamStrategyConfig): StreamStrate
|
||||
return {
|
||||
render: config.render,
|
||||
orderTail: (streamItems) =>
|
||||
config.orderTailReverse ? [...streamItems].reverse() : streamItems,
|
||||
orderHead: (streamHead) => (config.orderHeadReverse ? [...streamHead].reverse() : streamHead),
|
||||
config.orderTailReverse ? [...streamItems].toReversed() : streamItems,
|
||||
orderHead: (streamHead) =>
|
||||
config.orderHeadReverse ? [...streamHead].toReversed() : streamHead,
|
||||
getNeighborIndex: (index, relation) =>
|
||||
relation === "above"
|
||||
? index + config.assistantTurnTraversalStep
|
||||
@@ -153,7 +154,7 @@ export function createStreamStrategy(config: StreamStrategyConfig): StreamStrate
|
||||
messages.push(currentItem.text);
|
||||
}
|
||||
}
|
||||
return messages.reverse().join("\n\n");
|
||||
return messages.toReversed().join("\n\n");
|
||||
},
|
||||
isNearBottom: (input) => config.isNearBottom(input),
|
||||
getBottomOffset: (metrics) => config.getBottomOffset(metrics),
|
||||
|
||||
@@ -9,7 +9,7 @@ export function orderAutocompleteOptions<T>(
|
||||
if (position === "below-input") {
|
||||
return [...options];
|
||||
}
|
||||
return [...options].reverse();
|
||||
return [...options].toReversed();
|
||||
}
|
||||
|
||||
export function getAutocompleteFallbackIndex(
|
||||
|
||||
@@ -113,7 +113,7 @@ export function orderVisibleComboboxOptions(
|
||||
if (optionsPosition !== "above-search") {
|
||||
return visibleOptions;
|
||||
}
|
||||
return [...visibleOptions].reverse();
|
||||
return [...visibleOptions].toReversed();
|
||||
}
|
||||
|
||||
export function getComboboxFallbackIndex(
|
||||
|
||||
@@ -279,26 +279,23 @@ export function WebDesktopScrollbarOverlay({
|
||||
setIsDragging(false);
|
||||
},
|
||||
});
|
||||
}, [applyDragDelta, platformIsWeb]);
|
||||
}, [applyDragDelta]);
|
||||
|
||||
const startWebDrag = useCallback(
|
||||
(event: any) => {
|
||||
if (!platformIsWeb) {
|
||||
return;
|
||||
}
|
||||
const clientY = readClientY(event);
|
||||
if (clientY === null) {
|
||||
return;
|
||||
}
|
||||
event?.preventDefault?.();
|
||||
event?.stopPropagation?.();
|
||||
event?.nativeEvent?.preventDefault?.();
|
||||
dragStartOffsetRef.current = normalizedOffsetRef.current;
|
||||
dragStartClientYRef.current = clientY;
|
||||
setIsDragging(true);
|
||||
},
|
||||
[platformIsWeb],
|
||||
);
|
||||
const startWebDrag = useCallback((event: any) => {
|
||||
if (!platformIsWeb) {
|
||||
return;
|
||||
}
|
||||
const clientY = readClientY(event);
|
||||
if (clientY === null) {
|
||||
return;
|
||||
}
|
||||
event?.preventDefault?.();
|
||||
event?.stopPropagation?.();
|
||||
event?.nativeEvent?.preventDefault?.();
|
||||
dragStartOffsetRef.current = normalizedOffsetRef.current;
|
||||
dragStartClientYRef.current = clientY;
|
||||
setIsDragging(true);
|
||||
}, []);
|
||||
|
||||
const handleGrabHoverIn = useCallback(() => {
|
||||
if (!isScrollVisible && !isDragging) {
|
||||
@@ -334,7 +331,7 @@ export function WebDesktopScrollbarOverlay({
|
||||
window.removeEventListener("pointerup", stopDragging);
|
||||
window.removeEventListener("pointercancel", stopDragging);
|
||||
};
|
||||
}, [applyDragDelta, isDragging, platformIsWeb]);
|
||||
}, [applyDragDelta, isDragging]);
|
||||
|
||||
if (!enabled || !geometry.isVisible) {
|
||||
return null;
|
||||
|
||||
@@ -1580,7 +1580,7 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider
|
||||
console.error("[Session] Failed to send agent message:", error);
|
||||
});
|
||||
},
|
||||
[encodeImages, serverId, client, setAgentStreamTail, setAgentStreamHead],
|
||||
[serverId, client, setAgentStreamTail, setAgentStreamHead],
|
||||
);
|
||||
|
||||
// Keep the ref updated so the agent_update handler can call it
|
||||
@@ -1677,7 +1677,7 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider
|
||||
...(requestId ? { requestId } : {}),
|
||||
});
|
||||
},
|
||||
[encodeImages, client],
|
||||
[client],
|
||||
);
|
||||
|
||||
const setAgentMode = useCallback(
|
||||
|
||||
@@ -227,7 +227,7 @@ export function useAudioRecorder(config?: AudioCaptureConfig) {
|
||||
if (error?.message !== "Recording cancelled") {
|
||||
console.error("[AudioRecorder] Failed to start recording:", error);
|
||||
}
|
||||
throw new Error(`Failed to start audio recording: ${error.message}`);
|
||||
throw new Error(`Failed to start audio recording: ${error.message}`, { cause: error });
|
||||
}
|
||||
}, [recordingOptions.sampleRate, recordingOptions.numberOfChannels, recordingOptions.bitRate]);
|
||||
|
||||
@@ -293,7 +293,7 @@ export function useAudioRecorder(config?: AudioCaptureConfig) {
|
||||
} catch (error: any) {
|
||||
setRecordingStartTime(null);
|
||||
console.error("[AudioRecorder] Failed to stop recording:", error);
|
||||
throw new Error(`Failed to stop audio recording: ${error.message}`);
|
||||
throw new Error(`Failed to stop audio recording: ${error.message}`, { cause: error });
|
||||
} finally {
|
||||
startStopMutexRef.current = null;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ export function useAudioRecorder(config?: AudioCaptureConfig) {
|
||||
try {
|
||||
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
||||
} catch (error: any) {
|
||||
throw new Error(`Failed to access microphone: ${error?.message ?? error}`);
|
||||
throw new Error(`Failed to access microphone: ${error?.message ?? error}`, { cause: error });
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -225,7 +225,9 @@ export function useAudioRecorder(config?: AudioCaptureConfig) {
|
||||
recorder = new MediaRecorder(stream, recorderOptions);
|
||||
} catch (error: any) {
|
||||
cleanupStream();
|
||||
throw new Error(`Failed to initialize recorder: ${error?.message ?? error}`);
|
||||
throw new Error(`Failed to initialize recorder: ${error?.message ?? error}`, {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
|
||||
mediaRecorderRef.current = recorder;
|
||||
|
||||
@@ -1530,13 +1530,13 @@ export class HostRuntimeStore {
|
||||
this.emit(host.serverId);
|
||||
});
|
||||
void controller
|
||||
.start({
|
||||
...(initialConnection
|
||||
.start(
|
||||
initialConnection
|
||||
? {
|
||||
initialConnection,
|
||||
}
|
||||
: {}),
|
||||
})
|
||||
: {},
|
||||
)
|
||||
.catch((error) => {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
controller.markStartupError(message);
|
||||
|
||||
@@ -292,7 +292,7 @@ export function NewWorkspaceScreen({
|
||||
cwd: input.cwd,
|
||||
worktreeSlug: createNameId(),
|
||||
...(input.attachments.length > 0 ? { attachments: input.attachments } : {}),
|
||||
...(checkoutRequest ?? {}),
|
||||
...checkoutRequest,
|
||||
};
|
||||
},
|
||||
[selectedItem],
|
||||
|
||||
@@ -53,7 +53,7 @@ function setStatus(
|
||||
statusByCheckout: {
|
||||
...state.statusByCheckout,
|
||||
[key]: {
|
||||
...(state.statusByCheckout[key] ?? {}),
|
||||
...state.statusByCheckout[key],
|
||||
[actionId]: status,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -531,7 +531,7 @@ export const useWorkspaceLayoutStore = create<WorkspaceLayoutStore>()(
|
||||
splitSizesByWorkspace: {
|
||||
...state.splitSizesByWorkspace,
|
||||
[normalizedWorkspaceKey]: {
|
||||
...(state.splitSizesByWorkspace[normalizedWorkspaceKey] ?? {}),
|
||||
...state.splitSizesByWorkspace[normalizedWorkspaceKey],
|
||||
[normalizedGroupId]: clampNormalizedSizes(sizes),
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user