fix: remove unused imports, functions, and types after discovering using npm run lint

This commit is contained in:
Haileyesus
2026-03-05 17:14:17 +03:00
parent 525c9f72ca
commit 65efda3278
15 changed files with 9 additions and 52 deletions

View File

@@ -1,7 +1,7 @@
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { authenticatedFetch } from '../../../utils/api'; import { authenticatedFetch } from '../../../utils/api';
import { CLAUDE_MODELS, CODEX_MODELS, CURSOR_MODELS, GEMINI_MODELS } from '../../../../shared/modelConstants'; import { CLAUDE_MODELS, CODEX_MODELS, CURSOR_MODELS, GEMINI_MODELS } from '../../../../shared/modelConstants';
import type { PendingPermissionRequest, PermissionMode, Provider } from '../types/types'; import type { PendingPermissionRequest, PermissionMode } from '../types/types';
import type { ProjectSession, SessionProvider } from '../../../types/app'; import type { ProjectSession, SessionProvider } from '../../../types/app';
interface UseChatProviderStateArgs { interface UseChatProviderStateArgs {

View File

@@ -22,6 +22,7 @@ export const TextContent: React.FC<TextContentProps> = ({
formattedJson = JSON.stringify(parsed, null, 2); formattedJson = JSON.stringify(parsed, null, 2);
} catch (e) { } catch (e) {
// If parsing fails, use original content // If parsing fails, use original content
console.warn('Failed to parse JSON content:', e);
} }
return ( return (

View File

@@ -274,6 +274,7 @@ export const TOOL_CONFIGS: Record<string, ToolDisplayConfig> = {
} }
return { todos, isResult: true }; return { todos, isResult: true };
} catch (e) { } catch (e) {
console.warn('Failed to parse todo list content:', e);
return { todos: [], isResult: true }; return { todos: [], isResult: true };
} }
} }
@@ -514,6 +515,7 @@ export const TOOL_CONFIGS: Record<string, ToolDisplayConfig> = {
content: parsed.plan?.replace(/\\n/g, '\n') || parsed.plan content: parsed.plan?.replace(/\\n/g, '\n') || parsed.plan
}; };
} catch (e) { } catch (e) {
console.warn('Failed to parse plan content:', e);
return { content: '' }; return { content: '' };
} }
} }
@@ -544,6 +546,7 @@ export const TOOL_CONFIGS: Record<string, ToolDisplayConfig> = {
content: parsed.plan?.replace(/\\n/g, '\n') || parsed.plan content: parsed.plan?.replace(/\\n/g, '\n') || parsed.plan
}; };
} catch (e) { } catch (e) {
console.warn('Failed to parse plan content:', e);
return { content: '' }; return { content: '' };
} }
} }

View File

@@ -88,7 +88,6 @@ function ChatInterface({
isLoadingMoreMessages, isLoadingMoreMessages,
hasMoreMessages, hasMoreMessages,
totalMessages, totalMessages,
isSystemSessionChange,
setIsSystemSessionChange, setIsSystemSessionChange,
canAbortSession, canAbortSession,
setCanAbortSession, setCanAbortSession,

View File

@@ -1,6 +1,5 @@
import { SessionProvider } from '../../../../types/app'; import { SessionProvider } from '../../../../types/app';
import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo'; import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo';
import type { Provider } from '../../types/types';
type AssistantThinkingIndicatorProps = { type AssistantThinkingIndicatorProps = {
selectedProvider: SessionProvider; selectedProvider: SessionProvider;

View File

@@ -247,7 +247,6 @@ export default function ChatMessagesPane({
<MessageComponent <MessageComponent
key={getMessageKey(message)} key={getMessageKey(message)}
message={message} message={message}
index={index}
prevMessage={prevMessage} prevMessage={prevMessage}
createDiff={createDiff} createDiff={createDiff}
onFileOpen={onFileOpen} onFileOpen={onFileOpen}

View File

@@ -22,7 +22,6 @@ type DiffLine = {
interface MessageComponentProps { interface MessageComponentProps {
message: ChatMessage; message: ChatMessage;
index: number;
prevMessage: ChatMessage | null; prevMessage: ChatMessage | null;
createDiff: (oldStr: string, newStr: string) => DiffLine[]; createDiff: (oldStr: string, newStr: string) => DiffLine[];
onFileOpen?: (filePath: string, diffInfo?: unknown) => void; onFileOpen?: (filePath: string, diffInfo?: unknown) => void;
@@ -43,7 +42,7 @@ type InteractiveOption = {
type PermissionGrantState = 'idle' | 'granted' | 'error'; type PermissionGrantState = 'idle' | 'granted' | 'error';
const MessageComponent = memo(({ message, index, prevMessage, createDiff, onFileOpen, onShowSettings, onGrantToolPermission, autoExpandTools, showRawParameters, showThinking, selectedProject, provider }: MessageComponentProps) => { const MessageComponent = memo(({ message, prevMessage, createDiff, onFileOpen, onShowSettings, onGrantToolPermission, autoExpandTools, showRawParameters, showThinking, selectedProject, provider }: MessageComponentProps) => {
const { t } = useTranslation('chat'); const { t } = useTranslation('chat');
const isGrouped = prevMessage && prevMessage.type === message.type && const isGrouped = prevMessage && prevMessage.type === message.type &&
((prevMessage.type === 'assistant') || ((prevMessage.type === 'assistant') ||

View File

@@ -154,13 +154,6 @@ export function useGitPanelController({
setGitStatus({ error: 'Git operation failed', details: String(error) }); setGitStatus({ error: 'Git operation failed', details: String(error) });
setCurrentBranch(''); setCurrentBranch('');
} finally { } finally {
if (
signal?.aborted ||
selectedProjectNameRef.current !== projectName
) {
return;
}
setIsLoading(false); setIsLoading(false);
} }
}, [fetchFileDiff, selectedProject]); }, [fetchFileDiff, selectedProject]);

View File

@@ -1,5 +1,4 @@
import { useCallback, useEffect, useMemo, useState } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react';
import type React from 'react';
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import { api } from '../../../utils/api'; import { api } from '../../../utils/api';
import type { Project, ProjectSession, SessionProvider } from '../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../types/app';
@@ -141,21 +140,6 @@ export function useSidebarController({
}; };
}, []); }, []);
const handleTouchClick = useCallback(
(callback: () => void) =>
(event: React.TouchEvent<HTMLElement>) => {
const target = event.target as HTMLElement;
if (target.closest('.overflow-y-auto') || target.closest('[data-scroll-container]')) {
return;
}
event.preventDefault();
event.stopPropagation();
callback();
},
[],
);
const toggleProject = useCallback((projectName: string) => { const toggleProject = useCallback((projectName: string) => {
setExpandedProjects((prev) => { setExpandedProjects((prev) => {
const next = new Set<string>(); const next = new Set<string>();
@@ -460,7 +444,6 @@ export function useSidebarController({
showVersionModal, showVersionModal,
starredProjects, starredProjects,
filteredProjects, filteredProjects,
handleTouchClick,
toggleProject, toggleProject,
handleSessionClick, handleSessionClick,
toggleStarProject, toggleStarProject,

View File

@@ -1,4 +1,3 @@
import type React from 'react';
import type { LoadingProgress, Project, ProjectSession, SessionProvider } from '../../../types/app'; import type { LoadingProgress, Project, ProjectSession, SessionProvider } from '../../../types/app';
export type ProjectSortOrder = 'name' | 'date'; export type ProjectSortOrder = 'name' | 'date';
@@ -56,8 +55,4 @@ export type MCPServerStatus = {
isConfigured?: boolean; isConfigured?: boolean;
} | null; } | null;
export type TouchHandlerFactory = (
callback: () => void,
) => (event: React.TouchEvent<HTMLElement>) => void;
export type SettingsProject = Pick<Project, 'name' | 'displayName' | 'fullPath' | 'path'>; export type SettingsProject = Pick<Project, 'name' | 'displayName' | 'fullPath' | 'path'>;

View File

@@ -65,7 +65,6 @@ function Sidebar({
sessionDeleteConfirmation, sessionDeleteConfirmation,
showVersionModal, showVersionModal,
filteredProjects, filteredProjects,
handleTouchClick,
toggleProject, toggleProject,
handleSessionClick, handleSessionClick,
toggleStarProject, toggleStarProject,
@@ -175,7 +174,6 @@ function Sidebar({
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => { onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => {
void updateSessionSummary(projectName, sessionId, summary, provider); void updateSessionSummary(projectName, sessionId, summary, provider);
}, },
touchHandlerFactory: handleTouchClick,
t, t,
}; };

View File

@@ -4,7 +4,7 @@ import type { TFunction } from 'i18next';
import { cn } from '../../../../lib/utils'; import { cn } from '../../../../lib/utils';
import TaskIndicator from './TaskIndicator'; import TaskIndicator from './TaskIndicator';
import type { Project, ProjectSession, SessionProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { MCPServerStatus, SessionWithProvider, TouchHandlerFactory } from '../../types/types'; import type { MCPServerStatus, SessionWithProvider } from '../../types/types';
import { getTaskIndicatorStatus } from '../../utils/utils'; import { getTaskIndicatorStatus } from '../../utils/utils';
import SidebarProjectSessions from './SidebarProjectSessions'; import SidebarProjectSessions from './SidebarProjectSessions';
@@ -46,7 +46,6 @@ type SidebarProjectItemProps = {
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
touchHandlerFactory: TouchHandlerFactory;
t: TFunction; t: TFunction;
}; };
@@ -92,7 +91,6 @@ export default function SidebarProjectItem({
onStartEditingSession, onStartEditingSession,
onCancelEditingSession, onCancelEditingSession,
onSaveEditingSession, onSaveEditingSession,
touchHandlerFactory,
t, t,
}: SidebarProjectItemProps) { }: SidebarProjectItemProps) {
const isSelected = selectedProject?.name === project.name; const isSelected = selectedProject?.name === project.name;
@@ -424,7 +422,6 @@ export default function SidebarProjectItem({
onDeleteSession={onDeleteSession} onDeleteSession={onDeleteSession}
onLoadMoreSessions={onLoadMoreSessions} onLoadMoreSessions={onLoadMoreSessions}
onNewSession={onNewSession} onNewSession={onNewSession}
touchHandlerFactory={touchHandlerFactory}
t={t} t={t}
/> />
</div> </div>

View File

@@ -5,7 +5,6 @@ import type {
LoadingSessionsByProject, LoadingSessionsByProject,
MCPServerStatus, MCPServerStatus,
SessionWithProvider, SessionWithProvider,
TouchHandlerFactory,
} from '../../types/types'; } from '../../types/types';
import SidebarProjectItem from './SidebarProjectItem'; import SidebarProjectItem from './SidebarProjectItem';
import SidebarProjectsState from './SidebarProjectsState'; import SidebarProjectsState from './SidebarProjectsState';
@@ -51,7 +50,6 @@ export type SidebarProjectListProps = {
onStartEditingSession: (sessionId: string, initialName: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void;
onCancelEditingSession: () => void; onCancelEditingSession: () => void;
onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void;
touchHandlerFactory: TouchHandlerFactory;
t: TFunction; t: TFunction;
}; };
@@ -91,7 +89,6 @@ export default function SidebarProjectList({
onStartEditingSession, onStartEditingSession,
onCancelEditingSession, onCancelEditingSession,
onSaveEditingSession, onSaveEditingSession,
touchHandlerFactory,
t, t,
}: SidebarProjectListProps) { }: SidebarProjectListProps) {
const state = ( const state = (
@@ -154,7 +151,6 @@ export default function SidebarProjectList({
onStartEditingSession={onStartEditingSession} onStartEditingSession={onStartEditingSession}
onCancelEditingSession={onCancelEditingSession} onCancelEditingSession={onCancelEditingSession}
onSaveEditingSession={onSaveEditingSession} onSaveEditingSession={onSaveEditingSession}
touchHandlerFactory={touchHandlerFactory}
t={t} t={t}
/> />
))} ))}

View File

@@ -2,7 +2,7 @@ import { ChevronDown, Plus } from 'lucide-react';
import type { TFunction } from 'i18next'; import type { TFunction } from 'i18next';
import { Button } from '../../../../shared/view/ui'; import { Button } from '../../../../shared/view/ui';
import type { Project, ProjectSession, SessionProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { SessionWithProvider, TouchHandlerFactory } from '../../types/types'; import type { SessionWithProvider } from '../../types/types';
import SidebarSessionItem from './SidebarSessionItem'; import SidebarSessionItem from './SidebarSessionItem';
type SidebarProjectSessionsProps = { type SidebarProjectSessionsProps = {
@@ -29,7 +29,6 @@ type SidebarProjectSessionsProps = {
) => void; ) => void;
onLoadMoreSessions: (project: Project) => void; onLoadMoreSessions: (project: Project) => void;
onNewSession: (project: Project) => void; onNewSession: (project: Project) => void;
touchHandlerFactory: TouchHandlerFactory;
t: TFunction; t: TFunction;
}; };
@@ -70,7 +69,6 @@ export default function SidebarProjectSessions({
onDeleteSession, onDeleteSession,
onLoadMoreSessions, onLoadMoreSessions,
onNewSession, onNewSession,
touchHandlerFactory,
t, t,
}: SidebarProjectSessionsProps) { }: SidebarProjectSessionsProps) {
if (!isExpanded) { if (!isExpanded) {
@@ -105,7 +103,6 @@ export default function SidebarProjectSessions({
onProjectSelect={onProjectSelect} onProjectSelect={onProjectSelect}
onSessionSelect={onSessionSelect} onSessionSelect={onSessionSelect}
onDeleteSession={onDeleteSession} onDeleteSession={onDeleteSession}
touchHandlerFactory={touchHandlerFactory}
t={t} t={t}
/> />
)) ))

View File

@@ -4,7 +4,7 @@ import type { TFunction } from 'i18next';
import { cn } from '../../../../lib/utils'; import { cn } from '../../../../lib/utils';
import { formatTimeAgo } from '../../../../utils/dateUtils'; import { formatTimeAgo } from '../../../../utils/dateUtils';
import type { Project, ProjectSession, SessionProvider } from '../../../../types/app'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type { SessionWithProvider, TouchHandlerFactory } from '../../types/types'; import type { SessionWithProvider } from '../../types/types';
import { createSessionViewModel } from '../../utils/utils'; import { createSessionViewModel } from '../../utils/utils';
import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo'; import SessionProviderLogo from '../../../llm-logo-provider/SessionProviderLogo';
@@ -27,7 +27,6 @@ type SidebarSessionItemProps = {
sessionTitle: string, sessionTitle: string,
provider: SessionProvider, provider: SessionProvider,
) => void; ) => void;
touchHandlerFactory: TouchHandlerFactory;
t: TFunction; t: TFunction;
}; };
@@ -45,7 +44,6 @@ export default function SidebarSessionItem({
onProjectSelect, onProjectSelect,
onSessionSelect, onSessionSelect,
onDeleteSession, onDeleteSession,
touchHandlerFactory,
t, t,
}: SidebarSessionItemProps) { }: SidebarSessionItemProps) {
const sessionView = createSessionViewModel(session, currentTime, t); const sessionView = createSessionViewModel(session, currentTime, t);