chore(lint): resolve merge conflicts and fix new lint errors

This commit is contained in:
mkorwel
2026-03-24 16:56:26 -07:00
committed by Matt Korwel
parent 5f2b4d551d
commit 655495de79
9 changed files with 73 additions and 74 deletions
+9 -9
View File
@@ -877,21 +877,21 @@ export class Task {
}
private async _handleToolConfirmationPart(part: Part): Promise<boolean> {
if (
part.kind !== 'data' ||
!part.data ||
typeof part.data['callId'] !== 'string' ||
typeof part.data['outcome'] !== 'string'
) {
return false;
}
if (!part.data['outcome']) {
if (part.kind !== 'data' || !part.data) {
return false;
}
const callId = part.data['callId'];
const outcomeString = part.data['outcome'];
if (typeof callId !== 'string' || typeof outcomeString !== 'string') {
return false;
}
if (!outcomeString) {
return false;
}
this.toolsAlreadyConfirmed.add(callId);
let confirmationOutcome: ToolConfirmationOutcome | undefined;
+9 -9
View File
@@ -80,8 +80,9 @@ function migrateClaudeHook(claudeHook: unknown): unknown {
// Replace CLAUDE_PROJECT_DIR with GEMINI_PROJECT_DIR in command
if (typeof migrated['command'] === 'string') {
migrated['command'] = migrated['command'].replace(
const command = migrated['command'];
if (typeof command === 'string') {
migrated['command'] = command.replace(
/\$CLAUDE_PROJECT_DIR/g,
'$GEMINI_PROJECT_DIR',
);
@@ -95,8 +96,9 @@ function migrateClaudeHook(claudeHook: unknown): unknown {
// Map timeout field (Claude uses seconds, Gemini uses seconds)
if ('timeout' in hook && typeof hook['timeout'] === 'number') {
migrated['timeout'] = hook['timeout'];
const timeout = hook['timeout'];
if ('timeout' in hook && typeof timeout === 'number') {
migrated['timeout'] = timeout;
}
return migrated;
@@ -140,11 +142,9 @@ function migrateClaudeHooks(claudeConfig: unknown): Record<string, unknown> {
const migratedDef: Record<string, unknown> = {};
// Transform matcher
if (
'matcher' in definition &&
typeof definition['matcher'] === 'string'
) {
migratedDef['matcher'] = transformMatcher(definition['matcher']);
const matcher = definition['matcher'];
if ('matcher' in definition && typeof matcher === 'string') {
migratedDef['matcher'] = transformMatcher(matcher);
}
// Copy sequential flag
@@ -157,16 +157,12 @@ async function truncateHistoryToBudget(
if (typeof responseObj === 'string') {
contentStr = responseObj;
} else if (responseObj && typeof responseObj === 'object') {
if (
'output' in responseObj &&
typeof responseObj['output'] === 'string'
) {
contentStr = responseObj['output'];
} else if (
'content' in responseObj &&
typeof responseObj['content'] === 'string'
) {
contentStr = responseObj['content'];
const output = responseObj['output'];
const content = responseObj['content'];
if (typeof output === 'string') {
contentStr = output;
} else if (typeof content === 'string') {
contentStr = content;
} else {
contentStr = JSON.stringify(responseObj, null, 2);
}
+3 -5
View File
@@ -360,11 +360,9 @@ export class HookAggregator {
}
// Extract additionalContext from various hook types
if (
'additionalContext' in specific &&
typeof specific['additionalContext'] === 'string'
) {
contexts.push(specific['additionalContext']);
const additionalContext = specific['additionalContext'];
if (typeof additionalContext === 'string') {
contexts.push(additionalContext);
}
}
}
@@ -583,14 +583,12 @@ export class LoopDetectionService {
return { isLoop: false };
}
const flashConfidenceValue = flashResult['unproductive_state_confidence'];
const flashConfidence =
typeof flashResult['unproductive_state_confidence'] === 'number'
? flashResult['unproductive_state_confidence']
: 0;
typeof flashConfidenceValue === 'number' ? flashConfidenceValue : 0;
const flashAnalysisValue = flashResult['unproductive_state_analysis'];
const flashAnalysis =
typeof flashResult['unproductive_state_analysis'] === 'string'
? flashResult['unproductive_state_analysis']
: '';
typeof flashAnalysisValue === 'string' ? flashAnalysisValue : '';
const doubleCheckModelName =
this.context.config.modelConfigService.getResolvedConfig({
@@ -632,15 +630,17 @@ export class LoopDetectionService {
signal,
);
const mainModelConfidenceValue =
mainModelResult?.['unproductive_state_confidence'];
const mainModelConfidence =
mainModelResult &&
typeof mainModelResult['unproductive_state_confidence'] === 'number'
? mainModelResult['unproductive_state_confidence']
typeof mainModelConfidenceValue === 'number'
? mainModelConfidenceValue
: 0;
const mainModelAnalysisValue =
mainModelResult?.['unproductive_state_analysis'];
const mainModelAnalysis =
mainModelResult &&
typeof mainModelResult['unproductive_state_analysis'] === 'string'
? mainModelResult['unproductive_state_analysis']
typeof mainModelAnalysisValue === 'string'
? mainModelAnalysisValue
: undefined;
logLlmLoopCheck(
@@ -685,10 +685,8 @@ export class LoopDetectionService {
role: LlmRole.UTILITY_LOOP_DETECTOR,
});
if (
result &&
typeof result['unproductive_state_confidence'] === 'number'
) {
const confidenceValue = result?.['unproductive_state_confidence'];
if (result && typeof confidenceValue === 'number') {
return result;
}
return null;
+4 -2
View File
@@ -63,7 +63,9 @@ function getStringReferences(parts: AnyPart[]): StringReference[] {
});
}
} else if (part instanceof GenericPart) {
if (part.type === 'executableCode' && typeof part['code'] === 'string') {
const codeValue = part['code'];
const outputValue = part['output'];
if (part.type === 'executableCode' && typeof codeValue === 'string') {
refs.push({
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
get: () => part['code'] as string,
@@ -73,7 +75,7 @@ function getStringReferences(parts: AnyPart[]): StringReference[] {
});
} else if (
part.type === 'codeExecutionResult' &&
typeof part['output'] === 'string'
typeof outputValue === 'string'
) {
refs.push({
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
+4 -3
View File
@@ -110,12 +110,13 @@ Return ONLY the corrected string in the specified JSON format with the key 'corr
role: LlmRole.UTILITY_EDIT_CORRECTOR,
});
const correctedStringValue = result?.['corrected_string_escaping'];
if (
result &&
typeof result['corrected_string_escaping'] === 'string' &&
result['corrected_string_escaping'].length > 0
typeof correctedStringValue === 'string' &&
correctedStringValue.length > 0
) {
return result['corrected_string_escaping'];
return correctedStringValue;
} else {
return potentiallyProblematicString;
}
+2 -1
View File
@@ -232,7 +232,8 @@ export function parseGoogleApiError(error: unknown): GoogleApiError | null {
// Basic structural check before casting.
// Since the proto definitions are loose, we primarily rely on @type presence.
if (typeof detailObj['@type'] === 'string') {
const typeValue = detailObj['@type'];
if (typeof typeValue === 'string') {
// We can just cast it; the consumer will have to switch on @type
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
details.push(detailObj as unknown as GoogleApiErrorDetail);
+22 -19
View File
@@ -372,27 +372,30 @@ async function parseTokenEndpointResponse(
// Try to parse as JSON first, fall back to form-urlencoded
try {
const data: unknown = JSON.parse(responseText);
if (
data &&
typeof data === 'object' &&
'access_token' in data &&
typeof (data as Record<string, unknown>)['access_token'] === 'string'
) {
if (data && typeof data === 'object' && 'access_token' in data) {
const obj = data as Record<string, unknown>;
const result: OAuthTokenResponse = {
access_token: String(obj['access_token']),
token_type:
typeof obj['token_type'] === 'string' ? obj['token_type'] : 'Bearer',
expires_in:
typeof obj['expires_in'] === 'number' ? obj['expires_in'] : undefined,
refresh_token:
typeof obj['refresh_token'] === 'string'
? obj['refresh_token']
: undefined,
const accessTokenValue = obj['access_token'];
if (typeof accessTokenValue === 'string') {
const tokenTypeValue = obj['token_type'];
const expiresInValue = obj['expires_in'];
const refreshTokenValue = obj['refresh_token'];
const scopeValue = obj['scope'];
scope: typeof obj['scope'] === 'string' ? obj['scope'] : undefined,
};
return result;
const result: OAuthTokenResponse = {
access_token: accessTokenValue,
token_type:
typeof tokenTypeValue === 'string' ? tokenTypeValue : 'Bearer',
expires_in:
typeof expiresInValue === 'number' ? expiresInValue : undefined,
refresh_token:
typeof refreshTokenValue === 'string'
? refreshTokenValue
: undefined,
scope: typeof scopeValue === 'string' ? scopeValue : undefined,
};
return result;
}
}
// JSON parsed but doesn't look like a token response — fall through
} catch {