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

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