diff --git a/CliClient/app/ResourceServer.js b/CliClient/app/ResourceServer.js index c17d6e6c0..b2e9aea84 100644 --- a/CliClient/app/ResourceServer.js +++ b/CliClient/app/ResourceServer.js @@ -28,7 +28,7 @@ class ResourceServer { baseUrl() { if (!this.port_) return ''; - return 'http://127.0.0.1:' + this.port_; + return `http://127.0.0.1:${this.port_}`; } setLinkHandler(handler) { @@ -53,7 +53,7 @@ class ResourceServer { const url = urlParser.parse(request.url, true); let resourceId = url.pathname.split('/'); if (resourceId.length < 2) { - writeResponse('Error: could not get resource ID from path name: ' + url.pathname); + writeResponse(`Error: could not get resource ID from path name: ${url.pathname}`); return; } resourceId = resourceId[1]; @@ -62,7 +62,7 @@ class ResourceServer { try { const done = await this.linkHandler_(resourceId, response); - if (!done) throw new Error('Unhandled resource: ' + resourceId); + if (!done) throw new Error(`Unhandled resource: ${resourceId}`); } catch (error) { response.setHeader('Content-Type', 'text/plain'); // eslint-disable-next-line require-atomic-updates diff --git a/CliClient/app/app-gui.js b/CliClient/app/app-gui.js index bb6e8625b..23268ed16 100644 --- a/CliClient/app/app-gui.js +++ b/CliClient/app/app-gui.js @@ -288,7 +288,7 @@ class AppGui { if (!cmd) return; const isConfigPassword = cmd.indexOf('config ') >= 0 && cmd.indexOf('password') >= 0; if (isConfigPassword) return; - this.stdout(chalk.cyan.bold('> ' + cmd)); + this.stdout(chalk.cyan.bold(`> ${cmd}`)); } setupKeymap(keymap) { @@ -297,7 +297,7 @@ class AppGui { for (let i = 0; i < keymap.length; i++) { const item = Object.assign({}, keymap[i]); - if (!item.command) throw new Error('Missing command for keymap item: ' + JSON.stringify(item)); + if (!item.command) throw new Error(`Missing command for keymap item: ${JSON.stringify(item)}`); if (!('type' in item)) item.type = 'exec'; @@ -440,7 +440,7 @@ class AppGui { if (!item) return; if (item.type_ === BaseModel.TYPE_FOLDER) { - await this.processPromptCommand('rmbook ' + item.id); + await this.processPromptCommand(`rmbook ${item.id}`); } else if (item.type_ === BaseModel.TYPE_TAG) { this.stdout(_('To delete a tag, untag the associated notes.')); } else if (item.type_ === BaseModel.TYPE_SEARCH) { @@ -473,7 +473,7 @@ class AppGui { this.addCommandToConsole(cmd); await this.processPromptCommand(cmd); } else { - throw new Error('Unknown command: ' + cmd); + throw new Error(`Unknown command: ${cmd}`); } } @@ -593,7 +593,7 @@ class AppGui { if (!s) return false; s = s.trim().toLowerCase(); for (let i = 0; i < protocols.length; i++) { - if (s.indexOf(protocols[i] + '://') === 0) return true; + if (s.indexOf(`${protocols[i]}://`) === 0) return true; } return false; }; @@ -627,7 +627,7 @@ class AppGui { if (link.type === 'item') { const itemId = link.id; let item = await BaseItem.loadItemById(itemId); - if (!item) throw new Error('No item with ID ' + itemId); // Should be nearly impossible + if (!item) throw new Error(`No item with ID ${itemId}`); // Should be nearly impossible if (item.type_ === BaseModel.TYPE_RESOURCE) { if (item.mime) response.setHeader('Content-Type', item.mime); @@ -640,11 +640,11 @@ class AppGui {
`, ]; - html.push('' + htmlentities(item.title) + '\n\n' + htmlentities(item.body) + ''); + html.push(`
${htmlentities(item.title)}\n\n${htmlentities(item.body)}`); html.push('