diff --git a/lib/asar/fs-wrapper.ts b/lib/asar/fs-wrapper.ts index 1feabb16fc90..d074e9aa7a85 100644 --- a/lib/asar/fs-wrapper.ts +++ b/lib/asar/fs-wrapper.ts @@ -60,8 +60,8 @@ const splitPath = (archivePathOrBuffer: string | Buffer) => { // Convert asar archive's Stats object to fs's Stats object. let nextInode = 0; -const uid = process.getuid != null ? process.getuid() : 0; -const gid = process.getgid != null ? process.getgid() : 0; +const uid = process.getuid?.() ?? 0; +const gid = process.getgid?.() ?? 0; const fakeTime = new Date(); diff --git a/lib/browser/api/auto-updater/squirrel-update-win.ts b/lib/browser/api/auto-updater/squirrel-update-win.ts index 5d8a998b4e1c..800873082169 100644 --- a/lib/browser/api/auto-updater/squirrel-update-win.ts +++ b/lib/browser/api/auto-updater/squirrel-update-win.ts @@ -68,7 +68,7 @@ const spawnUpdate = function (args: string[], detached: boolean, callback: Funct if (code !== 0) { // Disabled for backwards compatibility: // eslint-disable-next-line standard/no-callback-literal - return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`); + return callback(`Command failed: ${signal ?? code}\n${stderr}`); } // Success. diff --git a/lib/browser/api/desktop-capturer.ts b/lib/browser/api/desktop-capturer.ts index 81af3a1eeb5f..fc27bbb86c63 100644 --- a/lib/browser/api/desktop-capturer.ts +++ b/lib/browser/api/desktop-capturer.ts @@ -9,8 +9,7 @@ let currentlyRunning: { // |options.types| can't be empty and must be an array function isValid (options: Electron.SourcesOptions) { - const types = options ? options.types : undefined; - return Array.isArray(types); + return Array.isArray(options?.types); } export async function getSources (args: Electron.SourcesOptions) { diff --git a/lib/browser/api/touch-bar.ts b/lib/browser/api/touch-bar.ts index 9e5a43468daa..e48cc673a11c 100644 --- a/lib/browser/api/touch-bar.ts +++ b/lib/browser/api/touch-bar.ts @@ -395,7 +395,7 @@ class TouchBar extends EventEmitter implements Electron.TouchBar { this.on('change', changeListener); const escapeItemListener = (item: Electron.TouchBarItemType | null) => { - window._setEscapeTouchBarItem(item != null ? item : {}); + window._setEscapeTouchBarItem(item ?? {}); }; this.on('escape-item-change', escapeItemListener); diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts index 2d88a0a017ea..b413d35c3a9f 100644 --- a/lib/browser/guest-view-manager.ts +++ b/lib/browser/guest-view-manager.ts @@ -38,8 +38,8 @@ function makeWebPreferences (embedder: Electron.WebContents, params: Record