mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -4,22 +4,22 @@
|
||||
* Wires up app-specific dependencies (notification system, binding loading,
|
||||
* file watching, debug logging) and re-exports as KeybindingSetup.
|
||||
*/
|
||||
import { useCallback } from 'react'
|
||||
import { useNotifications } from '../context/notifications.js'
|
||||
import { count } from '../utils/array.js'
|
||||
import { logForDebugging } from '../utils/debug.js'
|
||||
import { plural } from '../utils/stringUtils.js'
|
||||
import { KeybindingSetup as InkKeybindingSetup } from '@anthropic/ink'
|
||||
import type { KeybindingWarning } from '@anthropic/ink'
|
||||
import { useCallback } from 'react';
|
||||
import { useNotifications } from '../context/notifications.js';
|
||||
import { count } from '../utils/array.js';
|
||||
import { logForDebugging } from '../utils/debug.js';
|
||||
import { plural } from '../utils/stringUtils.js';
|
||||
import { KeybindingSetup as InkKeybindingSetup } from '@anthropic/ink';
|
||||
import type { KeybindingWarning } from '@anthropic/ink';
|
||||
import {
|
||||
initializeKeybindingWatcher,
|
||||
loadKeybindingsSyncWithWarnings,
|
||||
subscribeToKeybindingChanges,
|
||||
} from './loadUserBindings.js'
|
||||
} from './loadUserBindings.js';
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode
|
||||
}
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Keybinding provider with default + user bindings and hot-reload support.
|
||||
@@ -42,29 +42,29 @@ type Props = {
|
||||
* - Chord support with automatic timeout
|
||||
*/
|
||||
export function KeybindingSetup({ children }: Props): React.ReactNode {
|
||||
const { addNotification, removeNotification } = useNotifications()
|
||||
const { addNotification, removeNotification } = useNotifications();
|
||||
|
||||
const handleWarnings = useCallback(
|
||||
(warnings: KeybindingWarning[], _isReload: boolean) => {
|
||||
const notificationKey = 'keybinding-config-warning'
|
||||
const notificationKey = 'keybinding-config-warning';
|
||||
|
||||
if (warnings.length === 0) {
|
||||
removeNotification(notificationKey)
|
||||
return
|
||||
removeNotification(notificationKey);
|
||||
return;
|
||||
}
|
||||
|
||||
const errorCount = count(warnings, w => w.severity === 'error')
|
||||
const warnCount = count(warnings, w => w.severity === 'warning')
|
||||
const errorCount = count(warnings, w => w.severity === 'error');
|
||||
const warnCount = count(warnings, w => w.severity === 'warning');
|
||||
|
||||
let message: string
|
||||
let message: string;
|
||||
if (errorCount > 0 && warnCount > 0) {
|
||||
message = `Found ${errorCount} keybinding ${plural(errorCount, 'error')} and ${warnCount} ${plural(warnCount, 'warning')}`
|
||||
message = `Found ${errorCount} keybinding ${plural(errorCount, 'error')} and ${warnCount} ${plural(warnCount, 'warning')}`;
|
||||
} else if (errorCount > 0) {
|
||||
message = `Found ${errorCount} keybinding ${plural(errorCount, 'error')}`
|
||||
message = `Found ${errorCount} keybinding ${plural(errorCount, 'error')}`;
|
||||
} else {
|
||||
message = `Found ${warnCount} keybinding ${plural(warnCount, 'warning')}`
|
||||
message = `Found ${warnCount} keybinding ${plural(warnCount, 'warning')}`;
|
||||
}
|
||||
message += ' · /doctor for details'
|
||||
message += ' · /doctor for details';
|
||||
|
||||
addNotification({
|
||||
key: notificationKey,
|
||||
@@ -72,10 +72,10 @@ export function KeybindingSetup({ children }: Props): React.ReactNode {
|
||||
color: errorCount > 0 ? 'error' : 'warning',
|
||||
priority: errorCount > 0 ? 'immediate' : 'high',
|
||||
timeoutMs: 60000,
|
||||
})
|
||||
});
|
||||
},
|
||||
[addNotification, removeNotification],
|
||||
)
|
||||
);
|
||||
|
||||
return (
|
||||
<InkKeybindingSetup
|
||||
@@ -87,5 +87,5 @@ export function KeybindingSetup({ children }: Props): React.ReactNode {
|
||||
>
|
||||
{children}
|
||||
</InkKeybindingSetup>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user