fix(lint): remove unnecessary async keywords from synchronous functions
Some checks failed
CI / Build All Platforms (Tag/Main only) (push) Has been skipped
CI / Type Check & Lint (push) Successful in 5s
CI / Build Test (Current Platform) (push) Successful in 5s
Release / build-and-release (push) Failing after 2s

- Remove async from functions that don't use await
- Change return types from Promise<void> to void for synchronous functions
- Fixes all 8 require-await lint warnings
- Reduces total lint warnings from 63 to 55
This commit is contained in:
2025-10-19 13:25:01 +00:00
parent 071ded9c41
commit 37ccbf58fd
5 changed files with 8 additions and 8 deletions

View File

@@ -977,7 +977,7 @@ export class UpsHandler {
* Check if the systemd service is running and restart it if it is * Check if the systemd service is running and restart it if it is
* This is useful after configuration changes * This is useful after configuration changes
*/ */
public async restartServiceIfRunning(): Promise<void> { public restartServiceIfRunning(): void {
try { try {
// Check if the service is active // Check if the service is active
const isActive = const isActive =

View File

@@ -196,7 +196,7 @@ export class NupstDaemon {
/** /**
* Save configuration to file * Save configuration to file
*/ */
public async saveConfig(config: INupstConfig): Promise<void> { public saveConfig(config: INupstConfig): void {
try { try {
const configDir = path.dirname(this.CONFIG_PATH); const configDir = path.dirname(this.CONFIG_PATH);
if (!fs.existsSync(configDir)) { if (!fs.existsSync(configDir)) {

View File

@@ -130,7 +130,7 @@ export class Nupst {
* Get the latest version from npm registry * Get the latest version from npm registry
* @returns Promise resolving to the latest version string * @returns Promise resolving to the latest version string
*/ */
private async getLatestVersion(): Promise<string> { private getLatestVersion(): Promise<string> {
return new Promise<string>((resolve, reject) => { return new Promise<string>((resolve, reject) => {
const options = { const options = {
hostname: 'registry.npmjs.org', hostname: 'registry.npmjs.org',

View File

@@ -88,7 +88,7 @@ export class NupstSnmp {
* @param retryCount Current retry count (unused in this implementation) * @param retryCount Current retry count (unused in this implementation)
* @returns Promise resolving to the SNMP response value * @returns Promise resolving to the SNMP response value
*/ */
public async snmpGet( public snmpGet(
oid: string, oid: string,
config = this.DEFAULT_CONFIG, config = this.DEFAULT_CONFIG,
retryCount = 0, retryCount = 0,

View File

@@ -119,7 +119,7 @@ WantedBy=multi-user.target
* Stop the systemd service * Stop the systemd service
* @throws Error if stop fails * @throws Error if stop fails
*/ */
public async stop(): Promise<void> { public stop(): void {
try { try {
execSync('systemctl stop nupst.service'); execSync('systemctl stop nupst.service');
logger.success('NUPST service stopped'); logger.success('NUPST service stopped');
@@ -168,7 +168,7 @@ WantedBy=multi-user.target
* Display the systemd service status * Display the systemd service status
* @private * @private
*/ */
private async displayServiceStatus(): Promise<void> { private displayServiceStatus(): void {
try { try {
const serviceStatus = execSync('systemctl status nupst.service').toString(); const serviceStatus = execSync('systemctl status nupst.service').toString();
const boxWidth = 45; const boxWidth = 45;
@@ -315,7 +315,7 @@ WantedBy=multi-user.target
* Stop the service if it's running * Stop the service if it's running
* @private * @private
*/ */
private async stopService(): Promise<void> { private stopService(): void {
try { try {
logger.log('Stopping NUPST service...'); logger.log('Stopping NUPST service...');
execSync('systemctl stop nupst.service'); execSync('systemctl stop nupst.service');
@@ -329,7 +329,7 @@ WantedBy=multi-user.target
* Disable the service * Disable the service
* @private * @private
*/ */
private async disableService(): Promise<void> { private disableService(): void {
try { try {
logger.log('Disabling NUPST service...'); logger.log('Disabling NUPST service...');
execSync('systemctl disable nupst.service'); execSync('systemctl disable nupst.service');