Enable no-empty lint

This commit is contained in:
valadaptive 2023-12-02 09:14:48 -05:00
parent 367f3dba27
commit 60ac1aa1c7
4 changed files with 11 additions and 6 deletions

View File

@ -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'
}
};

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);