From 14a919cf9bd18e9e9df601ab6ba757d45083c9c3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 10 Dec 2019 18:10:15 +0000 Subject: [PATCH] Fix the linting errors --- .eslintrc.js | 6 ++++++ src/electron-main.js | 30 ++++++++++++++++-------------- src/updater.js | 3 +-- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8034967..9c1480f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,3 +17,9 @@ module.exports = { // don't use babel, so remove it & put the original back delete module.exports.rules["babel/no-invalid-this"]; module.exports.rules["no-invalid-this"] = "error"; + +// also override the line length to be consistent with +// vector-web / react-sdk rather than js-sdk +module.exports.rules["max-len"] = ["warn", { + code: 120, +}]; diff --git a/src/electron-main.js b/src/electron-main.js index 1bf4ebe..6e56b16 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -301,14 +301,14 @@ ipcMain.on('seshat', async function(ev, payload) { const sendError = (id, e) => { const error = { - message: e.message - } + message: e.message, + }; mainWindow.webContents.send('seshatReply', { - id:id, - error: error + id: id, + error: error, }); - } + }; const args = payload.args || []; let ret; @@ -336,16 +336,18 @@ ipcMain.on('seshat', async function(ev, payload) { break; case 'deleteEventIndex': - const deleteFolderRecursive = async(p) => { - for (let entry of await afs.readdir(p)) { - const curPath = path.join(p, entry); - await afs.unlink(curPath); - } - } + { + const deleteFolderRecursive = async (p) => { + for (const entry of await afs.readdir(p)) { + const curPath = path.join(p, entry); + await afs.unlink(curPath); + } + }; - try { - await deleteFolderRecursive(eventStorePath); - } catch (e) { + try { + await deleteFolderRecursive(eventStorePath); + } catch (e) { + } } break; diff --git a/src/updater.js b/src/updater.js index 49fa4e0..f5917f8 100644 --- a/src/updater.js +++ b/src/updater.js @@ -38,7 +38,6 @@ module.exports.start = function startAutoUpdate(updateBaseUrl) { // and also acts as a convenient cache-buster to ensure that when the // app updates it always gets a fresh value to avoid update-looping. url = `${updateBaseUrl}macos/?localVersion=${encodeURIComponent(app.getVersion())}`; - } else if (process.platform === 'win32') { url = `${updateBaseUrl}win32/${process.arch}/`; } else { @@ -64,7 +63,7 @@ module.exports.start = function startAutoUpdate(updateBaseUrl) { // will fail if running in debug mode console.log('Couldn\'t enable update checking', err); } -} +}; ipcMain.on('install_update', installUpdate); ipcMain.on('check_updates', pollForUpdates);