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,66 +1,55 @@
import * as React from 'react'
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js'
import { useShortcutDisplay } from 'src/keybindings/useShortcutDisplay.js'
import * as React from 'react';
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js';
import { useShortcutDisplay } from 'src/keybindings/useShortcutDisplay.js';
import {
builtInCommandNames,
type Command,
type CommandResultDisplay,
INTERNAL_ONLY_COMMANDS,
} from '../../commands.js'
import { useIsInsideModal } from '../../context/modalContext.js'
import { useTerminalSize } from '../../hooks/useTerminalSize.js'
import { Box, Link, Text, Tab, Tabs, Pane } from '@anthropic/ink'
import { useKeybinding } from '../../keybindings/useKeybinding.js'
import { Commands } from './Commands.js'
import { General } from './General.js'
} from '../../commands.js';
import { useIsInsideModal } from '../../context/modalContext.js';
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
import { Box, Link, Text, Tab, Tabs, Pane } from '@anthropic/ink';
import { useKeybinding } from '../../keybindings/useKeybinding.js';
import { Commands } from './Commands.js';
import { General } from './General.js';
type Props = {
onClose: (
result?: string,
options?: { display?: CommandResultDisplay },
) => void
commands: Command[]
}
onClose: (result?: string, options?: { display?: CommandResultDisplay }) => void;
commands: Command[];
};
export function HelpV2({ onClose, commands }: Props): React.ReactNode {
const { rows, columns } = useTerminalSize()
const maxHeight = Math.floor(rows / 2)
const { rows, columns } = useTerminalSize();
const maxHeight = Math.floor(rows / 2);
// Inside the modal slot, FullscreenLayout already caps height and Pane/Tabs
// use flexShrink=0 (see #23592) — our own height= constraint would clip the
// footer since Tabs won't shrink to fit. Let the modal slot handle sizing.
const insideModal = useIsInsideModal()
const insideModal = useIsInsideModal();
const close = () => onClose('Help dialog dismissed', { display: 'system' })
useKeybinding('help:dismiss', close, { context: 'Help' })
const exitState = useExitOnCtrlCDWithKeybindings(close)
const dismissShortcut = useShortcutDisplay('help:dismiss', 'Help', 'esc')
const close = () => onClose('Help dialog dismissed', { display: 'system' });
useKeybinding('help:dismiss', close, { context: 'Help' });
const exitState = useExitOnCtrlCDWithKeybindings(close);
const dismissShortcut = useShortcutDisplay('help:dismiss', 'Help', 'esc');
const builtinNames = builtInCommandNames()
let builtinCommands = commands.filter(
cmd => builtinNames.has(cmd.name) && !cmd.isHidden,
)
let antOnlyCommands: Command[] = []
const builtinNames = builtInCommandNames();
let builtinCommands = commands.filter(cmd => builtinNames.has(cmd.name) && !cmd.isHidden);
let antOnlyCommands: Command[] = [];
// We have to do this in an `if` to help treeshaking
if (process.env.USER_TYPE === 'ant') {
const internalOnlyNames = new Set(INTERNAL_ONLY_COMMANDS.map(_ => _.name))
builtinCommands = builtinCommands.filter(
cmd => !internalOnlyNames.has(cmd.name),
)
antOnlyCommands = commands.filter(
cmd => internalOnlyNames.has(cmd.name) && !cmd.isHidden,
)
const internalOnlyNames = new Set(INTERNAL_ONLY_COMMANDS.map(_ => _.name));
builtinCommands = builtinCommands.filter(cmd => !internalOnlyNames.has(cmd.name));
antOnlyCommands = commands.filter(cmd => internalOnlyNames.has(cmd.name) && !cmd.isHidden);
}
const customCommands = commands.filter(
cmd => !builtinNames.has(cmd.name) && !cmd.isHidden,
)
const customCommands = commands.filter(cmd => !builtinNames.has(cmd.name) && !cmd.isHidden);
const tabs = [
<Tab key="general" title="general">
<General />
</Tab>,
]
];
tabs.push(
<Tab key="commands" title="commands">
@@ -72,7 +61,7 @@ export function HelpV2({ onClose, commands }: Props): React.ReactNode {
onCancel={close}
/>
</Tab>,
)
);
tabs.push(
<Tab key="custom" title="custom-commands">
@@ -85,7 +74,7 @@ export function HelpV2({ onClose, commands }: Props): React.ReactNode {
onCancel={close}
/>
</Tab>,
)
);
if (process.env.USER_TYPE === 'ant' && antOnlyCommands.length > 0) {
tabs.push(
@@ -98,18 +87,14 @@ export function HelpV2({ onClose, commands }: Props): React.ReactNode {
onCancel={close}
/>
</Tab>,
)
);
}
return (
<Box flexDirection="column" height={insideModal ? undefined : maxHeight}>
<Pane color="professionalBlue">
<Tabs
title={
process.env.USER_TYPE === 'ant'
? '/help'
: `Claude Code v${MACRO.VERSION}`
}
title={process.env.USER_TYPE === 'ant' ? '/help' : `Claude Code v${MACRO.VERSION}`}
color="professionalBlue"
defaultTab="general"
>
@@ -117,8 +102,7 @@ export function HelpV2({ onClose, commands }: Props): React.ReactNode {
</Tabs>
<Box marginTop={1}>
<Text>
For more help:{' '}
<Link url="https://code.claude.com/docs/en/overview" />
For more help: <Link url="https://code.claude.com/docs/en/overview" />
</Text>
</Box>
<Box marginTop={1}>
@@ -132,5 +116,5 @@ export function HelpV2({ onClose, commands }: Props): React.ReactNode {
</Box>
</Pane>
</Box>
)
);
}