style: auto-fix ESLint issues (curly braces and formatting)
- Add curly braces to all if/else/for/while statements - Fix indentation and trailing spaces - Auto-fixed 372 linting errors using eslint --fix - Remaining issues are warnings only (non-null assertions, explicit any types)
This commit is contained in:
@@ -21,9 +21,9 @@ function formatToolName(name: string): string {
|
||||
|
||||
/** Format tool args as a compact, readable summary. */
|
||||
function formatToolArgs(args: unknown): string {
|
||||
if (!args || typeof args !== 'object') return '';
|
||||
if (!args || typeof args !== 'object') {return '';}
|
||||
const entries = Object.entries(args as Record<string, unknown>);
|
||||
if (entries.length === 0) return '';
|
||||
if (entries.length === 0) {return '';}
|
||||
const parts = entries.map(([key, value]) => {
|
||||
if (typeof value === 'string') {
|
||||
const display = value.length > 50 ? value.slice(0, 47) + '...' : value;
|
||||
@@ -71,7 +71,7 @@ export function App({
|
||||
// This replaces the process.stdout.write callback (which corrupts Ink rendering)
|
||||
// with one that updates React state to show tool activity in the streaming area.
|
||||
useEffect(() => {
|
||||
if (!agent) return;
|
||||
if (!agent) {return;}
|
||||
|
||||
const handleToolEvent = (event: ToolUseEvent) => {
|
||||
if (event.type === 'start') {
|
||||
@@ -137,7 +137,7 @@ export function App({
|
||||
|
||||
const handleSubmit = useCallback(async (value: string) => {
|
||||
const command = parseCommand(value);
|
||||
if (!command) return;
|
||||
if (!command) {return;}
|
||||
|
||||
setInput('');
|
||||
|
||||
@@ -212,7 +212,7 @@ export function App({
|
||||
return;
|
||||
|
||||
case 'transfer': {
|
||||
const xferMsg: Message = { role: 'assistant', content: `Transfer not supported in fullscreen mode.` };
|
||||
const xferMsg: Message = { role: 'assistant', content: 'Transfer not supported in fullscreen mode.' };
|
||||
const xferWithTs = session.addMessage(xferMsg);
|
||||
setMessages(prev => [...prev, xferWithTs]);
|
||||
return;
|
||||
@@ -222,7 +222,7 @@ export function App({
|
||||
break; // Continue to message handling
|
||||
}
|
||||
|
||||
if (command.type !== 'message' || isStreaming) return;
|
||||
if (command.type !== 'message' || isStreaming) {return;}
|
||||
|
||||
// Add user message to UI (and session if no agent — agent adds it internally)
|
||||
const userMessage: Message = { role: 'user', content: command.content };
|
||||
|
||||
@@ -19,15 +19,15 @@ export const InputBar = memo(function InputBar({
|
||||
placeholder = 'Type a message...',
|
||||
}: InputBarProps): React.ReactElement {
|
||||
const completions = useMemo(() => {
|
||||
if (!value.startsWith('/')) return [];
|
||||
if (!value.startsWith('/')) {return [];}
|
||||
return getCommandCompletions(value);
|
||||
}, [value]);
|
||||
|
||||
|
||||
const tooltip = useMemo(() => {
|
||||
if (!value.startsWith('/')) return null;
|
||||
if (!value.startsWith('/')) {return null;}
|
||||
return getCommandTooltip(value);
|
||||
}, [value]);
|
||||
|
||||
|
||||
const showTooltip = value.startsWith('/') && (tooltip || completions.length > 1);
|
||||
|
||||
return (
|
||||
@@ -36,14 +36,14 @@ export const InputBar = memo(function InputBar({
|
||||
{showTooltip && (
|
||||
<Box paddingX={2} height={1} justifyContent="center">
|
||||
<Text color="gray">
|
||||
{tooltip
|
||||
{tooltip
|
||||
? `→ ${tooltip}`
|
||||
: `${completions.length} commands (Tab)`
|
||||
}
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
|
||||
{/* Input bar */}
|
||||
<Box borderStyle="single" borderColor="blue" paddingX={1}>
|
||||
<Text color="blue">{'> '}</Text>
|
||||
|
||||
@@ -19,26 +19,26 @@ function formatTimestamp(timestamp: number): string {
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
|
||||
if (seconds < 60) return 'just now';
|
||||
if (minutes < 60) return `${minutes}m ago`;
|
||||
if (hours < 24) return `${hours}h ago`;
|
||||
if (days < 7) return `${days}d ago`;
|
||||
|
||||
if (seconds < 60) {return 'just now';}
|
||||
if (minutes < 60) {return `${minutes}m ago`;}
|
||||
if (hours < 24) {return `${hours}h ago`;}
|
||||
if (days < 7) {return `${days}d ago`;}
|
||||
return new Date(timestamp).toLocaleDateString([], { month: 'short', day: 'numeric' });
|
||||
}
|
||||
|
||||
// Individual message component
|
||||
const MessageItem = memo(function MessageItem({
|
||||
message,
|
||||
index
|
||||
}: {
|
||||
message: Message;
|
||||
const MessageItem = memo(function MessageItem({
|
||||
message,
|
||||
index,
|
||||
}: {
|
||||
message: Message;
|
||||
index: number;
|
||||
}): React.ReactElement {
|
||||
const isUser = message.role === 'user';
|
||||
const accentColor = isUser ? 'blue' : '#ff8c00';
|
||||
const timestampText = message.timestamp ? formatTimestamp(message.timestamp) : '';
|
||||
|
||||
|
||||
return (
|
||||
<Box
|
||||
key={index}
|
||||
@@ -59,7 +59,7 @@ const MessageItem = memo(function MessageItem({
|
||||
</Text>
|
||||
<Text color="gray">| {timestampText}</Text>
|
||||
</Box>
|
||||
|
||||
|
||||
{/* Content */}
|
||||
<Text wrap="wrap">
|
||||
{message.role === 'assistant'
|
||||
|
||||
Reference in New Issue
Block a user