style: 完成所有文件的lint

This commit is contained in:
claude-code-best
2026-05-01 21:39:30 +08:00
parent d136872cc9
commit 6182015005
1333 changed files with 68255 additions and 77882 deletions

View File

@@ -1,29 +1,22 @@
import * as React from 'react'
import { useState } from 'react'
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js'
import { Box, Text } from '@anthropic/ink'
import { useKeybinding } from '../keybindings/useKeybinding.js'
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js'
import { Select } from './CustomSelect/index.js'
import { Byline, KeyboardShortcutHint, Pane } from '@anthropic/ink'
import * as React from 'react';
import { useState } from 'react';
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js';
import { Box, Text } from '@anthropic/ink';
import { useKeybinding } from '../keybindings/useKeybinding.js';
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js';
import { Select } from './CustomSelect/index.js';
import { Byline, KeyboardShortcutHint, Pane } from '@anthropic/ink';
export type Props = {
currentValue: boolean
onSelect: (enabled: boolean) => void
onCancel?: () => void
isMidConversation?: boolean
}
currentValue: boolean;
onSelect: (enabled: boolean) => void;
onCancel?: () => void;
isMidConversation?: boolean;
};
export function ThinkingToggle({
currentValue,
onSelect,
onCancel,
isMidConversation,
}: Props): React.ReactNode {
const exitState = useExitOnCtrlCDWithKeybindings()
const [confirmationPending, setConfirmationPending] = useState<
boolean | null
>(null)
export function ThinkingToggle({ currentValue, onSelect, onCancel, isMidConversation }: Props): React.ReactNode {
const exitState = useExitOnCtrlCDWithKeybindings();
const [confirmationPending, setConfirmationPending] = useState<boolean | null>(null);
const options = [
{
@@ -36,38 +29,38 @@ export function ThinkingToggle({
label: 'Disabled',
description: 'Claude will respond without extended thinking',
},
]
];
// Use configurable keybinding for ESC to cancel/go back
useKeybinding(
'confirm:no',
() => {
if (confirmationPending !== null) {
setConfirmationPending(null)
setConfirmationPending(null);
} else {
onCancel?.()
onCancel?.();
}
},
{ context: 'Confirmation' },
)
);
// Use configurable keybinding for Enter to confirm in confirmation mode
useKeybinding(
'confirm:yes',
() => {
if (confirmationPending !== null) {
onSelect(confirmationPending)
onSelect(confirmationPending);
}
},
{ context: 'Confirmation', isActive: confirmationPending !== null },
)
);
function handleSelectChange(value: string): void {
const selected = value === 'true'
const selected = value === 'true';
if (isMidConversation && selected !== currentValue) {
setConfirmationPending(selected)
setConfirmationPending(selected);
} else {
onSelect(selected)
onSelect(selected);
}
}
@@ -84,9 +77,8 @@ export function ThinkingToggle({
{confirmationPending !== null ? (
<Box flexDirection="column" marginBottom={1} gap={1}>
<Text color="warning">
Changing thinking mode mid-conversation will increase latency and
may reduce quality. For best results, set this at the start of a
session.
Changing thinking mode mid-conversation will increase latency and may reduce quality. For best results,
set this at the start of a session.
</Text>
<Text color="warning">Do you want to proceed?</Text>
</Box>
@@ -109,25 +101,15 @@ export function ThinkingToggle({
) : confirmationPending !== null ? (
<Byline>
<KeyboardShortcutHint shortcut="Enter" action="confirm" />
<ConfigurableShortcutHint
action="confirm:no"
context="Confirmation"
fallback="Esc"
description="cancel"
/>
<ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" />
</Byline>
) : (
<Byline>
<KeyboardShortcutHint shortcut="Enter" action="confirm" />
<ConfigurableShortcutHint
action="confirm:no"
context="Confirmation"
fallback="Esc"
description="exit"
/>
<ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="exit" />
</Byline>
)}
</Text>
</Pane>
)
);
}