diff --git a/app/main/index.ts b/app/main/index.ts index 791e16db..05c1d659 100644 --- a/app/main/index.ts +++ b/app/main/index.ts @@ -107,12 +107,12 @@ function createMainWindow(): Electron.BrowserWindow { win.loadURL(mainURL); // Keep the app running in background on close event - win.on('close', e => { + win.on('close', event => { if (ConfigUtil.getConfigItem('quitOnClose')) { app.quit(); } if (!isQuitting) { - e.preventDefault(); + event.preventDefault(); if (process.platform === 'darwin') { app.hide(); @@ -133,8 +133,8 @@ function createMainWindow(): Electron.BrowserWindow { }); // To destroy tray icon when navigate to a new URL - win.webContents.on('will-navigate', e => { - if (e) { + win.webContents.on('will-navigate', event => { + if (event) { win.webContents.send('destroytray'); } }); @@ -305,8 +305,8 @@ app.on('ready', () => { BadgeSettings.updateTaskbarIcon(data, text, mainWindow); }); - ipcMain.on('forward-message', (_event: Electron.IpcMainEvent, listener: string, ...params: any[]) => { - page.send(listener, ...params); + ipcMain.on('forward-message', (_event: Electron.IpcMainEvent, listener: string, ...parameters: any[]) => { + page.send(listener, ...parameters); }); ipcMain.on('update-menu', (_event: Electron.IpcMainEvent, props: any) => { diff --git a/app/main/menu.ts b/app/main/menu.ts index dfed267b..5ce335ab 100644 --- a/app/main/menu.ts +++ b/app/main/menu.ts @@ -540,14 +540,14 @@ function getOtherTpl(props: any): Electron.MenuItemConstructorOptions[] { }]; } -function sendAction(action: string, ...params: any[]): void { +function sendAction(action: string, ...parameters: any[]): void { const win = BrowserWindow.getAllWindows()[0]; if (process.platform === 'darwin') { win.restore(); } - win.webContents.send(action, ...params); + win.webContents.send(action, ...parameters); } function checkForUpdate(): void { diff --git a/app/renderer/js/components/functional-tab.ts b/app/renderer/js/components/functional-tab.ts index ca64c1cd..3fbebbaf 100644 --- a/app/renderer/js/components/functional-tab.ts +++ b/app/renderer/js/components/functional-tab.ts @@ -39,9 +39,9 @@ export default class FunctionalTab extends Tab { this.$closeButton.classList.remove('active'); }); - this.$closeButton.addEventListener('click', (e: Event) => { + this.$closeButton.addEventListener('click', (event: Event) => { this.props.onDestroy(); - e.stopPropagation(); + event.stopPropagation(); }); } } diff --git a/app/renderer/js/components/webview.ts b/app/renderer/js/components/webview.ts index 56ec92b8..7570ea32 100644 --- a/app/renderer/js/components/webview.ts +++ b/app/renderer/js/components/webview.ts @@ -192,8 +192,8 @@ export default class WebView extends BaseComponent { this.customCSS = null; ConfigUtil.setConfigItem('customCSS', null); - const errMsg = 'The custom css previously set is deleted!'; - dialog.showErrorBox('custom css file deleted!', errMsg); + const errorMessage = 'The custom css previously set is deleted!'; + dialog.showErrorBox('custom css file deleted!', errorMessage); return; } @@ -295,8 +295,8 @@ export default class WebView extends BaseComponent { this.init(); } - async send(channel: string, ...param: any[]): Promise { + async send(channel: string, ...parameters: any[]): Promise { await this.domReady; - this.$el.send(channel, ...param); + this.$el.send(channel, ...parameters); } } diff --git a/app/renderer/js/feedback.ts b/app/renderer/js/feedback.ts index b63b64f7..ab3f3ee6 100644 --- a/app/renderer/js/feedback.ts +++ b/app/renderer/js/feedback.ts @@ -61,10 +61,10 @@ sendFeedback.useReporter('emailReporter', { email: 'akash@zulipchat.com' }); -feedbackHolder.addEventListener('click', (e: Event) => { +feedbackHolder.addEventListener('click', (event: Event) => { // only remove the class if the grey out faded // part is clicked and not the feedback element itself - if (e.target === e.currentTarget) { + if (event.target === event.currentTarget) { feedbackHolder.classList.remove('show'); } }); diff --git a/app/renderer/js/main.ts b/app/renderer/js/main.ts index 1fa19b38..7f4fc7da 100644 --- a/app/renderer/js/main.ts +++ b/app/renderer/js/main.ts @@ -741,8 +741,8 @@ class ServerManagerView { } addContextMenu($serverImg: HTMLImageElement, index: number): void { - $serverImg.addEventListener('contextmenu', e => { - e.preventDefault(); + $serverImg.addEventListener('contextmenu', event => { + event.preventDefault(); const template = [ { label: 'Disconnect organization', diff --git a/app/renderer/js/notification/darwin-notifications.ts b/app/renderer/js/notification/darwin-notifications.ts index e9686b7f..cff779f8 100644 --- a/app/renderer/js/notification/darwin-notifications.ts +++ b/app/renderer/js/notification/darwin-notifications.ts @@ -19,13 +19,13 @@ interface NotificationHandlerArgs { class DarwinNotification { tag: string; - constructor(title: string, opts: NotificationOptions) { + constructor(title: string, options: NotificationOptions) { const silent: boolean = ConfigUtil.getConfigItem('silent') || false; - const { icon } = opts; + const { icon } = options; const profilePic = new URL(icon, location.href).href; - this.tag = opts.tag; - const notification = new MacNotifier(title, Object.assign(opts, { + this.tag = options.tag; + const notification = new MacNotifier(title, Object.assign(options, { bundleId: appId, canReply: true, silent, diff --git a/app/renderer/js/notification/default-notification.ts b/app/renderer/js/notification/default-notification.ts index 5ac32d89..d9ac004b 100644 --- a/app/renderer/js/notification/default-notification.ts +++ b/app/renderer/js/notification/default-notification.ts @@ -5,9 +5,9 @@ import * as ConfigUtil from '../utils/config-util'; const NativeNotification = window.Notification; export default class BaseNotification extends NativeNotification { - constructor(title: string, opts: NotificationOptions) { - opts.silent = true; - super(title, opts); + constructor(title: string, options: NotificationOptions) { + options.silent = true; + super(title, options); this.addEventListener('click', () => { // focus to the server who sent the diff --git a/app/renderer/js/pages/preference/new-server-form.ts b/app/renderer/js/pages/preference/new-server-form.ts index 1ea9d4f8..ebffcfd5 100644 --- a/app/renderer/js/pages/preference/new-server-form.ts +++ b/app/renderer/js/pages/preference/new-server-form.ts @@ -72,8 +72,8 @@ export default class NewServerForm extends BaseComponent { openCreateNewOrgExternalLink(): void { const link = 'https://zulipchat.com/new/'; - const externalCreateNewOrgEl = document.querySelector('#open-create-org-link'); - externalCreateNewOrgEl.addEventListener('click', () => { + const externalCreateNewOrgElement = document.querySelector('#open-create-org-link'); + externalCreateNewOrgElement.addEventListener('click', () => { shell.openExternal(link); }); } diff --git a/app/renderer/js/pages/preference/shortcuts-section.ts b/app/renderer/js/pages/preference/shortcuts-section.ts index 7876dcd6..ed3064ee 100644 --- a/app/renderer/js/pages/preference/shortcuts-section.ts +++ b/app/renderer/js/pages/preference/shortcuts-section.ts @@ -329,8 +329,8 @@ export default class ShortcutsSection extends BaseSection { openHotkeysExternalLink(): void { const link = 'https://zulipchat.com/help/keyboard-shortcuts'; - const externalCreateNewOrgEl = document.querySelector('#open-hotkeys-link'); - externalCreateNewOrgEl.addEventListener('click', () => { + const externalCreateNewOrgElement = document.querySelector('#open-hotkeys-link'); + externalCreateNewOrgElement.addEventListener('click', () => { shell.openExternal(link); }); } diff --git a/app/renderer/js/preload.ts b/app/renderer/js/preload.ts index a8f4d2d5..34be51aa 100644 --- a/app/renderer/js/preload.ts +++ b/app/renderer/js/preload.ts @@ -108,16 +108,16 @@ document.addEventListener('DOMContentLoaded', (): void => { } // Open image attachment link in the lightbox instead of opening in the default browser const { $, lightbox } = window; - $('#main_div').on('click', '.message_content p a', function (this: HTMLElement, e: Event) { + $('#main_div').on('click', '.message_content p a', function (this: HTMLElement, event: Event) { const url = $(this).attr('href'); if (LinkUtil.isImage(url)) { const $img = $(this).parent().siblings('.message_inline_image').find('img'); // prevent the image link from opening in a new page. - e.preventDefault(); + event.preventDefault(); // prevent the message compose dialog from happening. - e.stopPropagation(); + event.stopPropagation(); // Open image in the default browser if image preview is unavailable if (!$img[0]) { diff --git a/app/renderer/js/utils/domain-util.ts b/app/renderer/js/utils/domain-util.ts index 1a020f42..0d330df8 100644 --- a/app/renderer/js/utils/domain-util.ts +++ b/app/renderer/js/utils/domain-util.ts @@ -282,10 +282,10 @@ function generateFilePath(url: string): string { const extension = path.extname(url).split('?')[0]; let hash = 5381; - let len = url.length; + let { length } = url; - while (len) { - hash = (hash * 33) ^ url.charCodeAt(--len); + while (length) { + hash = (hash * 33) ^ url.charCodeAt(--length); } // Create 'server-icons' directory if not existed diff --git a/app/renderer/js/utils/logger-util.ts b/app/renderer/js/utils/logger-util.ts index e4fda34f..9452fe66 100644 --- a/app/renderer/js/utils/logger-util.ts +++ b/app/renderer/js/utils/logger-util.ts @@ -51,13 +51,13 @@ export default class Logger { logInDevMode: boolean; [key: string]: any; - constructor(opts: LoggerOptions = {}) { + constructor(options: LoggerOptions = {}) { let { timestamp = true, file = 'console.log', level = true, logInDevMode = false - } = opts; + } = options; file = `${logDir}/${file}`; if (timestamp === true) { diff --git a/app/renderer/js/utils/reconnect-util.ts b/app/renderer/js/utils/reconnect-util.ts index a7567387..fe00f3f6 100644 --- a/app/renderer/js/utils/reconnect-util.ts +++ b/app/renderer/js/utils/reconnect-util.ts @@ -77,9 +77,9 @@ export default class ReconnectUtil { return true; } logger.log('There is no internet connection, try checking network cables, modem and router.'); - const errMsgHolder = document.querySelector('#description'); - if (errMsgHolder) { - errMsgHolder.innerHTML = ` + const errorMessageHolder = document.querySelector('#description'); + if (errorMessageHolder) { + errorMessageHolder.innerHTML = `
Your internet connection doesn't seem to work properly!
Verify that it works and then click try again.
`; } diff --git a/tests/setup.js b/tests/setup.js index 488b8f66..8ad113e7 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -41,9 +41,9 @@ function generateTestAppPackageJson() { } // Starts the app, waits for it to load, returns a promise -async function waitForLoad(app, t, opts) { - if (!opts) { - opts = {}; +async function waitForLoad(app, t, options) { + if (!options) { + options = {}; } await app.start(); diff --git a/tools/locale-helper/index.js b/tools/locale-helper/index.js index 94c4d5bc..a4bb36e7 100644 --- a/tools/locale-helper/index.js +++ b/tools/locale-helper/index.js @@ -18,9 +18,9 @@ for (const [locale, name] of Object.entries(supportedLocales)) { console.log(`fetching translation for: ${name} - ${locale}..`); (async () => { try { - const res = await translate(phrases.join('\n'), {to: locale}); + const result = await translate(phrases.join('\n'), {to: locale}); const localeFile = `${locale}.json`; - const translatedText = res.text.split('\n'); + const translatedText = result.text.split('\n'); const translationJSON = {}; phrases.forEach((phrase, index) => { translationJSON[phrase] = translatedText[index];