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:
Taylor Mullen
2025-04-18 19:09:41 -04:00
committed by N. Taylor Mullen
parent 2a850ed051
commit 40e11e053c
21 changed files with 53 additions and 96 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;