mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Fix remaining tslint errors (YAY).
- Also updated ci.yml to ensure that linting failures will break the build. Fully fixes https://b.corp.google.com/issues/411384603
This commit is contained in:
committed by
N. Taylor Mullen
parent
2a850ed051
commit
40e11e053c
@@ -5,7 +5,7 @@ interface FooterProps {
|
||||
queryLength: number;
|
||||
}
|
||||
|
||||
const Footer: React.FC<FooterProps> = ({ queryLength }) => (
|
||||
export const Footer: React.FC<FooterProps> = ({ queryLength }) => (
|
||||
<Box marginTop={1} justifyContent="space-between">
|
||||
<Box minWidth={15}>
|
||||
<Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
|
||||
@@ -13,5 +13,3 @@ const Footer: React.FC<FooterProps> = ({ queryLength }) => (
|
||||
<Text color="blue">Gemini</Text>
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default Footer;
|
||||
|
||||
@@ -7,7 +7,7 @@ interface HeaderProps {
|
||||
cwd: string;
|
||||
}
|
||||
|
||||
const Header: React.FC<HeaderProps> = ({ cwd }) => (
|
||||
export const Header: React.FC<HeaderProps> = ({ cwd }) => (
|
||||
<>
|
||||
{/* Static Header Art */}
|
||||
<Box marginBottom={1}>
|
||||
@@ -34,5 +34,3 @@ const Header: React.FC<HeaderProps> = ({ cwd }) => (
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
||||
export default Header;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React from 'react';
|
||||
import { Box } from 'ink';
|
||||
import type { HistoryItem } from '../types.js';
|
||||
import { UI_WIDTH } from '../constants.js';
|
||||
import UserMessage from './messages/UserMessage.js';
|
||||
import GeminiMessage from './messages/GeminiMessage.js';
|
||||
import InfoMessage from './messages/InfoMessage.js';
|
||||
import ErrorMessage from './messages/ErrorMessage.js';
|
||||
import ToolGroupMessage from './messages/ToolGroupMessage.js';
|
||||
import { UserMessage } from './messages/UserMessage.js';
|
||||
import { GeminiMessage } from './messages/GeminiMessage.js';
|
||||
import { InfoMessage } from './messages/InfoMessage.js';
|
||||
import { ErrorMessage } from './messages/ErrorMessage.js';
|
||||
import { ToolGroupMessage } from './messages/ToolGroupMessage.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
|
||||
interface HistoryDisplayProps {
|
||||
@@ -14,7 +13,7 @@ interface HistoryDisplayProps {
|
||||
onSubmit: (value: PartListUnion) => void;
|
||||
}
|
||||
|
||||
const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
|
||||
export const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
|
||||
history,
|
||||
onSubmit,
|
||||
}) => (
|
||||
@@ -36,4 +35,3 @@ const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
|
||||
))}
|
||||
</Box>
|
||||
);
|
||||
export default HistoryDisplay;
|
||||
|
||||
@@ -10,7 +10,7 @@ interface InputPromptProps {
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
query,
|
||||
setQuery,
|
||||
onSubmit,
|
||||
@@ -33,5 +33,3 @@ const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default InputPrompt;
|
||||
|
||||
@@ -8,7 +8,7 @@ interface LoadingIndicatorProps {
|
||||
elapsedTime: number;
|
||||
}
|
||||
|
||||
const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
isLoading,
|
||||
currentLoadingPhrase,
|
||||
elapsedTime,
|
||||
@@ -30,5 +30,3 @@ const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoadingIndicator;
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { UI_WIDTH } from '../constants.js';
|
||||
|
||||
const Tips: React.FC = () => (
|
||||
export const Tips: React.FC = () => (
|
||||
<Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
|
||||
<Text>Tips for getting started:</Text>
|
||||
<Text>
|
||||
@@ -16,5 +16,3 @@ const Tips: React.FC = () => (
|
||||
<Text>4. Be specific for the best results.</Text>
|
||||
</Box>
|
||||
);
|
||||
|
||||
export default Tips;
|
||||
|
||||
@@ -85,7 +85,7 @@ interface DiffRendererProps {
|
||||
|
||||
const DEFAULT_TAB_WIDTH = 4; // Spaces per tab for normalization
|
||||
|
||||
const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
diffContent,
|
||||
tabWidth = DEFAULT_TAB_WIDTH,
|
||||
}) => {
|
||||
@@ -157,6 +157,9 @@ const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
dim = true;
|
||||
prefixSymbol = ' ';
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown line type: ${line.type}`);
|
||||
break;
|
||||
}
|
||||
|
||||
// Render the line content *after* stripping the calculated *minimum* baseIndentation.
|
||||
@@ -179,5 +182,3 @@ const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default DiffRenderer;
|
||||
|
||||
@@ -5,7 +5,7 @@ interface ErrorMessageProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
const ErrorMessage: React.FC<ErrorMessageProps> = ({ text }) => {
|
||||
export const ErrorMessage: React.FC<ErrorMessageProps> = ({ text }) => {
|
||||
const prefix = '✕ ';
|
||||
const prefixWidth = prefix.length;
|
||||
|
||||
@@ -22,5 +22,3 @@ const ErrorMessage: React.FC<ErrorMessageProps> = ({ text }) => {
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorMessage;
|
||||
|
||||
@@ -6,7 +6,7 @@ interface GeminiMessageProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
||||
export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
||||
const prefix = '✦ ';
|
||||
const prefixWidth = prefix.length;
|
||||
|
||||
@@ -40,5 +40,3 @@ const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default GeminiMessage;
|
||||
|
||||
@@ -5,7 +5,7 @@ interface InfoMessageProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
|
||||
export const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
|
||||
const prefix = 'ℹ ';
|
||||
const prefixWidth = prefix.length;
|
||||
|
||||
@@ -22,5 +22,3 @@ const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default InfoMessage;
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
ToolEditConfirmationDetails,
|
||||
ToolConfirmationOutcome,
|
||||
ToolExecuteConfirmationDetails,
|
||||
} from '../../types.js'; // Adjust path as needed
|
||||
} from '../../types.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import DiffRenderer from './DiffRenderer.js';
|
||||
import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { UI_WIDTH } from '../../constants.js';
|
||||
|
||||
export interface ToolConfirmationMessageProps {
|
||||
@@ -27,9 +27,9 @@ interface InternalOption {
|
||||
value: ToolConfirmationOutcome;
|
||||
}
|
||||
|
||||
const ToolConfirmationMessage: React.FC<ToolConfirmationMessageProps> = ({
|
||||
confirmationDetails,
|
||||
}) => {
|
||||
export const ToolConfirmationMessage: React.FC<
|
||||
ToolConfirmationMessageProps
|
||||
> = ({ confirmationDetails }) => {
|
||||
const { onConfirm } = confirmationDetails;
|
||||
|
||||
useInput((_, key) => {
|
||||
@@ -42,14 +42,11 @@ const ToolConfirmationMessage: React.FC<ToolConfirmationMessageProps> = ({
|
||||
onConfirm(item.value);
|
||||
};
|
||||
|
||||
let title: string;
|
||||
let bodyContent: React.ReactNode | null = null; // Removed contextDisplay here
|
||||
let question: string;
|
||||
const options: InternalOption[] = [];
|
||||
|
||||
if (isEditDetails(confirmationDetails)) {
|
||||
title = 'Edit'; // Title for the outer box
|
||||
|
||||
// Body content is now the DiffRenderer, passing filename to it
|
||||
// The bordered box is removed from here and handled within DiffRenderer
|
||||
bodyContent = <DiffRenderer diffContent={confirmationDetails.fileDiff} />;
|
||||
@@ -69,7 +66,6 @@ const ToolConfirmationMessage: React.FC<ToolConfirmationMessageProps> = ({
|
||||
} else {
|
||||
const executionProps =
|
||||
confirmationDetails as ToolExecuteConfirmationDetails;
|
||||
title = 'Execute Command'; // Title for the outer box
|
||||
|
||||
// For execution, we still need context display and description
|
||||
const commandDisplay = <Text color="cyan">{executionProps.command}</Text>;
|
||||
@@ -118,5 +114,3 @@ const ToolConfirmationMessage: React.FC<ToolConfirmationMessageProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ToolConfirmationMessage;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { Box } from 'ink';
|
||||
import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js';
|
||||
import ToolMessage from './ToolMessage.js';
|
||||
import { ToolMessage } from './ToolMessage.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import ToolConfirmationMessage from './ToolConfirmationMessage.js';
|
||||
import { ToolConfirmationMessage } from './ToolConfirmationMessage.js';
|
||||
|
||||
interface ToolGroupMessageProps {
|
||||
toolCalls: IndividualToolCallDisplay[];
|
||||
@@ -11,7 +11,7 @@ interface ToolGroupMessageProps {
|
||||
}
|
||||
|
||||
// Main component renders the border and maps the tools using ToolMessage
|
||||
const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
toolCalls,
|
||||
onSubmit,
|
||||
}) => {
|
||||
@@ -44,5 +44,3 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ToolGroupMessage;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Box, Text } from 'ink';
|
||||
import Spinner from 'ink-spinner';
|
||||
import { ToolCallStatus } from '../../types.js';
|
||||
import { ToolResultDisplay } from '../../../tools/tools.js';
|
||||
import DiffRenderer from './DiffRenderer.js';
|
||||
import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { MarkdownRenderer } from '../../utils/MarkdownRenderer.js';
|
||||
|
||||
interface ToolMessageProps {
|
||||
@@ -13,7 +13,7 @@ interface ToolMessageProps {
|
||||
status: ToolCallStatus;
|
||||
}
|
||||
|
||||
const ToolMessage: React.FC<ToolMessageProps> = ({
|
||||
export const ToolMessage: React.FC<ToolMessageProps> = ({
|
||||
name,
|
||||
description,
|
||||
resultDisplay,
|
||||
@@ -70,5 +70,3 @@ const ToolMessage: React.FC<ToolMessageProps> = ({
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default ToolMessage;
|
||||
|
||||
@@ -5,7 +5,7 @@ interface UserMessageProps {
|
||||
text: string;
|
||||
}
|
||||
|
||||
const UserMessage: React.FC<UserMessageProps> = ({ text }) => {
|
||||
export const UserMessage: React.FC<UserMessageProps> = ({ text }) => {
|
||||
const prefix = '> ';
|
||||
const prefixWidth = prefix.length;
|
||||
|
||||
@@ -20,5 +20,3 @@ const UserMessage: React.FC<UserMessageProps> = ({ text }) => {
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserMessage;
|
||||
|
||||
Reference in New Issue
Block a user