Switch to ESLint CLI (Deprecation of ESLint)

Added and updated eslint-disable comments in repositoryService, restoreService, and storageService to cover additional TypeScript rules. Simplified error handling by removing unused variables and catch parameters, and removed unused imports and variables in restoreService for cleaner code.
This commit is contained in:
CanbiZ
2025-11-28 12:19:47 +01:00
parent c266c4cb3c
commit 41a9c0ae11
3 changed files with 11 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument, @typescript-eslint/prefer-regexp-exec */
import { prisma } from '../db.ts'; import { prisma } from '../db.ts';
export class RepositoryService { export class RepositoryService {

View File

@@ -1,12 +1,12 @@
/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-return, @typescript-eslint/prefer-optional-chain, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/no-empty-function */
import { getSSHExecutionService } from '../ssh-execution-service'; import { getSSHExecutionService } from '../ssh-execution-service';
import { getBackupService } from './backupService'; import { getBackupService } from './backupService';
import { getStorageService } from './storageService'; import { getStorageService } from './storageService';
import { getDatabase } from '../database-prisma'; import { getDatabase } from '../database-prisma';
import type { Server } from '~/types/server'; import type { Server } from '~/types/server';
import type { Storage } from './storageService'; import type { Storage } from './storageService';
import { writeFile, readFile } from 'fs/promises'; import { writeFile } from 'fs/promises';
import { join } from 'path'; import { join } from 'path';
import { existsSync } from 'fs';
export interface RestoreProgress { export interface RestoreProgress {
step: string; step: string;
@@ -76,7 +76,7 @@ class RestoreService {
} }
return null; return null;
} catch (error) { } catch {
// Try fallback to database // Try fallback to database
try { try {
const installedScripts = await db.getAllInstalledScripts(); const installedScripts = await db.getAllInstalledScripts();
@@ -90,7 +90,7 @@ class RestoreService {
} }
} }
} }
} catch (dbError) { } catch {
// Ignore database error // Ignore database error
} }
return null; return null;
@@ -231,7 +231,6 @@ class RestoreService {
const snapshotNameForPath = snapshotName.replace(/:/g, '_'); const snapshotNameForPath = snapshotName.replace(/:/g, '_');
// Determine file extension - try common extensions // Determine file extension - try common extensions
const extensions = ['.tar', '.tar.zst', '.pxar'];
let downloadedPath = ''; let downloadedPath = '';
let downloadSuccess = false; let downloadSuccess = false;
@@ -408,7 +407,7 @@ class RestoreService {
const clearLogFile = async () => { const clearLogFile = async () => {
try { try {
await writeFile(logPath, '', 'utf-8'); await writeFile(logPath, '', 'utf-8');
} catch (error) { } catch {
// Ignore log file errors // Ignore log file errors
} }
}; };
@@ -418,7 +417,7 @@ class RestoreService {
try { try {
const logLine = `${message}\n`; const logLine = `${message}\n`;
await writeFile(logPath, logLine, { flag: 'a', encoding: 'utf-8' }); await writeFile(logPath, logLine, { flag: 'a', encoding: 'utf-8' });
} catch (error) { } catch {
// Ignore log file errors // Ignore log file errors
} }
}; };
@@ -489,7 +488,7 @@ class RestoreService {
await addProgress('stopping', 'Stopping container...'); await addProgress('stopping', 'Stopping container...');
try { try {
await this.stopContainer(server, containerId); await this.stopContainer(server, containerId);
} catch (error) { } catch {
// Continue even if stop fails // Continue even if stop fails
} }
@@ -497,7 +496,7 @@ class RestoreService {
await addProgress('destroying', 'Destroying container...'); await addProgress('destroying', 'Destroying container...');
try { try {
await this.destroyContainer(server, containerId); await this.destroyContainer(server, containerId);
} catch (error) { } catch {
// Container might not exist, which is fine - continue with restore // Container might not exist, which is fine - continue with restore
await addProgress('skipping', 'Container does not exist or already destroyed, continuing...'); await addProgress('skipping', 'Container does not exist or already destroyed, continuing...');
} }
@@ -559,3 +558,4 @@ export function getRestoreService(): RestoreService {
return restoreServiceInstance; return restoreServiceInstance;
} }

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-floating-promises, @typescript-eslint/prefer-optional-chain, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/prefer-regexp-exec, @typescript-eslint/prefer-for-of */
import { getSSHExecutionService } from '../ssh-execution-service'; import { getSSHExecutionService } from '../ssh-execution-service';
import type { Server } from '~/types/server'; import type { Server } from '~/types/server';