解决所有lint问题

This commit is contained in:
xintaofei
2026-03-13 23:35:51 +08:00
parent f4f70c438a
commit 39b72819ae
4 changed files with 42 additions and 40 deletions

View File

@@ -550,11 +550,7 @@ function BranchSelector({
setPopoverOpen(false) setPopoverOpen(false)
} }
function renderBranchItem( function renderBranchItem(branch: string, displayName?: string, indent = 0) {
branch: string,
displayName?: string,
indent = 0
) {
const isCurrent = branch === selectedBranch const isCurrent = branch === selectedBranch
return ( return (
<button <button
@@ -617,12 +613,13 @@ function BranchSelector({
{t("remoteBranches")} {t("remoteBranches")}
</CollapsibleTrigger> </CollapsibleTrigger>
<CollapsibleContent> <CollapsibleContent>
{hasMultipleRemotes ? ( {hasMultipleRemotes
remoteNames.map((remoteName) => ( ? remoteNames.map((remoteName) => (
<Collapsible key={remoteName}> <Collapsible key={remoteName}>
<CollapsibleTrigger className="flex w-full items-center gap-2 rounded-lg py-1.5 pl-5 text-xs hover:bg-accent hover:text-accent-foreground select-none outline-hidden"> <CollapsibleTrigger className="flex w-full items-center gap-2 rounded-lg py-1.5 pl-5 text-xs hover:bg-accent hover:text-accent-foreground select-none outline-hidden">
<ChevronRight className="h-3 w-3 shrink-0 transition-transform [[data-state=open]>&]:rotate-90" /> <ChevronRight className="h-3 w-3 shrink-0 transition-transform [[data-state=open]>&]:rotate-90" />
{remoteName} ({groupedRemoteBranches[remoteName].length}) {remoteName} (
{groupedRemoteBranches[remoteName].length})
</CollapsibleTrigger> </CollapsibleTrigger>
<CollapsibleContent> <CollapsibleContent>
{groupedRemoteBranches[remoteName].map((branch) => {groupedRemoteBranches[remoteName].map((branch) =>
@@ -635,14 +632,14 @@ function BranchSelector({
</CollapsibleContent> </CollapsibleContent>
</Collapsible> </Collapsible>
)) ))
) : ( : branchList.remote.map((branch) => {
branchList.remote.map((branch) => {
const slashIndex = branch.indexOf("/") const slashIndex = branch.indexOf("/")
const shortName = const shortName =
slashIndex > 0 ? branch.substring(slashIndex + 1) : branch slashIndex > 0
? branch.substring(slashIndex + 1)
: branch
return renderBranchItem(branch, shortName, 1) return renderBranchItem(branch, shortName, 1)
}) })}
)}
</CollapsibleContent> </CollapsibleContent>
</Collapsible> </Collapsible>
)} )}

View File

@@ -681,7 +681,8 @@ export function BranchDropdown({
<Collapsible key={remoteName}> <Collapsible key={remoteName}>
<CollapsibleTrigger className="flex w-full items-center gap-2.5 rounded-xl px-3 py-2 pl-6 text-sm hover:bg-accent hover:text-accent-foreground select-none outline-hidden"> <CollapsibleTrigger className="flex w-full items-center gap-2.5 rounded-xl px-3 py-2 pl-6 text-sm hover:bg-accent hover:text-accent-foreground select-none outline-hidden">
<ChevronRight className="h-3 w-3 shrink-0 transition-transform [[data-state=open]>&]:rotate-90" /> <ChevronRight className="h-3 w-3 shrink-0 transition-transform [[data-state=open]>&]:rotate-90" />
{remoteName} ({groupedRemoteBranches[remoteName].length}) {remoteName} (
{groupedRemoteBranches[remoteName].length})
</CollapsibleTrigger> </CollapsibleTrigger>
<CollapsibleContent className="pl-3"> <CollapsibleContent className="pl-3">
{groupedRemoteBranches[remoteName].map((b) => {groupedRemoteBranches[remoteName].map((b) =>

View File

@@ -76,15 +76,17 @@ export function RemoteManageDialog({
const addDraft = () => { const addDraft = () => {
setDrafts((prev) => [ setDrafts((prev) => [
...prev, ...prev,
{ originalName: null, originalUrl: "", name: "", url: "", deleted: false }, {
originalName: null,
originalUrl: "",
name: "",
url: "",
deleted: false,
},
]) ])
} }
const updateDraft = ( const updateDraft = (index: number, field: "name" | "url", value: string) => {
index: number,
field: "name" | "url",
value: string
) => {
setDrafts((prev) => setDrafts((prev) =>
prev.map((d, i) => (i === index ? { ...d, [field]: value } : d)) prev.map((d, i) => (i === index ? { ...d, [field]: value } : d))
) )

View File

@@ -69,8 +69,10 @@ export function StatusBarTokens() {
const rawLiveSize = activeConn?.usage?.size ?? null const rawLiveSize = activeConn?.usage?.size ?? null
// Treat live used=0 as "no data" so we fall back to sessionStats — // Treat live used=0 as "no data" so we fall back to sessionStats —
// Claude Code sends used=0 for synthetic local commands (/context etc.) // Claude Code sends used=0 for synthetic local commands (/context etc.)
const liveContextUsed = rawLiveUsed != null && rawLiveUsed > 0 ? rawLiveUsed : null const liveContextUsed =
const liveContextMax = rawLiveSize != null && rawLiveSize > 0 ? rawLiveSize : null rawLiveUsed != null && rawLiveUsed > 0 ? rawLiveUsed : null
const liveContextMax =
rawLiveSize != null && rawLiveSize > 0 ? rawLiveSize : null
const contextUsed = const contextUsed =
liveContextUsed ?? sessionStats?.context_window_used_tokens ?? null liveContextUsed ?? sessionStats?.context_window_used_tokens ?? null