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,48 +1,41 @@
import * as React from 'react'
import { useMemo } from 'react'
import { type Command, formatDescriptionWithSource } from '../../commands.js'
import { truncate } from '../../utils/truncate.js'
import { Box, Text, useTabHeaderFocus } from '@anthropic/ink'
import { Select } from '../CustomSelect/select.js'
import * as React from 'react';
import { useMemo } from 'react';
import { type Command, formatDescriptionWithSource } from '../../commands.js';
import { truncate } from '../../utils/truncate.js';
import { Box, Text, useTabHeaderFocus } from '@anthropic/ink';
import { Select } from '../CustomSelect/select.js';
type Props = {
commands: Command[]
maxHeight: number
columns: number
title: string
onCancel: () => void
emptyMessage?: string
}
commands: Command[];
maxHeight: number;
columns: number;
title: string;
onCancel: () => void;
emptyMessage?: string;
};
export function Commands({
commands,
maxHeight,
columns,
title,
onCancel,
emptyMessage,
}: Props): React.ReactNode {
const { headerFocused, focusHeader } = useTabHeaderFocus()
const maxWidth = Math.max(1, columns - 10)
const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2))
export function Commands({ commands, maxHeight, columns, title, onCancel, emptyMessage }: Props): React.ReactNode {
const { headerFocused, focusHeader } = useTabHeaderFocus();
const maxWidth = Math.max(1, columns - 10);
const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2));
const options = useMemo(() => {
// Custom commands can appear more than once (e.g. same name at user and
// project scope). Dedupe by name to avoid React key collisions in Select.
const seen = new Set<string>()
const seen = new Set<string>();
return commands
.filter(cmd => {
if (seen.has(cmd.name)) return false
seen.add(cmd.name)
return true
if (seen.has(cmd.name)) return false;
seen.add(cmd.name);
return true;
})
.sort((a, b) => a.name.localeCompare(b.name))
.map(cmd => ({
label: `/${cmd.name}`,
value: cmd.name,
description: truncate(formatDescriptionWithSource(cmd), maxWidth, true),
}))
}, [commands, maxWidth])
}));
}, [commands, maxWidth]);
return (
<Box flexDirection="column" paddingY={1}>
@@ -66,5 +59,5 @@ export function Commands({
</>
)}
</Box>
)
);
}