mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-24 10:12:44 +00:00
chore(lint): no-map-spread replace with Object.assign
Replace { ...obj, override } inside map callbacks with Object.assign({}, obj, { override })
to satisfy oxc/no-map-spread. Preserves copy-on-write semantics.
This commit is contained in:
@@ -126,10 +126,11 @@ export function useAgentHistory(options: {
|
||||
() =>
|
||||
(data?.pages ?? [])
|
||||
.flatMap((page) => page.agents)
|
||||
.map((agent) => ({
|
||||
...agent,
|
||||
serverLabel: serverLabel ?? agent.serverLabel,
|
||||
})),
|
||||
.map((agent) =>
|
||||
Object.assign({}, agent, {
|
||||
serverLabel: serverLabel ?? agent.serverLabel,
|
||||
}),
|
||||
),
|
||||
[data?.pages, serverLabel],
|
||||
);
|
||||
const isInitialLoad = isLoading && agents.length === 0;
|
||||
|
||||
@@ -221,10 +221,9 @@ function selectWorkspaceStructureProjects(
|
||||
({ workspaces: projectWorkspaces, ...project }) => {
|
||||
const sortedWorkspaces = [...projectWorkspaces].sort(compareWorkspaceStructureItems);
|
||||
|
||||
return {
|
||||
...project,
|
||||
return Object.assign({}, project, {
|
||||
workspaceKeys: sortedWorkspaces.map((workspace) => workspace.workspaceId),
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ export function normalizeWorkspaceDescriptor(
|
||||
name: payload.name,
|
||||
status: payload.status,
|
||||
diffStat: payload.diffStat ?? null,
|
||||
scripts: (payload.scripts ?? []).map((s) => ({ ...s })),
|
||||
scripts: (payload.scripts ?? []).map((s) => Object.assign({}, s)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ export const useWorkspaceTabsStore = create<WorkspaceTabsState>()(
|
||||
}
|
||||
|
||||
const nextTabs = currentTabs.map((tab, tabIndex) =>
|
||||
tabIndex === index ? { ...tab, target: normalizedTarget } : tab,
|
||||
tabIndex === index ? Object.assign({}, tab, { target: normalizedTarget }) : tab,
|
||||
);
|
||||
retargetedTabId = normalizedTabId;
|
||||
return {
|
||||
|
||||
@@ -9,11 +9,12 @@ import {
|
||||
function buildProviderModes(entry: ProviderSnapshotEntry): AgentProviderModeDefinition[] {
|
||||
const entryModes = entry.modes ?? [];
|
||||
|
||||
return entryModes.map((mode) => ({
|
||||
...mode,
|
||||
icon: (mode.icon ?? "ShieldCheck") as AgentModeIcon,
|
||||
colorTier: (mode.colorTier ?? "moderate") as AgentModeColorTier,
|
||||
}));
|
||||
return entryModes.map((mode) =>
|
||||
Object.assign({}, mode, {
|
||||
icon: (mode.icon ?? "ShieldCheck") as AgentModeIcon,
|
||||
colorTier: (mode.colorTier ?? "moderate") as AgentModeColorTier,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function buildProviderDefinitions(
|
||||
|
||||
@@ -543,9 +543,7 @@ export class AgentManager {
|
||||
listAgents(): ManagedAgent[] {
|
||||
return Array.from(this.agents.values())
|
||||
.filter((agent) => !agent.internal)
|
||||
.map((agent) => ({
|
||||
...agent,
|
||||
}));
|
||||
.map((agent) => Object.assign({}, agent));
|
||||
}
|
||||
|
||||
async listPersistedAgents(
|
||||
|
||||
@@ -294,13 +294,14 @@ function buildSerializableConfig(config: AgentSessionConfig): SerializableAgentC
|
||||
function sanitizePendingPermissions(
|
||||
pending: Map<string, AgentPermissionRequest>,
|
||||
): AgentPermissionRequest[] {
|
||||
return Array.from(pending.values()).map((request) => ({
|
||||
...request,
|
||||
input: sanitizeMetadata(request.input),
|
||||
suggestions: sanitizeMetadataArray(request.suggestions),
|
||||
actions: request.actions?.map((action) => ({ ...action })),
|
||||
metadata: sanitizeMetadata(request.metadata),
|
||||
}));
|
||||
return Array.from(pending.values()).map((request) =>
|
||||
Object.assign({}, request, {
|
||||
input: sanitizeMetadata(request.input),
|
||||
suggestions: sanitizeMetadataArray(request.suggestions),
|
||||
actions: request.actions?.map((action) => Object.assign({}, action)),
|
||||
metadata: sanitizeMetadata(request.metadata),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function sanitizePersistenceHandle(
|
||||
|
||||
@@ -271,12 +271,7 @@ function mergeModels(
|
||||
);
|
||||
|
||||
return mergedModels.map((model) =>
|
||||
additionalDefaultIds.has(model.id)
|
||||
? model
|
||||
: {
|
||||
...model,
|
||||
isDefault: false,
|
||||
},
|
||||
additionalDefaultIds.has(model.id) ? model : Object.assign({}, model, { isDefault: false }),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -388,11 +383,10 @@ function createRegistryEntry(
|
||||
if (mode.icon && mode.colorTier) return mode;
|
||||
const definitionMode = resolved.definition.modes.find((d) => d.id === mode.id);
|
||||
if (!definitionMode) return mode;
|
||||
return {
|
||||
...mode,
|
||||
return Object.assign({}, mode, {
|
||||
icon: mode.icon ?? definitionMode.icon,
|
||||
colorTier: mode.colorTier ?? definitionMode.colorTier,
|
||||
};
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -4379,10 +4379,11 @@ export class CodexAppServerAgentClient implements AgentClient {
|
||||
});
|
||||
}
|
||||
|
||||
const thinkingOptions = Array.from(thinkingById.values()).map((option) => ({
|
||||
...option,
|
||||
isDefault: option.id === resolvedDefaultReasoningEffort,
|
||||
}));
|
||||
const thinkingOptions = Array.from(thinkingById.values()).map((option) =>
|
||||
Object.assign({}, option, {
|
||||
isDefault: option.id === resolvedDefaultReasoningEffort,
|
||||
}),
|
||||
);
|
||||
const defaultThinkingOptionId =
|
||||
resolvedDefaultReasoningEffort ??
|
||||
thinkingOptions.find((option) => option.isDefault)?.id ??
|
||||
|
||||
@@ -106,7 +106,7 @@ export class ScriptRouteStore {
|
||||
}
|
||||
|
||||
listRoutes(): ScriptRouteEntry[] {
|
||||
return Array.from(this.routes.values()).map((entry) => ({ ...entry }));
|
||||
return Array.from(this.routes.values()).map((entry) => Object.assign({}, entry));
|
||||
}
|
||||
|
||||
listRoutesForWorkspace(workspaceId: string): ScriptRouteEntry[] {
|
||||
|
||||
@@ -1004,12 +1004,11 @@ export async function listPaseoWorktrees({
|
||||
|
||||
const rootPrefix = normalizePathForOwnership(worktreesRoot) + sep;
|
||||
return parseWorktreeList(stdout)
|
||||
.map((entry) => ({ ...entry, path: normalizePathForOwnership(entry.path) }))
|
||||
.map((entry) => Object.assign({}, entry, { path: normalizePathForOwnership(entry.path) }))
|
||||
.filter((entry) => entry.path.startsWith(rootPrefix))
|
||||
.map((entry) => ({
|
||||
...entry,
|
||||
createdAt: resolveWorktreeCreatedAtIso(entry.path),
|
||||
}));
|
||||
.map((entry) =>
|
||||
Object.assign({}, entry, { createdAt: resolveWorktreeCreatedAtIso(entry.path) }),
|
||||
);
|
||||
}
|
||||
|
||||
export async function resolveExistingWorktreeForSlug({
|
||||
|
||||
@@ -109,11 +109,10 @@ function parseChangelog(changelogText) {
|
||||
notesParts.push("", ...bodyLines);
|
||||
}
|
||||
|
||||
return {
|
||||
...heading,
|
||||
return Object.assign({}, heading, {
|
||||
tag: `v${heading.version}`,
|
||||
notes: `${notesParts.join("\n").trim()}\n`,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user