From 8f7a09c29d634f1748aaa5d746f3a0a290e93ffd Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Tue, 17 Mar 2026 10:57:27 -0400 Subject: [PATCH] Fix lint errors in credentials.ts - Fix prettier formatting for multi-line regex in expandPath - Add proper types to regex callback params to fix no-unsafe-assignment - Suppress no-unused-vars for destructured _rawContent in saveConfig --- src/credentials.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/credentials.ts b/src/credentials.ts index ed54e86..7c59e6a 100644 --- a/src/credentials.ts +++ b/src/credentials.ts @@ -34,10 +34,13 @@ export interface Config { */ function expandPath(filePath: string): string { // Expand environment variables: ${VAR} and $VAR formats - let expanded = filePath.replace(/\$\{([^}]+)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (_, braced, bare) => { - const variable = braced || bare; - return process.env[variable] || ''; - }); + let expanded = filePath.replace( + /\$\{([^}]+)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, + (_, braced: string | undefined, bare: string | undefined) => { + const variable = braced || bare || ''; + return process.env[variable] || ''; + } + ); // Handle tilde for home directory if (expanded.startsWith('~/')) { @@ -145,6 +148,7 @@ export function saveConfig(config: Config, filePath: string): void { const expandedPath = expandPath(filePath); // Strip internal field before dumping + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { _rawContent, ...configData } = config; const yamlContent = yaml.dump(configData, {