fix linting errors with comments for dallin

This commit is contained in:
Nate Kelley 2025-10-09 09:48:43 -06:00
parent 29af17ede8
commit aeca703665
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
18 changed files with 42 additions and 32 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -3,5 +3,12 @@
"extends": ["../../biome2.json"],
"files": {
"includes": ["src/**/*", "scripts/**/*"]
},
"linter": {
"rules": {
"suspicious": {
"noConsole": "off"
}
}
}
}

View File

@ -35,7 +35,6 @@ import { z } from 'zod';
// Get DocDeployResultSchema from deploy namespace
const DocDeployResultSchema = deploy.DocDeployResultSchema;
type DocDeployResult = deploy.DocDeployResult;
// Re-export all the shared schemas from server-shared
export {

View File

@ -8,7 +8,7 @@ vi.mock('bun', () => ({
public pattern: string,
public options: any
) {}
async *scan() {
async scan() {
// Return empty for tests
return [];
}

View File

@ -28,7 +28,7 @@ type AppMode = 'Planning' | 'Auto-accept' | 'None';
export function Main() {
const { exit } = useApp();
const [input, setInput] = useState('');
const [history, setHistory] = useState<ChatHistoryEntry[]>([]);
const [_history, setHistory] = useState<ChatHistoryEntry[]>([]);
const [messages, setMessages] = useState<CliAgentMessage[]>([]);
const historyCounter = useRef(0);
const messageCounter = useRef(0);
@ -45,6 +45,7 @@ export function Main() {
const abortControllerRef = useRef<AbortController | null>(null);
// Callback to update messages from agent stream
// biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe
const handleMessageUpdate = useCallback((modelMessages: any[]) => {
const transformedMessages = transformModelMessagesToUI(modelMessages);
@ -125,6 +126,7 @@ export function Main() {
role: 'user',
content: trimmed,
};
// biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe
const updatedModelMessages = [...existingModelMessages, userMessage] as any;
// Update UI state immediately

View File

@ -127,7 +127,7 @@ export function ChatInput({
// Slash command state
const [slashQuery, setSlashQuery] = useState<string | null>(null);
const [slashStart, setSlashStart] = useState<number>(-1);
const [_slashStart, setSlashStart] = useState<number>(-1);
const [commandResults, setCommandResults] = useState<SlashCommand[]>([]);
const [showCommandAutocomplete, setShowCommandAutocomplete] = useState(false);
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);

View File

@ -65,7 +65,7 @@ function parseDiff(diff: string): { lines: ParsedDiffLine[]; additions: number;
*/
export function EditMessage({ message }: EditMessageProps) {
const isExpanded = useExpansion();
const { args, result } = message;
const { result } = message;
if (!result) {
return null;
@ -128,6 +128,7 @@ export function EditMessage({ message }: EditMessageProps) {
return (
<Text
// biome-ignore lint/suspicious/noArrayIndexKey: Messages are stable and won't be reordered? Dallin can confirm?
key={idx}
color={UI_CONSTANTS.COLORS.TEXT_PRIMARY}
{...(backgroundColor && { backgroundColor })}

View File

@ -21,6 +21,7 @@ export function ExecuteMessage({ message }: ExecuteMessageProps) {
const { args, result } = message;
// Get command description and output based on tool type
// biome-ignore lint/correctness/noUnusedVariables: false positive
let description = '';
let output = '';
let exitCode: number | undefined;
@ -38,7 +39,7 @@ export function ExecuteMessage({ message }: ExecuteMessageProps) {
description = `Search for "${args.pattern}"${args.glob ? ` in ${args.glob}` : ''}`;
}
if (result && 'matches' in result) {
output = result.matches.map((m: any) => `${m.path}:${m.lineNum}: ${m.lineText}`).join('\n');
output = result.matches.map((m) => `${m.path}:${m.lineNum}: ${m.lineText}`).join('\n');
success = result.totalMatches > 0;
}
} else if (message.kind === 'ls') {

View File

@ -40,7 +40,6 @@ function getRelativeTime(dateString: string): string {
}
export function HistoryBrowser({ workingDirectory, onSelect, onCancel }: HistoryBrowserProps) {
const { exit } = useApp();
const [conversations, setConversations] = useState<ConversationListItem[]>([]);
const [selectedIndex, setSelectedIndex] = useState(0);
const [loading, setLoading] = useState(true);
@ -59,7 +58,7 @@ export function HistoryBrowser({ workingDirectory, onSelect, onCancel }: History
let title = 'Untitled conversation';
if (fullConvo?.modelMessages) {
const firstUserMsg = fullConvo.modelMessages.find(
(msg: any) => msg.message.kind === 'user'
(msg) => msg.message.kind === 'user'
);
if (firstUserMsg && firstUserMsg.message.kind === 'user') {
// Truncate to first line and max 60 chars

View File

@ -168,6 +168,7 @@ export function MultiLineTextInput({
if (action.preventDefault) {
// Apply the action
if (action.type === 'mode-change' && action.mode) {
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
setVimState((prev) => ({ ...prev, mode: action.mode! }));
if (action.mode === 'visual') {
setVimState((prev) => ({ ...prev, visualStart: cursorPosition }));
@ -180,9 +181,11 @@ export function MultiLineTextInput({
onChange(action.text);
}
if (action.yankedText !== undefined) {
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
setVimState((prev) => ({ ...prev, yankedText: action.yankedText! }));
}
if (action.mode !== undefined) {
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
setVimState((prev) => ({ ...prev, mode: action.mode! }));
}
return;
@ -324,7 +327,9 @@ export function MultiLineTextInput({
let positionInLine = cursorPosition;
for (let i = 0; i < lines.length; i++) {
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
const lineLength = lines[i]!.length + (i < lines.length - 1 ? 1 : 0); // +1 for newline except last line
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
if (cursorPosition <= currentLineStart + lines[i]!.length) {
currentLineIndex = i;
positionInLine = cursorPosition - currentLineStart;
@ -337,6 +342,7 @@ export function MultiLineTextInput({
const previousLineStart = lines
.slice(0, currentLineIndex - 1)
.reduce((acc, line) => acc + line.length + 1, 0);
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
const previousLineLength = lines[currentLineIndex - 1]!.length;
const newPosition = previousLineStart + Math.min(positionInLine, previousLineLength);
setCursorPosition(newPosition);
@ -352,7 +358,9 @@ export function MultiLineTextInput({
let positionInLine = cursorPosition;
for (let i = 0; i < lines.length; i++) {
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
const lineLength = lines[i]!.length + (i < lines.length - 1 ? 1 : 0); // +1 for newline except last line
// biome-ignore lint/style/noNonNullAssertion: Dallin can confirm if this is safe
if (cursorPosition <= currentLineStart + lines[i]!.length) {
currentLineIndex = i;
positionInLine = cursorPosition - currentLineStart;
@ -365,7 +373,7 @@ export function MultiLineTextInput({
const nextLineStart = lines
.slice(0, currentLineIndex + 1)
.reduce((acc, line) => acc + line.length + 1, 0);
const nextLineLength = lines[currentLineIndex + 1]!.length;
const nextLineLength = lines[currentLineIndex + 1]?.length ?? 0;
const newPosition = nextLineStart + Math.min(positionInLine, nextLineLength);
setCursorPosition(newPosition);
}

View File

@ -20,7 +20,7 @@ interface ReadMessageProps {
*/
export function ReadMessage({ message }: ReadMessageProps) {
const isExpanded = useExpansion();
const { args, result } = message;
const { result } = message;
if (!result) {
return null;

View File

@ -17,6 +17,7 @@ export function ContentLines({
return (
<>
{lines.map((line, idx) => (
// biome-ignore lint/suspicious/noArrayIndexKey: Lines position stable during rendering? Dallin can confirm?
<Text key={idx} color={color}>
{line}
</Text>

View File

@ -42,6 +42,7 @@ export function WriteMessage({ message }: WriteMessageProps) {
return (
<Box
// biome-ignore lint/suspicious/noArrayIndexKey: Messages are stable and won't be reordered? Dallin can confirm?
key={fileIdx}
flexDirection="column"
marginBottom={fileIdx < args.files.length - 1 ? 1 : 0}

View File

@ -155,7 +155,7 @@ export async function runAnalyticsEngineerAgent(params: RunAnalyticsEngineerAgen
accumulatorState,
part.toolCallId,
part.toolName,
part.output
part.output as string | Record<string, unknown>
);
onMessageUpdate?.(accumulatorState.messages);
}

View File

@ -68,7 +68,7 @@ export function addReasoningContent(
state.currentStepAssistantMessage &&
Array.isArray(state.currentStepAssistantMessage.content)
) {
(state.currentStepAssistantMessage.content as Array<typeof reasoningContent>).push(
(state.currentStepAssistantMessage.content as (typeof reasoningContent)[]).push(
reasoningContent
);
}
@ -108,7 +108,7 @@ export function addTextContent(
state.currentStepAssistantMessage &&
Array.isArray(state.currentStepAssistantMessage.content)
) {
(state.currentStepAssistantMessage.content as Array<typeof textContent>).push(textContent);
(state.currentStepAssistantMessage.content as (typeof textContent)[]).push(textContent);
}
return state;
@ -121,7 +121,7 @@ export function addToolCall(
state: MessageAccumulatorState,
toolCallId: string,
toolName: string,
input: any
input: unknown
): MessageAccumulatorState {
const toolCallContent = {
type: 'tool-call' as const,
@ -150,9 +150,7 @@ export function addToolCall(
state.currentStepAssistantMessage &&
Array.isArray(state.currentStepAssistantMessage.content)
) {
(state.currentStepAssistantMessage.content as Array<typeof toolCallContent>).push(
toolCallContent
);
(state.currentStepAssistantMessage.content as (typeof toolCallContent)[]).push(toolCallContent);
}
return state;
@ -166,7 +164,7 @@ export function addToolResult(
state: MessageAccumulatorState,
toolCallId: string,
toolName: string,
output: any
output: string | Record<string, unknown>
): MessageAccumulatorState {
const toolResultContent = {
type: 'tool-result' as const,
@ -194,7 +192,7 @@ export function addToolResult(
// Append to existing tool message
if (Array.isArray(state.currentToolMessage.content)) {
(state.currentToolMessage.content as Array<typeof toolResultContent>).push(toolResultContent);
(state.currentToolMessage.content as (typeof toolResultContent)[]).push(toolResultContent);
}
return state;

View File

@ -46,13 +46,6 @@ function encodePathForDirectory(path: string): string {
return Buffer.from(path).toString('base64url');
}
/**
* Decodes a directory name back to the original path
*/
function decodePathFromDirectory(encoded: string): string {
return Buffer.from(encoded, 'base64url').toString('utf-8');
}
/**
* Gets the history directory for a specific working directory
*/
@ -112,7 +105,7 @@ export async function loadConversation(
const data = await readFile(filePath, 'utf-8');
const parsed = JSON.parse(data);
return ConversationSchema.parse(parsed);
} catch (error) {
} catch (_error) {
// File doesn't exist or is invalid
return null;
}
@ -124,6 +117,7 @@ export async function loadConversation(
export async function saveModelMessages(
chatId: string,
workingDirectory: string,
// biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe
modelMessages: any[]
): Promise<void> {
let conversation = await loadConversation(chatId, workingDirectory);
@ -134,6 +128,7 @@ export async function saveModelMessages(
}
// Replace the model messages with the new array
// biome-ignore lint/suspicious/noExplicitAny: We need to fix this to actually make it typesafe
conversation.modelMessages = modelMessages as any[];
conversation.updatedAt = new Date().toISOString();
@ -174,7 +169,7 @@ export async function listConversations(
return conversations
.filter((c): c is NonNullable<typeof c> => c !== null)
.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
} catch (error) {
} catch (_error) {
// Directory doesn't exist or can't be read
return [];
}
@ -228,7 +223,7 @@ export async function loadTodos(
const data = await readFile(filePath, 'utf-8');
const parsed = JSON.parse(data);
return TodoListSchema.parse(parsed);
} catch (error) {
} catch (_error) {
// File doesn't exist or is invalid
return null;
}

View File

@ -93,7 +93,7 @@ class FileSearcher {
return `**/${pattern}`;
});
patterns.push(...adjustedPatterns);
} catch (error) {
} catch (_error) {
// Silently ignore
}
}

View File

@ -17,8 +17,6 @@ const TOOL_NAMES = {
IDLE: 'idleTool',
} as const;
type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES];
/**
* Type guards for tool arguments and results
*/