From 60ac1aa1c70ab8b7ebf327845cade581b27500a9 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Sat, 2 Dec 2023 09:14:48 -0500 Subject: [PATCH] Enable no-empty lint --- .eslintrc.js | 3 +-- public/scripts/kai-settings.js | 4 +++- public/scripts/textgen-settings.js | 4 +++- server.js | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3f9e55ba8..6cc572aba 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,7 +66,6 @@ module.exports = { 'use-isnan': 'off', 'no-self-assign': 'off', 'no-unsafe-negation': 'off', - 'no-constant-condition': 'off', - 'no-empty': 'off' + 'no-constant-condition': 'off' } }; diff --git a/public/scripts/kai-settings.js b/public/scripts/kai-settings.js index 75c0fc10c..96bf8502e 100644 --- a/public/scripts/kai-settings.js +++ b/public/scripts/kai-settings.js @@ -66,7 +66,9 @@ export function formatKoboldUrl(value) { url.pathname = '/api'; } return url.toString(); - } catch { } // Just using URL as a validation check + } catch { + // Just using URL as a validation check + } return null; } diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index a23bec16f..427a289a1 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -174,7 +174,9 @@ function formatTextGenURL(value) { url.pathname = '/api'; } return url.toString(); - } catch { } // Just using URL as a validation check + } catch { + // Just using URL as a validation check + } return null; } diff --git a/server.js b/server.js index 750894bc0..7fa66ed9d 100644 --- a/server.js +++ b/server.js @@ -118,7 +118,9 @@ if (fs.existsSync(whitelistPath)) { try { let whitelistTxt = fs.readFileSync(whitelistPath, 'utf-8'); whitelist = whitelistTxt.split("\n").filter(ip => ip).map(ip => ip.trim()); - } catch (e) { } + } catch (e) { + // Ignore errors that may occur when reading the whitelist (e.g. permissions) + } } const whitelistMode = getConfigValue('whitelistMode', true); @@ -781,7 +783,7 @@ app.post("/getchat", jsonParser, function (request, response) { const lines = data.split('\n'); // Iterate through the array of strings and parse each line as JSON - const jsonData = lines.map((l) => { try { return JSON.parse(l); } catch (_) { } }).filter(x => x); + const jsonData = lines.map((l) => { try { return JSON.parse(l); } catch (_) { return; } }).filter(x => x); return response.send(jsonData); } catch (error) { console.error(error);