From 37ccbf58fd527dad665ee2cf57502b3be335bd42 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sun, 19 Oct 2025 13:25:01 +0000 Subject: [PATCH] fix(lint): remove unnecessary async keywords from synchronous functions - Remove async from functions that don't use await - Change return types from Promise to void for synchronous functions - Fixes all 8 require-await lint warnings - Reduces total lint warnings from 63 to 55 --- ts/cli/ups-handler.ts | 2 +- ts/daemon.ts | 2 +- ts/nupst.ts | 2 +- ts/snmp/manager.ts | 2 +- ts/systemd.ts | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ts/cli/ups-handler.ts b/ts/cli/ups-handler.ts index 368b327..c7aa2f1 100644 --- a/ts/cli/ups-handler.ts +++ b/ts/cli/ups-handler.ts @@ -977,7 +977,7 @@ export class UpsHandler { * Check if the systemd service is running and restart it if it is * This is useful after configuration changes */ - public async restartServiceIfRunning(): Promise { + public restartServiceIfRunning(): void { try { // Check if the service is active const isActive = diff --git a/ts/daemon.ts b/ts/daemon.ts index 12feece..885bd20 100644 --- a/ts/daemon.ts +++ b/ts/daemon.ts @@ -196,7 +196,7 @@ export class NupstDaemon { /** * Save configuration to file */ - public async saveConfig(config: INupstConfig): Promise { + public saveConfig(config: INupstConfig): void { try { const configDir = path.dirname(this.CONFIG_PATH); if (!fs.existsSync(configDir)) { diff --git a/ts/nupst.ts b/ts/nupst.ts index d4b45a8..e1bf3b1 100644 --- a/ts/nupst.ts +++ b/ts/nupst.ts @@ -130,7 +130,7 @@ export class Nupst { * Get the latest version from npm registry * @returns Promise resolving to the latest version string */ - private async getLatestVersion(): Promise { + private getLatestVersion(): Promise { return new Promise((resolve, reject) => { const options = { hostname: 'registry.npmjs.org', diff --git a/ts/snmp/manager.ts b/ts/snmp/manager.ts index 418ff78..c674e54 100644 --- a/ts/snmp/manager.ts +++ b/ts/snmp/manager.ts @@ -88,7 +88,7 @@ export class NupstSnmp { * @param retryCount Current retry count (unused in this implementation) * @returns Promise resolving to the SNMP response value */ - public async snmpGet( + public snmpGet( oid: string, config = this.DEFAULT_CONFIG, retryCount = 0, diff --git a/ts/systemd.ts b/ts/systemd.ts index 9a953e3..2d8c6c7 100644 --- a/ts/systemd.ts +++ b/ts/systemd.ts @@ -119,7 +119,7 @@ WantedBy=multi-user.target * Stop the systemd service * @throws Error if stop fails */ - public async stop(): Promise { + public stop(): void { try { execSync('systemctl stop nupst.service'); logger.success('NUPST service stopped'); @@ -168,7 +168,7 @@ WantedBy=multi-user.target * Display the systemd service status * @private */ - private async displayServiceStatus(): Promise { + private displayServiceStatus(): void { try { const serviceStatus = execSync('systemctl status nupst.service').toString(); const boxWidth = 45; @@ -315,7 +315,7 @@ WantedBy=multi-user.target * Stop the service if it's running * @private */ - private async stopService(): Promise { + private stopService(): void { try { logger.log('Stopping NUPST service...'); execSync('systemctl stop nupst.service'); @@ -329,7 +329,7 @@ WantedBy=multi-user.target * Disable the service * @private */ - private async disableService(): Promise { + private disableService(): void { try { logger.log('Disabling NUPST service...'); execSync('systemctl disable nupst.service');