fix: resolve unused variables in backend utils

Fixed @typescript-eslint/no-unused-vars errors in:
- starter.ts: removed unused error variables (2 fixes)
- auto-ssl-setup.ts: removed unused error variable (1 fix)
- ssh-key-utils.ts: removed unused error variables (3 fixes)
- user-crypto.ts: removed unused error variables (5 fixes)
- data-crypto.ts: removed unused plaintextFields and error variables (2 fixes)
- simple-db-ops.ts: removed unused parameters _userId and _tableName (2 fixes)

Total: 15 unused variable errors fixed

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-10-09 18:43:23 +08:00
parent 3b40eff2a9
commit 9d6d8a7e0e
10 changed files with 2361 additions and 19 deletions

View File

@@ -101,7 +101,7 @@ export class AutoSSLSetup {
try {
try {
execSync("openssl version", { stdio: "pipe" });
} catch (error) {
} catch {
throw new Error(
"OpenSSL is not installed or not available in PATH. Please install OpenSSL to enable SSL certificate generation.",
);

View File

@@ -97,7 +97,7 @@ class DataCrypto {
let migratedFieldsCount = 0;
try {
const { needsMigration, plaintextFields } =
const { needsMigration } =
await LazyFieldEncryption.checkUserNeedsMigration(
userId,
userDataKey,
@@ -452,7 +452,7 @@ class DataCrypto {
);
return decrypted === testData;
} catch (error) {
} catch {
return false;
}
}

View File

@@ -131,11 +131,10 @@ class SimpleDBOps {
table: SQLiteTable<any>,
tableName: TableName,
where: unknown,
_userId: string,
): Promise<unknown[]> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const result = await getDb()
.delete(table)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.where(where as any)
.returning();
@@ -152,10 +151,7 @@ class SimpleDBOps {
return DataCrypto.getUserDataKey(userId) !== null;
}
static async selectEncrypted(
query: unknown,
_tableName: TableName,
): Promise<unknown[]> {
static async selectEncrypted(query: unknown): Promise<unknown[]> {
const results = await query;
return results as unknown[];

View File

@@ -49,7 +49,7 @@ function detectKeyTypeFromContent(keyContent: string): string {
}
return "ssh-rsa";
} catch (error) {
} catch {
return "ssh-rsa";
}
}
@@ -240,7 +240,7 @@ export function parseSSHKey(
} else {
publicKey = "";
}
} catch (error) {
} catch {
publicKey = "";
}
@@ -318,7 +318,7 @@ export function detectKeyType(privateKeyData: string): string {
return "unknown";
}
return parsedKey.type || "unknown";
} catch (error) {
} catch {
return "unknown";
}
}

View File

@@ -195,7 +195,7 @@ class UserCrypto {
DEK.fill(0);
return true;
} catch (error) {
} catch {
await this.setupOIDCUserEncryption(userId);
return true;
}
@@ -275,7 +275,7 @@ class UserCrypto {
this.logoutUser(userId);
return true;
} catch (error) {
} catch {
return false;
}
}
@@ -298,7 +298,7 @@ class UserCrypto {
DEK.fill(0);
return true;
} catch (error) {
} catch {
return false;
}
}
@@ -417,7 +417,7 @@ class UserCrypto {
}
return JSON.parse(result[0].value);
} catch (error) {
} catch {
return null;
}
}
@@ -457,7 +457,7 @@ class UserCrypto {
}
return JSON.parse(result[0].value);
} catch (error) {
} catch {
return null;
}
}