From eb71f57427a0094de344a14683c3a55cbd2a44f0 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 25 Oct 2023 19:46:37 +0000 Subject: [PATCH] fix linting --- src/localdb.js | 6 +++--- src/main.js | 4 ++-- src/pve.js | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/localdb.js b/src/localdb.js index af23dde..d9c11f3 100644 --- a/src/localdb.js +++ b/src/localdb.js @@ -5,7 +5,7 @@ class LocalDB { #path = null; #data = null; constructor (path) { - try { + try { this.#path = path; this.#load(); this.pveAPI = this.getGlobal().application.pveAPI; @@ -37,14 +37,14 @@ class LocalDB { getGlobal () { return this.#data.global; } - + setGloal (config) { this.#data.global = config; this.#save(); } addUser (username, config = null) { - config = config ? config : this.#data.global.defaultuser; + config = config || this.#data.global.defaultuser; this.#data.users[username] = config; this.#save(); } diff --git a/src/main.js b/src/main.js index 820c24d..c68eabf 100644 --- a/src/main.js +++ b/src/main.js @@ -20,8 +20,8 @@ global.argv = parseArgs(process.argv.slice(2), { global.api = _package(global.argv.package); global.pve = pve; global.utils = utils; -const db = (await import(global.argv.db)).default; -global.db = new db(global.argv.dbconfig); +const DB = (await import(global.argv.db)).default; +global.db = new DB(global.argv.dbconfig); const app = express(); global.app = app; diff --git a/src/pve.js b/src/pve.js index f6382d0..8f274fc 100644 --- a/src/pve.js +++ b/src/pve.js @@ -240,14 +240,16 @@ export async function getNodeAvailDevices (node) { // get node pci devices let nodeAvailPci = requestPVE(`/nodes/${node}/hardware/pci`, "GET", { token: pveAPIToken }); // for each node container, get its config and remove devices which are already used - let vms = (await requestPVE(`/nodes/${node}/qemu`, "GET", { token: pveAPIToken })).data.data; + const vms = (await requestPVE(`/nodes/${node}/qemu`, "GET", { token: pveAPIToken })).data.data; const promises = []; for (const vm of vms) { promises.push(requestPVE(`/nodes/${node}/qemu/${vm.vmid}/config`, "GET", { token: pveAPIToken })); } const configs = await Promise.all(promises); - configs.forEach((e,i) => {configs[i] = e.data.data}); + configs.forEach((e, i) => { + configs[i] = e.data.data; + }); nodeAvailPci = (await nodeAvailPci).data.data;