mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45:50 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,33 +1,27 @@
|
||||
import { relative } from 'path'
|
||||
import React from 'react'
|
||||
import { Box, Text } from '@anthropic/ink'
|
||||
import { DiagnosticTrackingService } from '../services/diagnosticTracking.js'
|
||||
import type { Attachment } from '../utils/attachments.js'
|
||||
import { getCwd } from '../utils/cwd.js'
|
||||
import { CtrlOToExpand } from './CtrlOToExpand.js'
|
||||
import { MessageResponse } from './MessageResponse.js'
|
||||
import { relative } from 'path';
|
||||
import React from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { DiagnosticTrackingService } from '../services/diagnosticTracking.js';
|
||||
import type { Attachment } from '../utils/attachments.js';
|
||||
import { getCwd } from '../utils/cwd.js';
|
||||
import { CtrlOToExpand } from './CtrlOToExpand.js';
|
||||
import { MessageResponse } from './MessageResponse.js';
|
||||
|
||||
type DiagnosticsAttachment = Extract<Attachment, { type: 'diagnostics' }>
|
||||
type DiagnosticsAttachment = Extract<Attachment, { type: 'diagnostics' }>;
|
||||
|
||||
type DiagnosticsDisplayProps = {
|
||||
attachment: DiagnosticsAttachment
|
||||
verbose: boolean
|
||||
}
|
||||
attachment: DiagnosticsAttachment;
|
||||
verbose: boolean;
|
||||
};
|
||||
|
||||
export function DiagnosticsDisplay({
|
||||
attachment,
|
||||
verbose,
|
||||
}: DiagnosticsDisplayProps): React.ReactNode {
|
||||
export function DiagnosticsDisplay({ attachment, verbose }: DiagnosticsDisplayProps): React.ReactNode {
|
||||
// Only show if there are diagnostics to report
|
||||
if (attachment.files.length === 0) return null
|
||||
if (attachment.files.length === 0) return null;
|
||||
|
||||
// Count total issues
|
||||
const totalIssues = attachment.files.reduce(
|
||||
(sum, file) => sum + file.diagnostics.length,
|
||||
0,
|
||||
)
|
||||
const totalIssues = attachment.files.reduce((sum, file) => sum + file.diagnostics.length, 0);
|
||||
|
||||
const fileCount = attachment.files.length
|
||||
const fileCount = attachment.files.length;
|
||||
|
||||
if (verbose) {
|
||||
// Show all diagnostics in verbose mode (ctrl+o)
|
||||
@@ -37,14 +31,7 @@ export function DiagnosticsDisplay({
|
||||
<React.Fragment key={fileIndex}>
|
||||
<MessageResponse>
|
||||
<Text dimColor wrap="wrap">
|
||||
<Text bold>
|
||||
{relative(
|
||||
getCwd(),
|
||||
file.uri
|
||||
.replace('file://', '')
|
||||
.replace('_claude_fs_right:', ''),
|
||||
)}
|
||||
</Text>{' '}
|
||||
<Text bold>{relative(getCwd(), file.uri.replace('file://', '').replace('_claude_fs_right:', ''))}</Text>{' '}
|
||||
<Text dimColor>
|
||||
{file.uri.startsWith('file://')
|
||||
? '(file://)'
|
||||
@@ -59,12 +46,9 @@ export function DiagnosticsDisplay({
|
||||
<MessageResponse key={diagIndex}>
|
||||
<Text dimColor wrap="wrap">
|
||||
{' '}
|
||||
{DiagnosticTrackingService.getSeveritySymbol(
|
||||
diagnostic.severity,
|
||||
)}
|
||||
{DiagnosticTrackingService.getSeveritySymbol(diagnostic.severity)}
|
||||
{' [Line '}
|
||||
{diagnostic.range.start.line + 1}:
|
||||
{diagnostic.range.start.character + 1}
|
||||
{diagnostic.range.start.line + 1}:{diagnostic.range.start.character + 1}
|
||||
{'] '}
|
||||
{diagnostic.message}
|
||||
{diagnostic.code ? ` [${diagnostic.code}]` : ''}
|
||||
@@ -75,17 +59,16 @@ export function DiagnosticsDisplay({
|
||||
</React.Fragment>
|
||||
))}
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Show summary in normal mode
|
||||
return (
|
||||
<MessageResponse>
|
||||
<Text dimColor wrap="wrap">
|
||||
Found <Text bold>{totalIssues}</Text> new diagnostic{' '}
|
||||
{totalIssues === 1 ? 'issue' : 'issues'} in {fileCount}{' '}
|
||||
Found <Text bold>{totalIssues}</Text> new diagnostic {totalIssues === 1 ? 'issue' : 'issues'} in {fileCount}{' '}
|
||||
{fileCount === 1 ? 'file' : 'files'} <CtrlOToExpand />
|
||||
</Text>
|
||||
</MessageResponse>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user