From 3c6b0a7f350d2c719390b0bde5c8bb792ee22e97 Mon Sep 17 00:00:00 2001 From: "Jonathan (JB) Belcher" Date: Thu, 17 Sep 2020 11:18:24 -0400 Subject: [PATCH 1/2] Various linting fixes --- desktop/app.js | 4 ++-- lib/boot.ts | 6 +++--- lib/note-editor/index.tsx | 1 - lib/state/electron/middleware.ts | 6 +++++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/desktop/app.js b/desktop/app.js index c1335deb2..38e0137c8 100644 --- a/desktop/app.js +++ b/desktop/app.js @@ -123,8 +123,8 @@ module.exports = function main() { mainWindow.setMenuBarVisibility(!autoHideMenuBar); }); - ipcMain.on('wpLogin', function (event, url) { - shell.openExternal(url); + ipcMain.on('wpLogin', function (event, wpLoginUrl) { + shell.openExternal(wpLoginUrl); }); ipcMain.on('importNotes', function (event, filePath) { diff --git a/lib/boot.ts b/lib/boot.ts index 0fb0216a2..d86839972 100644 --- a/lib/boot.ts +++ b/lib/boot.ts @@ -12,7 +12,7 @@ import { boot as bootLoggingOut } from './logging-out'; const config = getConfig(); const clearStorage = (): Promise => - new Promise((resolve) => { + new Promise((parentResolve) => { localStorage.removeItem('access_token'); localStorage.removeItem('lastSyncedTime'); localStorage.removeItem('localQueue:note'); @@ -57,9 +57,9 @@ const clearStorage = (): Promise => ]) .then(() => { window.electron?.send('clearCookies'); - resolve(); + parentResolve(); }) - .catch(() => resolve()); + .catch(() => parentResolve()); }); const forceReload = () => history.go(); diff --git a/lib/note-editor/index.tsx b/lib/note-editor/index.tsx index a9517ad43..f6a709d77 100644 --- a/lib/note-editor/index.tsx +++ b/lib/note-editor/index.tsx @@ -58,7 +58,6 @@ export class NoteEditor extends Component { // toggle Markdown enabled if (note && cmdOrCtrl && shiftKey && 'm' === key) { - console.log('toggling markdown'); toggleMarkdown(noteId, !this.markdownEnabled()); event.stopPropagation(); event.preventDefault(); diff --git a/lib/state/electron/middleware.ts b/lib/state/electron/middleware.ts index 1d660d191..faf4eec19 100644 --- a/lib/state/electron/middleware.ts +++ b/lib/state/electron/middleware.ts @@ -1,7 +1,11 @@ +import debugFactory from 'debug'; + import actions from '../actions'; import * as S from '../'; +const debug = debugFactory('electron-middleware'); + export const middleware: S.Middleware = ({ dispatch, getState }) => { window.electron.receive('appCommand', (command) => { switch (command.action) { @@ -82,7 +86,7 @@ export const middleware: S.Middleware = ({ dispatch, getState }) => { return; default: - console.log(command); + debug(`unknown AppCommand: ${command}`); } }); From fac463e062949b3439938d53649efd54cd88ea86 Mon Sep 17 00:00:00 2001 From: "Jonathan (JB) Belcher" Date: Thu, 17 Sep 2020 13:00:33 -0400 Subject: [PATCH 2/2] Semantic rather than structural variable name --- lib/boot.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/boot.ts b/lib/boot.ts index d86839972..bd675b121 100644 --- a/lib/boot.ts +++ b/lib/boot.ts @@ -12,7 +12,7 @@ import { boot as bootLoggingOut } from './logging-out'; const config = getConfig(); const clearStorage = (): Promise => - new Promise((parentResolve) => { + new Promise((resolveStorage) => { localStorage.removeItem('access_token'); localStorage.removeItem('lastSyncedTime'); localStorage.removeItem('localQueue:note'); @@ -57,9 +57,9 @@ const clearStorage = (): Promise => ]) .then(() => { window.electron?.send('clearCookies'); - parentResolve(); + resolveStorage(); }) - .catch(() => parentResolve()); + .catch(() => resolveStorage()); }); const forceReload = () => history.go();