Browse Source

chore: lint spec-main (#20835)

Jeremy Apthorp 5 years ago
parent
commit
ecd9e1f26e
51 changed files with 591 additions and 535 deletions
  1. 11 0
      .eslintrc.json
  2. 1 1
      Dockerfile.arm32v7
  3. 3 3
      package.json
  4. 2 2
      script/lint.js
  5. 1 1
      spec-main/ambient.d.ts
  6. 8 9
      spec-main/api-app-spec.ts
  7. 4 4
      spec-main/api-auto-updater-spec.ts
  8. 8 8
      spec-main/api-autoupdater-darwin-spec.ts
  9. 2 2
      spec-main/api-browser-view-spec.ts
  10. 1 1
      spec-main/api-browser-window-affinity-spec.ts
  11. 93 94
      spec-main/api-browser-window-spec.ts
  12. 1 1
      spec-main/api-callbacks-registry-spec.ts
  13. 66 64
      spec-main/api-context-bridge-spec.ts
  14. 10 11
      spec-main/api-crash-reporter-spec.ts
  15. 2 2
      spec-main/api-debugger-spec.ts
  16. 3 3
      spec-main/api-deprecate-spec.ts
  17. 2 2
      spec-main/api-desktop-capturer-spec.ts
  18. 1 1
      spec-main/api-dialog-spec.ts
  19. 1 1
      spec-main/api-ipc-renderer-spec.ts
  20. 37 37
      spec-main/api-ipc-spec.ts
  21. 4 5
      spec-main/api-menu-item-spec.ts
  22. 1 1
      spec-main/api-native-theme-spec.ts
  23. 8 8
      spec-main/api-net-log-spec.ts
  24. 25 29
      spec-main/api-net-spec.ts
  25. 1 1
      spec-main/api-notification-dbus-spec.ts
  26. 1 0
      spec-main/api-power-monitor-spec.ts
  27. 10 10
      spec-main/api-protocol-spec.ts
  28. 8 8
      spec-main/api-remote-spec.ts
  29. 25 25
      spec-main/api-session-spec.ts
  30. 1 1
      spec-main/api-shell-spec.ts
  31. 1 1
      spec-main/api-subframe-spec.ts
  32. 5 5
      spec-main/api-system-preferences-spec.ts
  33. 3 3
      spec-main/api-touch-bar-spec.ts
  34. 3 3
      spec-main/api-tray-spec.ts
  35. 23 23
      spec-main/api-web-contents-spec.ts
  36. 1 1
      spec-main/api-web-frame-spec.ts
  37. 4 4
      spec-main/api-web-request-spec.ts
  38. 1 1
      spec-main/asar-spec.ts
  39. 43 51
      spec-main/chromium-spec.ts
  40. 5 6
      spec-main/extensions-spec.ts
  41. 2 1
      spec-main/fixtures/extensions/chrome-runtime/main.js
  42. 3 2
      spec-main/fixtures/extensions/chrome-storage/main.js
  43. 3 3
      spec-main/node-spec.ts
  44. 3 3
      spec-main/security-warnings-spec.ts
  45. 1 1
      spec-main/spec-helpers.ts
  46. 2 2
      spec-main/version-bump-spec.ts
  47. 15 15
      spec-main/visibility-state-spec.ts
  48. 4 5
      spec-main/webview-spec.ts
  49. 4 4
      spec-main/window-helpers.ts
  50. 1 1
      vsts-arm32v7.yml
  51. 123 65
      yarn.lock

+ 11 - 0
.eslintrc.json

@@ -17,18 +17,29 @@
     "prefer-const": ["error", {
       "destructuring": "all"
     }],
+    "standard/no-callback-literal": "off",
     "node/no-deprecated-api": 0
   },
   "parserOptions": {
     "ecmaVersion": 6,
     "sourceType": "module"
   },
+  "globals": {
+    "standardScheme": "readonly"
+  },
   "overrides": [
     {
       "files": "*.js",
       "rules": {
           "@typescript-eslint/no-unused-vars": "off"
       }
+    },
+    {
+      "files": "*.d.ts",
+      "rules": {
+          "no-useless-constructor": "off",
+          "@typescript-eslint/no-unused-vars": "off"
+      }
     }
   ]
 }

+ 1 - 1
Dockerfile.arm32v7

@@ -43,7 +43,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
 && rm -rf /var/lib/apt/lists/*
 
 # Install Node.js
-RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
+RUN curl -sL https://deb.nodesource.com/setup_13.x | bash - \
   && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs \
   && rm -rf /var/lib/apt/lists/*
 

+ 3 - 3
package.json

@@ -21,8 +21,8 @@
     "@types/split": "^1.0.0",
     "@types/webpack": "^4.4.32",
     "@types/webpack-env": "^1.13.9",
-    "@typescript-eslint/eslint-plugin": "^1.4.2",
-    "@typescript-eslint/parser": "^1.4.2",
+    "@typescript-eslint/eslint-plugin": "^2.6.0",
+    "@typescript-eslint/parser": "^2.6.0",
     "asar": "^1.0.0",
     "check-for-leaks": "^1.2.1",
     "colors": "^1.1.2",
@@ -138,4 +138,4 @@
     "@types/multiparty": "^0.0.32",
     "@types/temp": "^0.8.34"
   }
-}
+}

+ 2 - 2
script/lint.js

@@ -95,8 +95,8 @@ const LINTERS = [ {
   }
 }, {
   key: 'javascript',
-  roots: ['lib', 'spec', 'script', 'default_app'],
-  ignoreRoots: ['spec/node_modules'],
+  roots: ['lib', 'spec', 'spec-main', 'script', 'default_app'],
+  ignoreRoots: ['spec/node_modules', 'spec-main/node_modules'],
   test: filename => filename.endsWith('.js') || filename.endsWith('.ts'),
   run: (opts, filenames) => {
     const cmd = path.join(SOURCE_ROOT, 'node_modules', '.bin', 'eslint')

+ 1 - 1
spec-main/ambient.d.ts

@@ -1,4 +1,4 @@
-declare var standardScheme: string;
+declare let standardScheme: string
 
 declare namespace Electron {
   interface Menu {

+ 8 - 9
spec-main/api-app-spec.ts

@@ -5,11 +5,11 @@ import * as https from 'https'
 import * as net from 'net'
 import * as fs from 'fs'
 import * as path from 'path'
-import split = require('split')
 import { app, BrowserWindow, Menu } from 'electron'
-import { emittedOnce } from './events-helpers';
-import { closeWindow } from './window-helpers';
-import { ifdescribe } from './spec-helpers';
+import { emittedOnce } from './events-helpers'
+import { closeWindow } from './window-helpers'
+import { ifdescribe } from './spec-helpers'
+import split = require('split')
 
 const features = process.electronBinding('features')
 
@@ -196,7 +196,7 @@ describe('app module', () => {
       // Singleton will send us greeting data to let us know it's running.
       // After that, ask it to exit gracefully and confirm that it does.
       if (appProcess && appProcess.stdout) {
-        appProcess.stdout.on('data', data => appProcess!.kill())
+        appProcess.stdout.on('data', () => appProcess!.kill())
       }
       const [code, signal] = await emittedOnce(appProcess, 'close')
 
@@ -403,10 +403,9 @@ describe('app module', () => {
       w = new BrowserWindow({ show: false })
     })
 
-    it('should emit renderer-process-crashed event when renderer crashes', async function() {
+    it('should emit renderer-process-crashed event when renderer crashes', async function () {
       // FIXME: re-enable this test on win32.
-      if (process.platform === 'win32')
-        return this.skip()
+      if (process.platform === 'win32') { return this.skip() }
       w = new BrowserWindow({
         show: false,
         webPreferences: {
@@ -644,7 +643,7 @@ describe('app module', () => {
     it('returns whether the Chrome has accessibility APIs enabled', () => {
       expect(app.accessibilitySupportEnabled).to.be.a('boolean')
 
-      //TODO(codebytere): remove when propertyification is complete
+      // TODO(codebytere): remove when propertyification is complete
       expect(app.isAccessibilitySupportEnabled).to.be.a('function')
       expect(app.setAccessibilitySupportEnabled).to.be.a('function')
     })

+ 4 - 4
spec-main/api-auto-updater-spec.ts

@@ -9,7 +9,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
         expect(error.message).to.equal('Update URL is not set')
         done()
       })
-      autoUpdater.setFeedURL({url:''})
+      autoUpdater.setFeedURL({ url: '' })
       autoUpdater.checkForUpdates()
     })
   })
@@ -21,7 +21,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
 
     ifit(process.platform === 'win32')('correctly fetches the previously set FeedURL', function (done) {
       const updateURL = 'https://fake-update.electron.io'
-      autoUpdater.setFeedURL({url: updateURL})
+      autoUpdater.setFeedURL({ url: updateURL })
       expect(autoUpdater.getFeedURL()).to.equal(updateURL)
       done()
     })
@@ -50,7 +50,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
       })
 
       it('throws if no url is provided when using the new style', () => {
-        expect(() => autoUpdater.setFeedURL({ noUrl: 'lol' } as any),
+        expect(() => autoUpdater.setFeedURL({ noUrl: 'lol' } as any)
         ).to.throw('Expected options object to contain a \'url\' string property in setFeedUrl call')
       })
     })
@@ -61,7 +61,7 @@ ifdescribe(!process.mas)('autoUpdater module', function () {
           expect(error.message).equal('Could not get code signature for running application')
           done()
         })
-        autoUpdater.setFeedURL({url:''})
+        autoUpdater.setFeedURL({ url: '' })
       })
 
       it('does not throw if default is the serverType', () => {

+ 8 - 8
spec-main/api-autoupdater-darwin-spec.ts

@@ -5,7 +5,7 @@ import * as express from 'express'
 import * as fs from 'fs-extra'
 import * as os from 'os'
 import * as path from 'path'
-import { AddressInfo } from 'net';
+import { AddressInfo } from 'net'
 
 const features = process.electronBinding('features')
 
@@ -21,7 +21,7 @@ describeFn('autoUpdater behavior', function () {
 
   beforeEach(function () {
     const result = cp.spawnSync(path.resolve(__dirname, '../script/codesign/get-trusted-identity.sh'))
-    if (result.status !== 0 || result.stdout.toString().trim().length === 0)  {
+    if (result.status !== 0 || result.stdout.toString().trim().length === 0) {
       // Per https://circleci.com/docs/2.0/env-vars:
       // CIRCLE_PR_NUMBER is only present on forked PRs
       if (process.env.CI && !process.env.CIRCLE_PR_NUMBER) {
@@ -99,7 +99,7 @@ describeFn('autoUpdater behavior', function () {
     try {
       await fn(dir)
     } finally {
-      cp.spawnSync('rm', ['-r' , dir])
+      cp.spawnSync('rm', ['-r', dir])
     }
   }
 
@@ -132,10 +132,10 @@ describeFn('autoUpdater behavior', function () {
   })
 
   describe('with update server', () => {
-    let port = 0;
-    let server: express.Application = null as any;
+    let port = 0
+    let server: express.Application = null as any
     let httpServer: http.Server = null as any
-    let requests: express.Request[] = [];
+    let requests: express.Request[] = []
 
     beforeEach((done) => {
       requests = []
@@ -219,7 +219,7 @@ describeFn('autoUpdater behavior', function () {
             (await fs.readFile(appPJPath, 'utf8')).replace('1.0.0', '2.0.0')
           )
           await signApp(secondAppPath)
-          const updateZipPath = path.resolve(dir2, 'update.zip');
+          const updateZipPath = path.resolve(dir2, 'update.zip')
           await spawn('zip', ['-r', '--symlinks', updateZipPath, './'], {
             cwd: dir2
           })
@@ -235,7 +235,7 @@ describeFn('autoUpdater behavior', function () {
               pub_date: (new Date()).toString()
             })
           })
-          const relaunchPromise = new Promise((resolve, reject) => {
+          const relaunchPromise = new Promise((resolve) => {
             server.get('/update-check/updated/:version', (req, res) => {
               res.status(204).send()
               resolve()

+ 2 - 2
spec-main/api-browser-view-spec.ts

@@ -1,10 +1,10 @@
 import * as chai from 'chai'
-import dirtyChai = require('dirty-chai')
 import * as ChildProcess from 'child_process'
 import * as path from 'path'
 import { emittedOnce } from './events-helpers'
 import { BrowserView, BrowserWindow } from 'electron'
-import { closeWindow } from './window-helpers';
+import { closeWindow } from './window-helpers'
+import dirtyChai = require('dirty-chai')
 
 const { expect } = chai
 chai.use(dirtyChai)

+ 1 - 1
spec-main/api-browser-window-affinity-spec.ts

@@ -81,7 +81,7 @@ describe('BrowserWindow with affinity module', () => {
     const affinityWithNodeFalse = 'affinityWithNodeFalse'
 
     function testNodeIntegration (present: boolean) {
-      return new Promise((resolve, reject) => {
+      return new Promise((resolve) => {
         ipcMain.once('answer', (event, typeofProcess, typeofBuffer) => {
           if (present) {
             expect(typeofProcess).to.not.equal('undefined')

+ 93 - 94
spec-main/api-browser-window-spec.ts

@@ -1,6 +1,5 @@
 import * as chai from 'chai'
 import * as chaiAsPromised from 'chai-as-promised'
-import dirtyChai = require('dirty-chai')
 import * as path from 'path'
 import * as fs from 'fs'
 import * as os from 'os'
@@ -12,6 +11,7 @@ import { app, BrowserWindow, BrowserView, ipcMain, OnBeforeSendHeadersListenerDe
 import { emittedOnce } from './events-helpers'
 import { ifit, ifdescribe } from './spec-helpers'
 import { closeWindow } from './window-helpers'
+import dirtyChai = require('dirty-chai')
 
 const { expect } = chai
 
@@ -46,7 +46,7 @@ const expectBoundsEqual = (actual: any, expected: any) => {
 
 const closeAllWindows = async () => {
   for (const w of BrowserWindow.getAllWindows()) {
-    await closeWindow(w, {assertNotWindows: false})
+    await closeWindow(w, { assertNotWindows: false })
   }
 }
 
@@ -68,7 +68,7 @@ describe('BrowserWindow module', () => {
   describe('BrowserWindow.close()', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -138,7 +138,7 @@ describe('BrowserWindow module', () => {
         { name: 'did-fail-load', path: '/net-error' }
       ]
 
-      for (const {name, path} of events) {
+      for (const { name, path } of events) {
         it(`should not crash when closed during ${name}`, async () => {
           const w = new BrowserWindow({ show: false })
           w.webContents.once((name as any), () => {
@@ -155,7 +155,7 @@ describe('BrowserWindow module', () => {
   describe('window.close()', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -179,7 +179,7 @@ describe('BrowserWindow module', () => {
   describe('BrowserWindow.destroy()', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -206,7 +206,7 @@ describe('BrowserWindow module', () => {
           backgroundThrottling: false
         }
       }
-      const windows = Array.from(Array(windowCount)).map(x => new BrowserWindow(windowOptions))
+      const windows = Array.from(Array(windowCount)).map(() => new BrowserWindow(windowOptions))
       windows.forEach(win => win.show())
       windows.forEach(win => win.focus())
       windows.forEach(win => win.destroy())
@@ -229,7 +229,7 @@ describe('BrowserWindow module', () => {
     })
 
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -372,7 +372,7 @@ describe('BrowserWindow module', () => {
       it('sets the content type header on URL encoded forms', async () => {
         await w.loadURL(url)
         const requestDetails: Promise<OnBeforeSendHeadersListenerDetails> = new Promise(resolve => {
-          w.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => {
+          w.webContents.session.webRequest.onBeforeSendHeaders((details) => {
             resolve(details)
           })
         })
@@ -388,7 +388,7 @@ describe('BrowserWindow module', () => {
       it('sets the content type header on multi part forms', async () => {
         await w.loadURL(url)
         const requestDetails: Promise<OnBeforeSendHeadersListenerDetails> = new Promise(resolve => {
-          w.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => {
+          w.webContents.session.webRequest.onBeforeSendHeaders((details) => {
             resolve(details)
           })
         })
@@ -420,7 +420,7 @@ describe('BrowserWindow module', () => {
   describe('navigation events', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -462,7 +462,7 @@ describe('BrowserWindow module', () => {
         server.close()
       })
       it('is emitted on redirects', (done) => {
-        w.webContents.on('will-redirect', (event, url) => {
+        w.webContents.on('will-redirect', () => {
           done()
         })
         w.loadURL(`${url}/302`)
@@ -473,7 +473,7 @@ describe('BrowserWindow module', () => {
         w.webContents.on('will-navigate', () => {
           navigateCalled = true
         })
-        w.webContents.on('will-redirect', (event, url) => {
+        w.webContents.on('will-redirect', () => {
           expect(navigateCalled).to.equal(true, 'should have called will-navigate first')
           done()
         })
@@ -485,7 +485,7 @@ describe('BrowserWindow module', () => {
         w.webContents.on('did-stop-loading', () => {
           stopCalled = true
         })
-        w.webContents.on('will-redirect', (event, url) => {
+        w.webContents.on('will-redirect', () => {
           expect(stopCalled).to.equal(false, 'should not have called did-stop-loading first')
           done()
         })
@@ -493,7 +493,7 @@ describe('BrowserWindow module', () => {
       })
 
       it('allows the window to be closed from the event listener', (done) => {
-        w.webContents.once('will-redirect', (event, input) => {
+        w.webContents.once('will-redirect', () => {
           w.close()
           done()
         })
@@ -525,7 +525,7 @@ describe('BrowserWindow module', () => {
   describe('focus and visibility', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -693,7 +693,7 @@ describe('BrowserWindow module', () => {
   describe('sizing', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, width: 400, height: 400})
+      w = new BrowserWindow({ show: false, width: 400, height: 400 })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -927,7 +927,7 @@ describe('BrowserWindow module', () => {
   ifdescribe(process.platform === 'darwin')('tabbed windows', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -998,7 +998,7 @@ describe('BrowserWindow module', () => {
   describe('autoHideMenuBar property', () => {
     afterEach(closeAllWindows)
     it('exists', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(w).to.have.property('autoHideMenuBar')
 
       // TODO(codebytere): remove when propertyification is complete
@@ -1011,7 +1011,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('returns a Promise with a Buffer', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const image = await w.capturePage({
         x: 0,
         y: 0,
@@ -1023,7 +1023,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('preserves transparency', async () => {
-      const w = new BrowserWindow({show: false, transparent: true})
+      const w = new BrowserWindow({ show: false, transparent: true })
       w.loadURL('about:blank')
       await emittedOnce(w, 'ready-to-show')
       w.show()
@@ -1040,7 +1040,7 @@ describe('BrowserWindow module', () => {
   describe('BrowserWindow.setProgressBar(progress)', () => {
     let w = null as unknown as BrowserWindow
     before(() => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
     after(async () => {
       await closeWindow(w)
@@ -1080,7 +1080,7 @@ describe('BrowserWindow module', () => {
     let w = null as unknown as BrowserWindow
 
     beforeEach(() => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
 
     afterEach(async () => {
@@ -1136,7 +1136,7 @@ describe('BrowserWindow module', () => {
         }
         res.end()
       })
-      server.on('connection', (connection) => { connections++ })
+      server.on('connection', () => { connections++ })
 
       await new Promise(resolve => server.listen(0, '127.0.0.1', () => resolve()))
       url = `http://127.0.0.1:${(server.address() as AddressInfo).port}`
@@ -1149,12 +1149,9 @@ describe('BrowserWindow module', () => {
     })
 
     it('calling preconnect() connects to the server', (done) => {
-      w = new BrowserWindow({show: false})
-      w.webContents.on('did-start-navigation', (event, preconnectUrl, isInPlace, isMainFrame, frameProcessId, frameRoutingId) => {
-        w.webContents.session.preconnect({
-          url: preconnectUrl,
-          numSockets: 4
-        })
+      w = new BrowserWindow({ show: false })
+      w.webContents.on('did-start-navigation', (event, url) => {
+        w.webContents.session.preconnect({ url, numSockets: 4 })
       })
       w.webContents.on('did-finish-load', () => {
         expect(connections).to.equal(4)
@@ -1164,13 +1161,13 @@ describe('BrowserWindow module', () => {
     })
 
     it('does not preconnect unless requested', async () => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
       await w.loadURL(url)
       expect(connections).to.equal(1)
     })
 
     it('parses <link rel=preconnect>', async () => {
-      w = new BrowserWindow({show: true})
+      w = new BrowserWindow({ show: true })
       const p = emittedOnce(w.webContents.session, 'preconnect')
       w.loadURL(url + '/link')
       const [, preconnectUrl, allowCredentials] = await p
@@ -1182,7 +1179,7 @@ describe('BrowserWindow module', () => {
   describe('BrowserWindow.setAutoHideCursor(autoHide)', () => {
     let w = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
     afterEach(async () => {
       await closeWindow(w)
@@ -1209,7 +1206,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('does not throw', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(() => {
         w.setWindowButtonVisibility(true)
         w.setWindowButtonVisibility(false)
@@ -1232,7 +1229,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('allows setting, changing, and removing the vibrancy', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(() => {
         w.setVibrancy('light')
         w.setVibrancy('dark')
@@ -1247,7 +1244,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('supports setting the app details', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const iconPath = path.join(fixtures, 'assets', 'icon.ico')
 
       expect(() => {
@@ -1276,7 +1273,7 @@ describe('BrowserWindow module', () => {
   describe('BrowserWindow.fromId(id)', () => {
     afterEach(closeAllWindows)
     it('returns the window with id', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(BrowserWindow.fromId(w.id).id).to.equal(w.id)
     })
   })
@@ -1285,7 +1282,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('returns the window with the webContents', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const found = BrowserWindow.fromWebContents(w.webContents)
       expect(found!.id).to.equal(w.id)
     })
@@ -1313,7 +1310,7 @@ describe('BrowserWindow module', () => {
 
     it('returns the window with the browserView', () => {
       const w = new BrowserWindow({ show: false })
-      const bv = new BrowserView
+      const bv = new BrowserView()
       w.setBrowserView(bv)
       expect(BrowserWindow.fromBrowserView(bv)!.id).to.equal(w.id)
       // if BrowserView isn't explicitly destroyed, it will crash in GC later
@@ -1321,14 +1318,13 @@ describe('BrowserWindow module', () => {
     })
 
     it('returns undefined if not attached', () => {
-      const bv = new BrowserView
+      const bv = new BrowserView()
       expect(BrowserWindow.fromBrowserView(bv)).to.be.null('BrowserWindow associated with bv')
       // if BrowserView isn't explicitly destroyed, it will crash in GC later
       bv.destroy()
     })
   })
 
-
   describe('BrowserWindow.setOpacity(opacity)', () => {
     afterEach(closeAllWindows)
 
@@ -1398,7 +1394,7 @@ describe('BrowserWindow module', () => {
       const w = new BrowserWindow({
         show: false,
         width: 400,
-        height: 400,
+        height: 400
       })
       const size = w.getSize()
       expect(size).to.deep.equal([400, 400])
@@ -1492,6 +1488,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
     it('can be set on a window', () => {
       expect(() => {
+        /* eslint-disable no-new */
         new BrowserWindow({
           tabbingIdentifier: 'group1'
         })
@@ -1499,6 +1496,7 @@ describe('BrowserWindow module', () => {
           tabbingIdentifier: 'group2',
           frame: false
         })
+        /* eslint-enable no-new */
       }).not.to.throw()
     })
   })
@@ -1723,7 +1721,7 @@ describe('BrowserWindow module', () => {
     })
 
     describe('"sandbox" option', () => {
-      function waitForEvents<T>(emitter: {once: Function}, events: string[], callback: () => void) {
+      function waitForEvents<T> (emitter: {once: Function}, events: string[], callback: () => void) {
         let count = events.length
         for (const event of events) {
           emitter.once(event, () => {
@@ -1967,7 +1965,7 @@ describe('BrowserWindow module', () => {
       describe('event handling', () => {
         let w: BrowserWindow = null as unknown as BrowserWindow
         beforeEach(() => {
-          w = new BrowserWindow({show: false, webPreferences: {sandbox: true}})
+          w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } })
         })
         it('works for window events', (done) => {
           waitForEvents(w, [
@@ -2191,7 +2189,7 @@ describe('BrowserWindow module', () => {
           done()
         })
         w.loadFile(path.join(fixtures, 'api', 'native-window-open-iframe.html'))
-      });
+      })
       ifit(!process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS)('loads native addons correctly after reload', async () => {
         w.loadFile(path.join(__dirname, 'fixtures', 'api', 'native-window-open-native-addon.html'))
         {
@@ -2250,7 +2248,7 @@ describe('BrowserWindow module', () => {
           show: false,
           webPreferences: {
             nodeIntegration: true,
-            nativeWindowOpen: true,
+            nativeWindowOpen: true
           }
         })
         w.loadFile(path.join(fixtures, 'api', 'native-window-open-argv.html'))
@@ -2280,7 +2278,7 @@ describe('BrowserWindow module', () => {
           })))
         })
         afterEach(async () => {
-          await Promise.all(protocols.map(([scheme,]) => {
+          await Promise.all(protocols.map(([scheme]) => {
             return new Promise(resolve => protocol.unregisterProtocol(scheme, () => resolve()))
           }))
         })
@@ -2366,7 +2364,7 @@ describe('BrowserWindow module', () => {
   describe('beforeunload handler', () => {
     let w: BrowserWindow = null as unknown as BrowserWindow
     beforeEach(() => {
-      w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     })
     afterEach(closeAllWindows)
     it('returning undefined would not prevent close', (done) => {
@@ -2594,7 +2592,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('emits when window.open is called', (done) => {
-      const w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
       w.webContents.once('new-window', (e, url, frameName, disposition, options, additionalFeatures) => {
         e.preventDefault()
         expect(url).to.equal('http://host/')
@@ -2618,7 +2616,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('emits when link with target is called', (done) => {
-      const w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+      const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
       w.webContents.once('new-window', (e, url, frameName) => {
         e.preventDefault()
         expect(url).to.equal('http://host/')
@@ -2632,14 +2630,14 @@ describe('BrowserWindow module', () => {
   ifdescribe(process.platform !== 'linux')('max/minimize events', () => {
     afterEach(closeAllWindows)
     it('emits an event when window is maximized', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.once('maximize', () => { done() })
       w.show()
       w.maximize()
     })
 
     it('emits an event when window is unmaximized', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.once('unmaximize', () => { done() })
       w.show()
       w.maximize()
@@ -2647,7 +2645,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('emits an event when window is minimized', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.once('minimize', () => { done() })
       w.show()
       w.minimize()
@@ -2656,10 +2654,10 @@ describe('BrowserWindow module', () => {
 
   describe('beginFrameSubscription method', () => {
     it('does not crash when callback returns nothing', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html'))
       w.webContents.on('dom-ready', () => {
-        w.webContents.beginFrameSubscription(function (data) {
+        w.webContents.beginFrameSubscription(function () {
           // Pending endFrameSubscription to next tick can reliably reproduce
           // a crash which happens when nothing is returned in the callback.
           setTimeout(() => {
@@ -2671,7 +2669,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('subscribes to frame updates', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       let called = false
       w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html'))
       w.webContents.on('dom-ready', () => {
@@ -2690,7 +2688,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('subscribes to frame updates (only dirty rectangle)', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       let called = false
       let gotInitialFullSizeFrame = false
       const [contentWidth, contentHeight] = w.getContentSize()
@@ -2727,7 +2725,7 @@ describe('BrowserWindow module', () => {
     })
 
     it('throws error when subscriber is not well defined', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(() => {
         w.webContents.beginFrameSubscription(true, true as any)
         // TODO(zcbenz): gin is weak at guessing parameter types, we should
@@ -2756,7 +2754,7 @@ describe('BrowserWindow module', () => {
     afterEach(closeAllWindows)
 
     it('should save page to disk', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       await w.loadFile(path.join(fixtures, 'pages', 'save_page', 'index.html'))
       await w.webContents.savePage(savePageHtmlPath, 'HTMLComplete')
 
@@ -2807,7 +2805,7 @@ describe('BrowserWindow module', () => {
     // only applicable to windows: https://github.com/electron/electron/issues/6036
     ifdescribe(process.platform === 'win32')('on windows', () => {
       it('should restore a normal visible window from a fullscreen startup state', async () => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         await w.loadURL('about:blank')
         const shown = emittedOnce(w, 'show')
         // start fullscreen and hidden
@@ -2821,7 +2819,7 @@ describe('BrowserWindow module', () => {
         expect(w.isFullScreen()).to.be.false('fullscreen')
       })
       it('should keep window hidden if already in hidden state', async () => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         await w.loadURL('about:blank')
         const leftFullScreen = emittedOnce(w, 'leave-full-screen')
         w.setFullScreen(false)
@@ -2853,6 +2851,7 @@ describe('BrowserWindow module', () => {
       w.once('sheet-begin', () => {
         done()
       })
+      // eslint-disable-next-line no-new
       new BrowserWindow({
         modal: true,
         parent: w
@@ -2871,18 +2870,18 @@ describe('BrowserWindow module', () => {
 
     describe('parent option', () => {
       it('sets parent window', () => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false, parent: w})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false, parent: w })
         expect(c.getParentWindow()).to.equal(w)
       })
       it('adds window to child windows of parent', () => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false, parent: w})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false, parent: w })
         expect(w.getChildWindows()).to.deep.equal([c])
       })
       it('removes from child windows of parent when window is closed', (done) => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false, parent: w})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false, parent: w })
         c.once('closed', () => {
           // The child window list is not immediately cleared, so wait a tick until it's ready.
           setTimeout(() => {
@@ -2894,8 +2893,8 @@ describe('BrowserWindow module', () => {
       })
 
       it('should not affect the show option', () => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false, parent: w})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false, parent: w })
         expect(c.isVisible()).to.be.false('child is visible')
         expect(c.getParentWindow().isVisible()).to.be.false('parent is visible')
       })
@@ -2903,8 +2902,8 @@ describe('BrowserWindow module', () => {
 
     describe('win.setParentWindow(parent)', () => {
       it('sets parent window', () => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false })
         expect(w.getParentWindow()).to.be.null('w.parent')
         expect(c.getParentWindow()).to.be.null('c.parent')
         c.setParentWindow(w)
@@ -2913,8 +2912,8 @@ describe('BrowserWindow module', () => {
         expect(c.getParentWindow()).to.be.null('c.parent')
       })
       it('adds window to child windows of parent', () => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false })
         expect(w.getChildWindows()).to.deep.equal([])
         c.setParentWindow(w)
         expect(w.getChildWindows()).to.deep.equal([c])
@@ -2922,8 +2921,8 @@ describe('BrowserWindow module', () => {
         expect(w.getChildWindows()).to.deep.equal([])
       })
       it('removes from child windows of parent when window is closed', (done) => {
-        const w = new BrowserWindow({show: false})
-        const c = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
+        const c = new BrowserWindow({ show: false })
         c.once('closed', () => {
           // The child window list is not immediately cleared, so wait a tick until it's ready.
           setTimeout(() => {
@@ -2939,14 +2938,14 @@ describe('BrowserWindow module', () => {
     // The isEnabled API is not reliable on macOS.
     ifdescribe(process.platform !== 'darwin')('modal option', () => {
       it('disables parent window', () => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         const c = new BrowserWindow({ show: false, parent: w, modal: true })
         expect(w.isEnabled()).to.be.true('w.isEnabled')
         c.show()
         expect(w.isEnabled()).to.be.false('w.isEnabled')
       })
       it('re-enables an enabled parent window when closed', (done) => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         const c = new BrowserWindow({ show: false, parent: w, modal: true })
         c.once('closed', () => {
           expect(w.isEnabled()).to.be.true('w.isEnabled')
@@ -2956,7 +2955,7 @@ describe('BrowserWindow module', () => {
         c.close()
       })
       it('does not re-enable a disabled parent window when closed', (done) => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         const c = new BrowserWindow({ show: false, parent: w, modal: true })
         c.once('closed', () => {
           expect(w.isEnabled()).to.be.false('w.isEnabled')
@@ -2967,7 +2966,7 @@ describe('BrowserWindow module', () => {
         c.close()
       })
       it('disables parent window recursively', () => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         const c = new BrowserWindow({ show: false, parent: w, modal: true })
         const c2 = new BrowserWindow({ show: false, parent: w, modal: true })
         c.show()
@@ -3086,7 +3085,7 @@ describe('BrowserWindow module', () => {
       })
 
       it('is true when the main frame is loading', (done) => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         w.webContents.on('did-start-loading', () => {
           expect(w.webContents.isLoadingMainFrame()).to.be.true('isLoadingMainFrame')
           done()
@@ -3094,7 +3093,7 @@ describe('BrowserWindow module', () => {
         w.webContents.loadURL(serverUrl)
       })
       it('is false when only a subframe is loading', (done) => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         w.webContents.once('did-stop-loading', () => {
           expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame')
           w.webContents.on('did-start-loading', () => {
@@ -3110,7 +3109,7 @@ describe('BrowserWindow module', () => {
         w.webContents.loadURL(serverUrl)
       })
       it('is true when navigating to pages from the same origin', (done) => {
-        const w = new BrowserWindow({show: false})
+        const w = new BrowserWindow({ show: false })
         w.webContents.once('did-stop-loading', () => {
           expect(w.webContents.isLoadingMainFrame()).to.be.false('isLoadingMainFrame')
           w.webContents.on('did-start-loading', () => {
@@ -3466,7 +3465,7 @@ describe('BrowserWindow module', () => {
   describe('window.getMediaSourceId()', () => {
     afterEach(closeAllWindows)
     it('returns valid source id', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const shown = emittedOnce(w, 'show')
       w.show()
       await shown
@@ -3480,7 +3479,7 @@ describe('BrowserWindow module', () => {
   ifdescribe(!process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS)('window.getNativeWindowHandle()', () => {
     afterEach(closeAllWindows)
     it('returns valid handle', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       // The module's source code is hosted at
       // https://github.com/electron/node-is-valid-window
       const isValidWindow = require('is-valid-window')
@@ -3502,7 +3501,7 @@ describe('BrowserWindow module', () => {
 
           const showLastPanel = () => {
             // this is executed in the devtools context, where UI is a global
-            const {UI} = (window as any)
+            const { UI } = (window as any)
             const lastPanelId = UI.inspectorView._tabbedPane._tabs.peekLast().id
             UI.inspectorView.showPanel(lastPanelId)
           }
@@ -3556,7 +3555,7 @@ describe('BrowserWindow module', () => {
           let message: any
           let w: BrowserWindow
           before(async () => {
-            w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+            w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
             const p = new Promise(resolve => ipcMain.once('answer', (event, message) => {
               resolve(message)
             }))
@@ -3602,7 +3601,7 @@ describe('BrowserWindow module', () => {
           let message: any
           let w: BrowserWindow
           before(async () => {
-            w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+            w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
             showLastDevToolsPanel(w)
             w.loadURL('about:blank')
             w.webContents.openDevTools({ mode: 'undocked' })
@@ -3686,7 +3685,7 @@ describe('BrowserWindow module', () => {
   ifdescribe(process.platform === 'darwin')('previewFile', () => {
     afterEach(closeAllWindows)
     it('opens the path in Quick Look on macOS', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(() => {
         w.previewFile(__filename)
         w.closeFilePreview()
@@ -3871,7 +3870,7 @@ describe('BrowserWindow module', () => {
 
     describe('window.webContents.isPainting()', () => {
       it('returns whether is currently painting', (done) => {
-        w.webContents.once('paint', function (event, rect, data) {
+        w.webContents.once('paint', function () {
           expect(w.webContents.isPainting()).to.be.true('isPainting')
           done()
         })
@@ -3895,7 +3894,7 @@ describe('BrowserWindow module', () => {
         w.webContents.on('dom-ready', () => {
           w.webContents.stopPainting()
           w.webContents.startPainting()
-          w.webContents.once('paint', function (event, rect, data) {
+          w.webContents.once('paint', function () {
             expect(w.webContents.isPainting()).to.be.true('isPainting')
             done()
           })
@@ -3907,7 +3906,7 @@ describe('BrowserWindow module', () => {
     // TODO(codebytere): remove in Electron v8.0.0
     describe('window.webContents.getFrameRate()', () => {
       it('has default frame rate', (done) => {
-        w.webContents.once('paint', function (event, rect, data) {
+        w.webContents.once('paint', function () {
           expect(w.webContents.getFrameRate()).to.equal(60)
           done()
         })
@@ -3920,7 +3919,7 @@ describe('BrowserWindow module', () => {
       it('sets custom frame rate', (done) => {
         w.webContents.on('dom-ready', () => {
           w.webContents.setFrameRate(30)
-          w.webContents.once('paint', function (event, rect, data) {
+          w.webContents.once('paint', function () {
             expect(w.webContents.getFrameRate()).to.equal(30)
             done()
           })
@@ -3931,7 +3930,7 @@ describe('BrowserWindow module', () => {
 
     describe('window.webContents.FrameRate', () => {
       it('has default frame rate', (done) => {
-        w.webContents.once('paint', function (event, rect, data) {
+        w.webContents.once('paint', function () {
           expect(w.webContents.frameRate).to.equal(60)
           done()
         })
@@ -3941,7 +3940,7 @@ describe('BrowserWindow module', () => {
       it('sets custom frame rate', (done) => {
         w.webContents.on('dom-ready', () => {
           w.webContents.frameRate = 30
-          w.webContents.once('paint', function (event, rect, data) {
+          w.webContents.once('paint', function () {
             expect(w.webContents.frameRate).to.equal(30)
             done()
           })

+ 1 - 1
spec-main/api-callbacks-registry-spec.ts

@@ -1,6 +1,6 @@
 import { expect } from 'chai'
 import { CallbacksRegistry } from '../lib/renderer/remote/callbacks-registry'
-import { ifdescribe } from './spec-helpers';
+import { ifdescribe } from './spec-helpers'
 
 const features = process.electronBinding('features')
 

+ 66 - 64
spec-main/api-context-bridge-spec.ts

@@ -26,7 +26,7 @@ describe('contextBridge', () => {
         preload: path.resolve(fixturesPath, 'can-bind-preload.js')
       }
     })
-    const [,bound] = await emittedOnce(ipcMain, 'context-bridge-bound', () => w.loadFile(path.resolve(fixturesPath, 'empty.html')))
+    const [, bound] = await emittedOnce(ipcMain, 'context-bridge-bound', () => w.loadFile(path.resolve(fixturesPath, 'empty.html')))
     expect(bound).to.equal(false)
   })
 
@@ -38,7 +38,7 @@ describe('contextBridge', () => {
         preload: path.resolve(fixturesPath, 'can-bind-preload.js')
       }
     })
-    const [,bound] = await emittedOnce(ipcMain, 'context-bridge-bound', () => w.loadFile(path.resolve(fixturesPath, 'empty.html')))
+    const [, bound] = await emittedOnce(ipcMain, 'context-bridge-bound', () => w.loadFile(path.resolve(fixturesPath, 'empty.html')))
     expect(bound).to.equal(true)
   })
 
@@ -66,25 +66,24 @@ describe('contextBridge', () => {
         })
         await w.loadFile(path.resolve(fixturesPath, 'empty.html'))
       }
-    
-      const callWithBindings = async (fn: Function) => {
-        return await w.webContents.executeJavaScript(`(${fn.toString()})(window)`)
-      }
-    
+
+      const callWithBindings = (fn: Function) =>
+        w.webContents.executeJavaScript(`(${fn.toString()})(window)`)
+
       const getGCInfo = async (): Promise<{
         functionCount: number
         objectCount: number
         liveFromValues: number
         liveProxyValues: number
       }> => {
-        const [,info] = await emittedOnce(ipcMain, 'gc-info', () => w.webContents.send('get-gc-info'))
+        const [, info] = await emittedOnce(ipcMain, 'gc-info', () => w.webContents.send('get-gc-info'))
         return info
       }
-    
+
       it('should proxy numbers', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myNumber: 123,
+            myNumber: 123
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -92,11 +91,11 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(123)
       })
-    
+
       it('should make properties unwriteable', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myNumber: 123,
+            myNumber: 123
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -105,11 +104,11 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(123)
       })
-    
+
       it('should proxy strings', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myString: 'my-words',
+            myString: 'my-words'
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -117,11 +116,11 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal('my-words')
       })
-    
+
       it('should proxy arrays', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myArr: [123, 'my-words'],
+            myArr: [123, 'my-words']
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -129,11 +128,11 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([123, 'my-words'])
       })
-    
+
       it('should make arrays immutable', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myArr: [123, 'my-words'],
+            myArr: [123, 'my-words']
           })
         })
         const immutable = await callWithBindings((root: any) => {
@@ -146,11 +145,11 @@ describe('contextBridge', () => {
         })
         expect(immutable).to.equal(true)
       })
-    
+
       it('should proxy booleans', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myBool: true,
+            myBool: true
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -158,23 +157,23 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(true)
       })
-    
+
       it('should proxy promises and resolve with the correct value', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myPromise: Promise.resolve('i-resolved'),
+            myPromise: Promise.resolve('i-resolved')
           })
         })
-        const result = await callWithBindings(async (root: any) => {
-          return await root.example.myPromise
+        const result = await callWithBindings((root: any) => {
+          return root.example.myPromise
         })
         expect(result).to.equal('i-resolved')
       })
-    
+
       it('should proxy promises and reject with the correct value', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myPromise: Promise.reject('i-rejected'),
+            myPromise: Promise.reject(new Error('i-rejected'))
           })
         })
         const result = await callWithBindings(async (root: any) => {
@@ -185,33 +184,33 @@ describe('contextBridge', () => {
             return err
           }
         })
-        expect(result).to.equal('i-rejected')
+        expect(result).to.be.an.instanceOf(Error).with.property('message', 'Uncaught Error: i-rejected')
       })
-    
+
       it('should proxy promises and resolve with the correct value if it resolves later', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myPromise: () => new Promise(r => setTimeout(() => r('delayed'), 20)),
+            myPromise: () => new Promise(resolve => setTimeout(() => resolve('delayed'), 20))
           })
         })
-        const result = await callWithBindings(async (root: any) => {
-          return await root.example.myPromise()
+        const result = await callWithBindings((root: any) => {
+          return root.example.myPromise()
         })
         expect(result).to.equal('delayed')
       })
-    
+
       it('should proxy nested promises correctly', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            myPromise: () => new Promise(r => setTimeout(() => r(Promise.resolve(123)), 20)),
+            myPromise: () => new Promise(resolve => setTimeout(() => resolve(Promise.resolve(123)), 20))
           })
         })
-        const result = await callWithBindings(async (root: any) => {
-          return await root.example.myPromise()
+        const result = await callWithBindings((root: any) => {
+          return root.example.myPromise()
         })
         expect(result).to.equal(123)
       })
-    
+
       it('should proxy methods', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
@@ -226,7 +225,7 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([123, 'help', false, 'promise'])
       })
-    
+
       it('should proxy methods that are callable multiple times', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
@@ -238,11 +237,11 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([123, 123, 123])
       })
-    
+
       it('should proxy methods in the reverse direction', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            callWithNumber: (fn: any) => fn(123),
+            callWithNumber: (fn: any) => fn(123)
           })
         })
         const result = await callWithBindings(async (root: any) => {
@@ -250,15 +249,15 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(124)
       })
-    
+
       it('should proxy promises in the reverse direction', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            getPromiseValue: async (p: Promise<any>) => await p,
+            getPromiseValue: (p: Promise<any>) => p
           })
         })
-        const result = await callWithBindings(async (root: any) => {
-          return await root.example.getPromiseValue(Promise.resolve('my-proxied-value'))
+        const result = await callWithBindings((root: any) => {
+          return root.example.getPromiseValue(Promise.resolve('my-proxied-value'))
         })
         expect(result).to.equal('my-proxied-value')
       })
@@ -266,8 +265,8 @@ describe('contextBridge', () => {
       it('should proxy objects with number keys', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            [1]: 123,
-            [2]: 456,
+            1: 123,
+            2: 456,
             '3': 789
           })
         })
@@ -276,7 +275,7 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([123, 456, 789, false])
       })
-    
+
       it('it should proxy null and undefined correctly', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
@@ -299,17 +298,20 @@ describe('contextBridge', () => {
           })
         })
         const result = await callWithBindings((root: any) => {
-          return [root.example.arr.__proto__ === Uint8Array.prototype, root.example.regexp.__proto__ === RegExp.prototype]
+          return [
+            Object.getPrototypeOf(root.example.arr) === Uint8Array.prototype,
+            Object.getPrototypeOf(root.example.regexp) === RegExp.prototype
+          ]
         })
         expect(result).to.deep.equal([true, true])
       })
-    
+
       it('it should handle recursive objects', async () => {
         await makeBindingWindow(() => {
           const o: any = { value: 135 }
           o.o = o
           contextBridge.exposeInMainWorld('example', {
-            o,
+            o
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -317,7 +319,7 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([135, 135, 135])
       })
-    
+
       it('it should follow expected simple rules of object identity', async () => {
         await makeBindingWindow(() => {
           const o: any = { value: 135 }
@@ -325,7 +327,7 @@ describe('contextBridge', () => {
           o.a = sub
           o.b = sub
           contextBridge.exposeInMainWorld('example', {
-            o,
+            o
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -333,7 +335,7 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(true)
       })
-    
+
       it('it should follow expected complex rules of object identity', async () => {
         await makeBindingWindow(() => {
           let first: any = null
@@ -344,7 +346,7 @@ describe('contextBridge', () => {
               } else {
                 return first === arg
               }
-            },
+            }
           })
         })
         const result = await callWithBindings((root: any) => {
@@ -354,7 +356,7 @@ describe('contextBridge', () => {
         })
         expect(result).to.equal(true)
       })
-    
+
       // Can only run tests which use the GCRunner in non-sandboxed environments
       if (!useSandbox) {
         it('should release the global hold on methods sent across contexts', async () => {
@@ -421,7 +423,7 @@ describe('contextBridge', () => {
         it('should release the global hold on objects sent across contexts when the object source is de-reffed', async () => {
           await makeBindingWindow(() => {
             require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', (contextBridge as any).debugGC()))
-            let myObj: any;
+            let myObj: any
             contextBridge.exposeInMainWorld('example', {
               setObj: (o: any) => {
                 myObj = o
@@ -463,7 +465,7 @@ describe('contextBridge', () => {
         it('should not crash when the object source is de-reffed AND the object proxy is de-reffed', async () => {
           await makeBindingWindow(() => {
             require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', (contextBridge as any).debugGC()))
-            let myObj: any;
+            let myObj: any
             contextBridge.exposeInMainWorld('example', {
               setObj: (o: any) => {
                 myObj = o
@@ -503,7 +505,7 @@ describe('contextBridge', () => {
           expect(info.objectCount).to.equal(6)
         })
       }
-    
+
       it('it should not let you overwrite existing exposed things', async () => {
         await makeBindingWindow(() => {
           let threw = false
@@ -525,12 +527,12 @@ describe('contextBridge', () => {
         })
         expect(result).to.deep.equal([1, true])
       })
-    
+
       it('should work with complex nested methods and promises', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
-            first: (second: Function) => second(async (fourth: Function) => {
-              return await fourth()
+            first: (second: Function) => second((fourth: Function) => {
+              return fourth()
             })
           })
         })
@@ -575,7 +577,7 @@ describe('contextBridge', () => {
         })
         expect(threw).to.equal(true)
       })
-    
+
       it('should not leak prototypes', async () => {
         await makeBindingWindow(() => {
           contextBridge.exposeInMainWorld('example', {
@@ -587,14 +589,14 @@ describe('contextBridge', () => {
             getString: () => 'string',
             getBoolean: () => true,
             getArr: () => [123, 'string', true, ['foo']],
-            getPromise: async () => ({ number: 123, string: 'string', boolean: true, fn: () => 'string', arr: [123, 'string', true, ['foo']]}),
+            getPromise: async () => ({ number: 123, string: 'string', boolean: true, fn: () => 'string', arr: [123, 'string', true, ['foo']] }),
             getFunctionFromFunction: async () => () => null,
             object: {
               number: 123,
               string: 'string',
               boolean: true,
               arr: [123, 'string', true, ['foo']],
-              getPromise: async () => ({ number: 123, string: 'string', boolean: true, fn: () => 'string', arr: [123, 'string', true, ['foo']]}),
+              getPromise: async () => ({ number: 123, string: 'string', boolean: true, fn: () => 'string', arr: [123, 'string', true, ['foo']] })
             },
             receiveArguments: (fn: any) => fn({ key: 'value' })
           })
@@ -666,7 +668,7 @@ describe('contextBridge', () => {
             [arg.key, String]
           ]
           return {
-            protoMatches: protoChecks.map(([a, Constructor]) => a.__proto__ === Constructor.prototype)
+            protoMatches: protoChecks.map(([a, Constructor]) => Object.getPrototypeOf(a) === Constructor.prototype)
           }
         })
         // Every protomatch should be true

+ 10 - 11
spec-main/api-crash-reporter-spec.ts

@@ -15,11 +15,10 @@ import { EventEmitter } from 'events'
 temp.track()
 
 const afterTest: ((() => void) | (() => Promise<void>))[] = []
-async function cleanup() {
+async function cleanup () {
   for (const cleanup of afterTest) {
     const r = cleanup()
-    if (r instanceof Promise)
-      await r
+    if (r instanceof Promise) { await r }
   }
   afterTest.length = 0
 }
@@ -131,7 +130,7 @@ ifdescribe(!process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS && process.
           })
 
           const dumpFileCreated = async () => {
-            async function getDumps() {
+            async function getDumps () {
               const files = await fs.promises.readdir(crashesDir)
               return files.filter((file) => /\.dmp$/.test(file) && !existingDumpFiles.has(file))
             }
@@ -351,7 +350,7 @@ ifdescribe(!process.mas && !process.env.DISABLE_CRASH_REPORTER_TESTS && process.
 type CrashInfo = {
   prod: string
   ver: string
-  process_type: string
+  process_type: string // eslint-disable-line camelcase
   platform: string
   extra1: string
   extra2: string
@@ -361,7 +360,7 @@ type CrashInfo = {
   _version: string
 }
 
-async function waitForCrashReport() {
+async function waitForCrashReport () {
   for (let times = 0; times < 10; times++) {
     if (crashReporter.getLastCrashReport() != null) {
       return
@@ -371,14 +370,14 @@ async function waitForCrashReport() {
   throw new Error('No crash report available')
 }
 
-async function checkReport(reportId: string) {
+async function checkReport (reportId: string) {
   await waitForCrashReport()
   expect(crashReporter.getLastCrashReport().id).to.equal(reportId)
   expect(crashReporter.getUploadedReports()).to.be.an('array').that.is.not.empty()
   expect(crashReporter.getUploadedReports()[0].id).to.equal(reportId)
 }
 
-function checkCrash(expectedProcessType: string, fields: CrashInfo) {
+function checkCrash (expectedProcessType: string, fields: CrashInfo) {
   expect(String(fields.prod)).to.equal('Electron')
   expect(String(fields.ver)).to.equal(process.versions.electron)
   expect(String(fields.process_type)).to.equal(expectedProcessType)
@@ -394,9 +393,9 @@ function checkCrash(expectedProcessType: string, fields: CrashInfo) {
 let crashReporterPort = 0
 const startServer = async () => {
   const crashes: CrashInfo[] = []
-  function getCrashes() { return crashes }
-  const emitter = new EventEmitter
-  function waitForCrash(): Promise<CrashInfo> {
+  function getCrashes () { return crashes }
+  const emitter = new EventEmitter()
+  function waitForCrash (): Promise<CrashInfo> {
     return new Promise(resolve => {
       emitter.once('crash', (crash) => {
         resolve(crash)

+ 2 - 2
spec-main/api-debugger-spec.ts

@@ -82,7 +82,7 @@ describe('debugger module', () => {
       w.webContents.once('devtools-opened', () => {
         w.webContents.debugger.detach()
       })
-      w.webContents.debugger.on('detach', (e, reason) => {
+      w.webContents.debugger.on('detach', () => {
         expect(w.webContents.debugger.isAttached()).to.be.false()
         expect((w as any).devToolsWebContents.isDestroyed()).to.be.false()
         done()
@@ -201,7 +201,7 @@ describe('debugger module', () => {
         done(`unexpected error : ${err}`)
       }
 
-      w.webContents.debugger.on('message', (event, method, params) => {
+      w.webContents.debugger.on('message', (event, method) => {
         // loadingFinished indicates that page has been loaded and it did not
         // crash because of invalid UTF-8 data
         if (method === 'Network.loadingFinished') {

+ 3 - 3
spec-main/api-deprecate-spec.ts

@@ -208,7 +208,7 @@ describe('deprecate', () => {
       deprecate.setHandler(null)
       process.throwDeprecation = true
 
-      promiseFunc = param => new Promise((resolve, reject) => resolve(param))
+      promiseFunc = param => new Promise((resolve) => resolve(param))
     })
 
     it('acts as a pass-through for promise-based invocations', async () => {
@@ -233,13 +233,13 @@ describe('deprecate', () => {
           (erringPromiseFunc as any)((err: Error | undefined, data: any) => {
             resolve([err, data])
           }).catch(() => { /* silence deprecation warning */ })
-        });
+        })
         expect(data).to.be.undefined()
         expect(err).to.be.an.instanceOf(Error).with.property('message', 'fail')
       }
       {
         const data = await new Promise(resolve => {
-          (erringPromiseFunc as any)(((data: any) => { resolve(data) }))
+          (erringPromiseFunc as any)((data: any) => { resolve(data) })
             .catch(() => { /* silence deprecation warning */ })
         })
         expect(data).to.be.undefined()

+ 2 - 2
spec-main/api-desktop-capturer-spec.ts

@@ -1,8 +1,8 @@
 import { expect } from 'chai'
 import { desktopCapturer, screen, BrowserWindow, SourcesOptions } from 'electron'
 import { emittedOnce } from './events-helpers'
-import { ifdescribe, ifit } from './spec-helpers';
-import { closeAllWindows } from './window-helpers';
+import { ifdescribe, ifit } from './spec-helpers'
+import { closeAllWindows } from './window-helpers'
 
 const features = process.electronBinding('features')
 

+ 1 - 1
spec-main/api-dialog-spec.ts

@@ -77,7 +77,7 @@ describe('dialog module', () => {
   })
 
   describe('showMessageBox', () => {
-    afterEach(closeAllWindows);
+    afterEach(closeAllWindows)
 
     // parentless message boxes are synchronous on macOS
     // dangling message boxes on windows cause a DCHECK: https://cs.chromium.org/chromium/src/base/win/message_window.cc?l=68&rcl=7faa4bf236a866d007dc5672c9ce42660e67a6a6

+ 1 - 1
spec-main/api-ipc-renderer-spec.ts

@@ -2,7 +2,7 @@ import { expect } from 'chai'
 import * as path from 'path'
 import { ipcMain, BrowserWindow, WebContents, WebPreferences, webContents } from 'electron'
 import { emittedOnce } from './events-helpers'
-import { closeWindow } from './window-helpers';
+import { closeWindow } from './window-helpers'
 
 describe('ipcRenderer module', () => {
   const fixtures = path.join(__dirname, '..', 'spec', 'fixtures')

+ 37 - 37
spec-main/api-ipc-spec.ts

@@ -8,7 +8,7 @@ chai.use(chaiAsPromised)
 
 describe('ipc module', () => {
   describe('invoke', () => {
-    let w = (null as unknown as BrowserWindow);
+    let w = (null as unknown as BrowserWindow)
 
     before(async () => {
       w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
@@ -18,13 +18,13 @@ describe('ipc module', () => {
       w.destroy()
     })
 
-    async function rendererInvoke(...args: any[]) {
-      const {ipcRenderer} = require('electron')
+    async function rendererInvoke (...args: any[]) {
+      const { ipcRenderer } = require('electron')
       try {
         const result = await ipcRenderer.invoke('test', ...args)
-        ipcRenderer.send('result', {result})
+        ipcRenderer.send('result', { result })
       } catch (e) {
-        ipcRenderer.send('result', {error: e.message})
+        ipcRenderer.send('result', { error: e.message })
       }
     }
 
@@ -34,7 +34,7 @@ describe('ipc module', () => {
         return 3
       })
       const done = new Promise(resolve => ipcMain.once('result', (e, arg) => {
-        expect(arg).to.deep.equal({result: 3})
+        expect(arg).to.deep.equal({ result: 3 })
         resolve()
       }))
       await w.webContents.executeJavaScript(`(${rendererInvoke})(123)`)
@@ -48,7 +48,7 @@ describe('ipc module', () => {
         return 3
       })
       const done = new Promise(resolve => ipcMain.once('result', (e, arg) => {
-        expect(arg).to.deep.equal({result: 3})
+        expect(arg).to.deep.equal({ result: 3 })
         resolve()
       }))
       await w.webContents.executeJavaScript(`(${rendererInvoke})(123)`)
@@ -111,7 +111,7 @@ describe('ipc module', () => {
   })
 
   describe('ordering', () => {
-    let w = (null as unknown as BrowserWindow);
+    let w = (null as unknown as BrowserWindow)
 
     before(async () => {
       w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
@@ -126,21 +126,21 @@ describe('ipc module', () => {
       ipcMain.on('test-async', (e, i) => { received.push(i) })
       ipcMain.on('test-sync', (e, i) => { received.push(i); e.returnValue = null })
       const done = new Promise(resolve => ipcMain.once('done', () => { resolve() }))
-      try {
-        function rendererStressTest() {
-          const {ipcRenderer} = require('electron')
-          for (let i = 0; i < 1000; i++) {
-            switch ((Math.random() * 2) | 0) {
-              case 0:
-                ipcRenderer.send('test-async', i)
-                break;
-              case 1:
-                ipcRenderer.sendSync('test-sync', i)
-                break;
-            }
+      function rendererStressTest () {
+        const { ipcRenderer } = require('electron')
+        for (let i = 0; i < 1000; i++) {
+          switch ((Math.random() * 2) | 0) {
+            case 0:
+              ipcRenderer.send('test-async', i)
+              break
+            case 1:
+              ipcRenderer.sendSync('test-sync', i)
+              break
           }
-          ipcRenderer.send('done')
         }
+        ipcRenderer.send('done')
+      }
+      try {
         w.webContents.executeJavaScript(`(${rendererStressTest})()`)
         await done
       } finally {
@@ -157,24 +157,24 @@ describe('ipc module', () => {
       ipcMain.on('test-async', (e, i) => { received.push(i) })
       ipcMain.on('test-sync', (e, i) => { received.push(i); e.returnValue = null })
       const done = new Promise(resolve => ipcMain.once('done', () => { resolve() }))
-      try {
-        function rendererStressTest() {
-          const {ipcRenderer} = require('electron')
-          for (let i = 0; i < 1000; i++) {
-            switch ((Math.random() * 3) | 0) {
-              case 0:
-                ipcRenderer.send('test-async', i)
-                break;
-              case 1:
-                ipcRenderer.sendSync('test-sync', i)
-                break;
-              case 2:
-                ipcRenderer.invoke('test-invoke', i)
-                break;
-            }
+      function rendererStressTest () {
+        const { ipcRenderer } = require('electron')
+        for (let i = 0; i < 1000; i++) {
+          switch ((Math.random() * 3) | 0) {
+            case 0:
+              ipcRenderer.send('test-async', i)
+              break
+            case 1:
+              ipcRenderer.sendSync('test-sync', i)
+              break
+            case 2:
+              ipcRenderer.invoke('test-invoke', i)
+              break
           }
-          ipcRenderer.send('done')
         }
+        ipcRenderer.send('done')
+      }
+      try {
         w.webContents.executeJavaScript(`(${rendererStressTest})()`)
         await done
       } finally {

+ 4 - 5
spec-main/api-menu-item-spec.ts

@@ -1,8 +1,7 @@
 import { BrowserWindow, app, Menu, MenuItem, MenuItemConstructorOptions } from 'electron'
-const { roleList, execute } = require('../lib/browser/api/menu-item-roles')
 import { expect } from 'chai'
-import { closeAllWindows } from './window-helpers';
-
+import { closeAllWindows } from './window-helpers'
+const { roleList, execute } = require('../lib/browser/api/menu-item-roles')
 
 describe('MenuItems', () => {
   describe('MenuItem instance properties', () => {
@@ -48,7 +47,7 @@ describe('MenuItems', () => {
           expect(item.label).to.equal('text')
           done()
         }
-      }]);
+      }])
       menu.delegate.executeCommand(menu, {}, menu.items[0].commandId)
     })
   })
@@ -142,7 +141,7 @@ describe('MenuItems', () => {
           const groupId = (menu.items[g.begin!] as any).groupId
 
           // groupId should be previously unused
-          //expect(usedGroupIds.has(groupId)).to.be.false('group id present')
+          // expect(usedGroupIds.has(groupId)).to.be.false('group id present')
           expect(usedGroupIds).not.to.contain(groupId)
           usedGroupIds.add(groupId)
 

+ 1 - 1
spec-main/api-native-theme-spec.ts

@@ -4,7 +4,7 @@ import * as os from 'os'
 import * as semver from 'semver'
 
 import { delay, ifdescribe } from './spec-helpers'
-import { emittedOnce } from './events-helpers';
+import { emittedOnce } from './events-helpers'
 
 describe('nativeTheme module', () => {
   describe('nativeTheme.shouldUseDarkColors', () => {

+ 8 - 8
spec-main/api-net-log-spec.ts

@@ -5,7 +5,7 @@ import * as os from 'os'
 import * as path from 'path'
 import * as ChildProcess from 'child_process'
 import { session, net } from 'electron'
-import { Socket, AddressInfo } from 'net';
+import { Socket, AddressInfo } from 'net'
 import { ifit } from './spec-helpers'
 import { emittedOnce } from './events-helpers'
 
@@ -84,18 +84,18 @@ describe('netLog module', () => {
     expect(() => testNetLog().startLogging('')).to.throw()
     expect(() => testNetLog().startLogging(null as any)).to.throw()
     expect(() => testNetLog().startLogging([] as any)).to.throw()
-    expect(() => testNetLog().startLogging('aoeu', {captureMode: 'aoeu' as any})).to.throw()
-    expect(() => testNetLog().startLogging('aoeu', {maxFileSize: null as any})).to.throw()
+    expect(() => testNetLog().startLogging('aoeu', { captureMode: 'aoeu' as any })).to.throw()
+    expect(() => testNetLog().startLogging('aoeu', { maxFileSize: null as any })).to.throw()
   })
 
   it('should include cookies when requested', async () => {
-    await testNetLog().startLogging(dumpFileDynamic, {captureMode: "includeSensitive"})
+    await testNetLog().startLogging(dumpFileDynamic, { captureMode: 'includeSensitive' })
     const unique = require('uuid').v4()
     await new Promise((resolve) => {
       const req = net.request(serverUrl)
       req.setHeader('Cookie', `foo=${unique}`)
       req.on('response', (response) => {
-        response.on('data', () => {})  // https://github.com/electron/electron/issues/19214
+        response.on('data', () => {}) // https://github.com/electron/electron/issues/19214
         response.on('end', () => resolve())
       })
       req.end()
@@ -107,12 +107,12 @@ describe('netLog module', () => {
   })
 
   it('should include socket bytes when requested', async () => {
-    await testNetLog().startLogging(dumpFileDynamic, {captureMode: "everything"})
+    await testNetLog().startLogging(dumpFileDynamic, { captureMode: 'everything' })
     const unique = require('uuid').v4()
     await new Promise((resolve) => {
-      const req = net.request({method: 'POST', url: serverUrl})
+      const req = net.request({ method: 'POST', url: serverUrl })
       req.on('response', (response) => {
-        response.on('data', () => {})  // https://github.com/electron/electron/issues/19214
+        response.on('data', () => {}) // https://github.com/electron/electron/issues/19214
         response.on('end', () => resolve())
       })
       req.end(Buffer.from(unique))

+ 25 - 29
spec-main/api-net-spec.ts

@@ -34,13 +34,12 @@ function randomString (length: number) {
   return buffer.toString()
 }
 
-function respondOnce(fn: http.RequestListener): Promise<string> {
+function respondOnce (fn: http.RequestListener): Promise<string> {
   return new Promise((resolve) => {
     const server = http.createServer((request, response) => {
       fn(request, response)
       // don't close if a redirect was returned
-      if (response.statusCode < 300 || response.statusCode >= 399)
-        server.close()
+      if (response.statusCode < 300 || response.statusCode >= 399) { server.close() }
     })
     server.listen(0, '127.0.0.1', () => {
       resolve(`http://127.0.0.1:${(server.address() as AddressInfo).port}`)
@@ -61,7 +60,7 @@ respondOnce.toRoutes = (routes: Record<string, http.RequestListener>) => {
 }
 
 respondOnce.toURL = (url: string, fn: http.RequestListener) => {
-  return respondOnce.toRoutes({[url]: fn})
+  return respondOnce.toRoutes({ [url]: fn })
 }
 
 respondOnce.toSingleURL = (fn: http.RequestListener) => {
@@ -459,7 +458,7 @@ describe('net module', () => {
         let requestAbortEventEmitted = false
 
         const urlRequest = net.request(serverUrl)
-        urlRequest.on('response', (response) => {
+        urlRequest.on('response', () => {
           expect.fail('Unexpected response event')
         })
         urlRequest.on('finish', () => {
@@ -484,14 +483,14 @@ describe('net module', () => {
     it('it should be able to abort an HTTP request before request end', (done) => {
       let requestReceivedByServer = false
       let urlRequest: ClientRequest | null = null
-      respondOnce.toSingleURL((request, response) => {
+      respondOnce.toSingleURL(() => {
         requestReceivedByServer = true
         urlRequest!.abort()
       }).then(serverUrl => {
         let requestAbortEventEmitted = false
 
         urlRequest = net.request(serverUrl)
-        urlRequest.on('response', (response) => {
+        urlRequest.on('response', () => {
           expect.fail('Unexpected response event')
         })
         urlRequest.on('finish', () => {
@@ -530,7 +529,7 @@ describe('net module', () => {
         let requestFinishEventEmitted = false
 
         urlRequest = net.request(serverUrl)
-        urlRequest.on('response', (response) => {
+        urlRequest.on('response', () => {
           expect.fail('Unexpected response event')
         })
         urlRequest.on('finish', () => {
@@ -571,8 +570,7 @@ describe('net module', () => {
           requestResponseEventEmitted = true
           const statusCode = response.statusCode
           expect(statusCode).to.equal(200)
-          response.on('data', (chunk) => {
-          })
+          response.on('data', () => {})
           response.on('end', () => {
             expect.fail('Unexpected end event')
           })
@@ -608,7 +606,7 @@ describe('net module', () => {
     it('abort event should be emitted at most once', (done) => {
       let requestReceivedByServer = false
       let urlRequest: ClientRequest | null = null
-      respondOnce.toSingleURL((request, response) => {
+      respondOnce.toSingleURL(() => {
         requestReceivedByServer = true
         urlRequest!.abort()
         urlRequest!.abort()
@@ -721,7 +719,7 @@ describe('net module', () => {
           requestIsRedirected = true
           response.end()
         }).then(serverUrl => {
-          session.defaultSession.webRequest.onBeforeRequest((details, callback) => {
+          session.defaultSession.webRequest.onBeforeRequest(() => {
             expect.fail('Request should not be intercepted by the default session')
           })
 
@@ -748,8 +746,7 @@ describe('net module', () => {
           })
           urlRequest.on('response', (response) => {
             expect(response.statusCode).to.equal(200)
-            response.on('data', (chunk) => {
-            })
+            response.on('data', () => {})
             response.on('end', () => {
               expect(requestIsRedirected).to.be.true('The server should receive a request to the forward URL')
               expect(requestIsIntercepted).to.be.true('The request should be intercepted by the webRequest module')
@@ -769,7 +766,7 @@ describe('net module', () => {
           requestIsRedirected = true
           response.end()
         }).then(serverUrl => {
-          session.defaultSession.webRequest.onBeforeRequest((details, callback) => {
+          session.defaultSession.webRequest.onBeforeRequest(() => {
             expect.fail('Request should not be intercepted by the default session')
           })
 
@@ -796,8 +793,7 @@ describe('net module', () => {
           })
           urlRequest.on('response', (response) => {
             expect(response.statusCode).to.equal(200)
-            response.on('data', (chunk) => {
-            })
+            response.on('data', () => {})
             response.on('end', () => {
               expect(requestIsRedirected).to.be.true('The server should receive a request to the forward URL')
               expect(requestIsIntercepted).to.be.true('The request should be intercepted by the webRequest module')
@@ -849,7 +845,7 @@ describe('net module', () => {
         '/200': (request, response) => {
           response.statusCode = 200
           response.end()
-        },
+        }
       }).then(serverUrl => {
         const urlRequest = net.request({
           url: `${serverUrl}${requestUrl}`
@@ -877,7 +873,7 @@ describe('net module', () => {
         '/200': (request, response) => {
           response.statusCode = 200
           response.end()
-        },
+        }
       }).then(serverUrl => {
         const urlRequest = net.request({
           url: `${serverUrl}/redirectChain`
@@ -925,7 +921,7 @@ describe('net module', () => {
         '/200': (request, response) => {
           response.statusCode = 200
           response.end()
-        },
+        }
       }).then(serverUrl => {
         const urlRequest = net.request({
           url: `${serverUrl}/redirectChain`,
@@ -957,7 +953,7 @@ describe('net module', () => {
         '/200': (request, response) => {
           response.statusCode = 200
           response.end()
-        },
+        }
       }).then(serverUrl => {
         const urlRequest = net.request({
           url: `${serverUrl}/redirect`,
@@ -991,7 +987,7 @@ describe('net module', () => {
           url: 'https://foo',
           session: 1 as any
         })
-      }).to.throw("`session` should be an instance of the Session class")
+      }).to.throw('`session` should be an instance of the Session class')
     })
 
     it('should throw if given an invalid partition option', () => {
@@ -1000,7 +996,7 @@ describe('net module', () => {
           url: 'https://foo',
           partition: 1 as any
         })
-      }).to.throw("`partition` should be a string")
+      }).to.throw('`partition` should be a string')
     })
 
     it('should be able to create a request with options', (done) => {
@@ -1059,7 +1055,7 @@ describe('net module', () => {
           const netRequest = net.request(netServerUrl)
           netRequest.on('response', (netResponse) => {
             expect(netResponse.statusCode).to.equal(200)
-            netResponse.on('data', (chunk) => {})
+            netResponse.on('data', () => {})
             netResponse.on('end', () => {
               expect(netRequestReceived).to.be.true('net request received')
               expect(netRequestEnded).to.be.true('net request ended')
@@ -1073,7 +1069,7 @@ describe('net module', () => {
     })
 
     it('should emit error event on server socket close', (done) => {
-      respondOnce.toSingleURL((request, response) => {
+      respondOnce.toSingleURL((request) => {
         request.socket.destroy()
       }).then(serverUrl => {
         let requestErrorEventEmitted = false
@@ -1122,7 +1118,7 @@ describe('net module', () => {
           const httpVersionMinor = response.httpVersionMinor
           expect(httpVersionMinor).to.be.a('number').and.to.be.at.least(0)
 
-          response.on('data', chunk => {})
+          response.on('data', () => {})
           response.on('end', () => { done() })
         })
         urlRequest.end()
@@ -1156,7 +1152,7 @@ describe('net module', () => {
           expect(headers).to.not.have.property(discardableHeader)
           expect(headers[includedHeader]).to.equal(includedHeaderValue)
 
-          response.on('data', chunk => {})
+          response.on('data', () => {})
           response.on('end', () => { done() })
         })
         urlRequest.end()
@@ -1181,7 +1177,7 @@ describe('net module', () => {
           expect(headers).to.have.property('referrer-policy')
           expect(headers['referrer-policy']).to.equal('first-text, second-text')
 
-          response.on('data', chunk => {})
+          response.on('data', () => {})
           response.on('end', () => { done() })
         })
         urlRequest.end()
@@ -1215,7 +1211,7 @@ describe('net module', () => {
             port: serverUrl.port
           }
           const nodeRequest = http.request(nodeOptions, res => {
-            res.on('data', (chunk) => {})
+            res.on('data', () => {})
             res.on('end', () => {
               done()
             })

+ 1 - 1
spec-main/api-notification-dbus-spec.ts

@@ -10,7 +10,7 @@ import { expect } from 'chai'
 import * as dbus from 'dbus-native'
 import { app } from 'electron'
 import { ifdescribe } from './spec-helpers'
-import { promisify } from 'util';
+import { promisify } from 'util'
 
 const skip = process.platform !== 'linux' ||
              process.arch === 'ia32' ||

+ 1 - 0
spec-main/api-power-monitor-spec.ts

@@ -117,6 +117,7 @@ describe('powerMonitor', () => {
   })
 
   describe('when powerMonitor module is loaded', () => {
+    // eslint-disable-next-line no-undef
     let powerMonitor: typeof Electron.powerMonitor
     before(() => {
       powerMonitor = require('electron').powerMonitor

+ 10 - 10
spec-main/api-protocol-spec.ts

@@ -41,8 +41,8 @@ function getStream (chunkSize = text.length, data: Buffer | string = text) {
   const body = new stream.PassThrough()
 
   async function sendChunks () {
-    await delay(0)  // the stream protocol API breaks if you send data immediately.
-    let buf = Buffer.from(data as any)  // nodejs typings are wrong, Buffer.from can take a Buffer
+    await delay(0) // the stream protocol API breaks if you send data immediately.
+    let buf = Buffer.from(data as any) // nodejs typings are wrong, Buffer.from can take a Buffer
     for (;;) {
       body.push(buf.slice(0, chunkSize))
       buf = buf.slice(chunkSize)
@@ -60,7 +60,7 @@ function getStream (chunkSize = text.length, data: Buffer | string = text) {
 }
 
 // A promise that can be resolved externally.
-function defer(): Promise<any> & {resolve: Function, reject: Function} {
+function defer (): Promise<any> & {resolve: Function, reject: Function} {
   let promiseResolve: Function = null as unknown as Function
   let promiseReject: Function = null as unknown as Function
   const promise: any = new Promise((resolve, reject) => {
@@ -75,7 +75,7 @@ function defer(): Promise<any> & {resolve: Function, reject: Function} {
 describe('protocol module', () => {
   let contents: WebContents = null as unknown as WebContents
   // NB. sandbox: true is used because it makes navigations much (~8x) faster.
-  before(() => contents = (webContents as any).create({sandbox: true}))
+  before(() => { contents = (webContents as any).create({ sandbox: true }) })
   after(() => (contents as any).destroy())
 
   async function ajax (url: string, options = {}) {
@@ -706,7 +706,7 @@ describe('protocol module', () => {
     const standardScheme = (global as any).standardScheme
     let w: BrowserWindow = null as unknown as BrowserWindow
     beforeEach(async () => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
 
     afterEach(async () => {
@@ -728,10 +728,10 @@ describe('protocol module', () => {
 
     it('allows CORS requests by default', async () => {
       await allowsCORSRequests('cors', 200, new RegExp(''), () => {
-        const {ipcRenderer} = require('electron')
+        const { ipcRenderer } = require('electron')
         fetch('cors://myhost').then(function (response) {
           ipcRenderer.send('response', response.status)
-        }).catch(function (response) {
+        }).catch(function () {
           ipcRenderer.send('response', 'failed')
         })
       })
@@ -739,7 +739,7 @@ describe('protocol module', () => {
 
     it('disallows CORS and fetch requests when only supportFetchAPI is specified', async () => {
       await allowsCORSRequests('no-cors', ['failed xhr', 'failed fetch'], /has been blocked by CORS policy/, () => {
-        const {ipcRenderer} = require('electron')
+        const { ipcRenderer } = require('electron')
         Promise.all([
           new Promise(resolve => {
             const req = new XMLHttpRequest()
@@ -759,7 +759,7 @@ describe('protocol module', () => {
 
     it('allows CORS, but disallows fetch requests, when specified', async () => {
       await allowsCORSRequests('no-fetch', ['loaded xhr', 'failed fetch'], /Fetch API cannot load/, () => {
-        const {ipcRenderer} = require('electron')
+        const { ipcRenderer } = require('electron')
         Promise.all([
           new Promise(resolve => {
             const req = new XMLHttpRequest()
@@ -787,7 +787,7 @@ describe('protocol module', () => {
 
       const newContents: WebContents = (webContents as any).create({ nodeIntegration: true })
       const consoleMessages: string[] = []
-      newContents.on('console-message', (e, level, message, line, sourceId) => consoleMessages.push(message))
+      newContents.on('console-message', (e, level, message) => consoleMessages.push(message))
       try {
         newContents.loadURL(standardScheme + '://fake-host')
         const [, response] = await emittedOnce(ipcMain, 'response')

+ 8 - 8
spec-main/api-remote-spec.ts

@@ -1,10 +1,10 @@
 import * as path from 'path'
 import { expect } from 'chai'
 import { closeWindow, closeAllWindows } from './window-helpers'
-import { ifdescribe } from './spec-helpers';
+import { ifdescribe } from './spec-helpers'
 
 import { ipcMain, BrowserWindow } from 'electron'
-import { emittedOnce } from './events-helpers';
+import { emittedOnce } from './events-helpers'
 
 const features = process.electronBinding('features')
 
@@ -21,7 +21,7 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
       await closeWindow(w)
     })
 
-    async function remotely(script: string) {
+    async function remotely (script: string) {
       // executeJavaScript never returns if the script throws an error, so catch
       // any errors manually.
       const assembledScript = `(function() {
@@ -47,7 +47,7 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
       })
 
       it('throws when no returnValue set', async () => {
-        w.webContents.once('remote-get-global', (event, name) => {
+        w.webContents.once('remote-get-global', (event) => {
           event.preventDefault()
         })
         await expect(remotely(`require('electron').remote.getGlobal('test')`)).to.eventually.be.rejected(`Blocked remote.getGlobal('test')`)
@@ -63,7 +63,7 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
       })
 
       it('throws when no returnValue set', async () => {
-        w.webContents.once('remote-get-builtin', (event, name) => {
+        w.webContents.once('remote-get-builtin', (event) => {
           event.preventDefault()
         })
         await expect(remotely(`require('electron').remote.getBuiltin('test')`)).to.eventually.be.rejected(`Blocked remote.getGlobal('test')`)
@@ -79,7 +79,7 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
       })
 
       it('throws when no returnValue set', async () => {
-        w.webContents.once('remote-require', (event, name) => {
+        w.webContents.once('remote-require', (event) => {
           event.preventDefault()
         })
         await expect(remotely(`require('electron').remote.require('test')`)).to.eventually.be.rejected(`Blocked remote.require('test')`)
@@ -180,9 +180,9 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
 
       expect(w.webContents.listenerCount('remote-handler')).to.equal(2)
       let warnMessage: string | null = null
-      let originalWarn = console.warn
+      const originalWarn = console.warn
       try {
-        console.warn = (message: string) => warnMessage = message
+        console.warn = (message: string) => { warnMessage = message }
         w.webContents.emit('remote-handler', { sender: w.webContents })
       } finally {
         console.warn = originalWarn

+ 25 - 25
spec-main/api-session-spec.ts

@@ -9,7 +9,7 @@ import * as send from 'send'
 import * as auth from 'basic-auth'
 import { closeAllWindows } from './window-helpers'
 import { emittedOnce } from './events-helpers'
-import { AddressInfo } from 'net';
+import { AddressInfo } from 'net'
 
 /* The whole session API doesn't use standard callbacks */
 /* eslint-disable standard/no-callback-literal */
@@ -78,7 +78,7 @@ describe('session module', () => {
       const name = '1'
       const value = '1'
 
-      await cookies.set({ url, name, value, expirationDate: (+new Date) / 1000 + 120 })
+      await cookies.set({ url, name, value, expirationDate: (+new Date()) / 1000 + 120 })
       const cs = await cookies.get({ url })
       expect(cs.some(c => c.name === name && c.value === value)).to.equal(true)
     })
@@ -88,7 +88,7 @@ describe('session module', () => {
       const name = '1'
       const value = '1'
 
-      await cookies.set({ url, name, value, expirationDate: (+new Date) / 1000 + 120 })
+      await cookies.set({ url, name, value, expirationDate: (+new Date()) / 1000 + 120 })
       const cs = await cookies.get({ domain: '127.0.0.1' })
       expect(cs.some(c => c.name === name && c.value === value)).to.equal(true)
     })
@@ -191,7 +191,7 @@ describe('session module', () => {
       const appPath = path.join(fixtures, 'api', 'cookie-app')
 
       const runAppWithPhase = (phase: string) => {
-        return new Promise((resolve, reject) => {
+        return new Promise((resolve) => {
           let output = ''
 
           const appProcess = ChildProcess.spawn(
@@ -253,11 +253,11 @@ describe('session module', () => {
       const downloadPrevented: Promise<{itemUrl: string, itemFilename: string, item: Electron.DownloadItem}> = new Promise(resolve => {
         w.webContents.session.once('will-download', function (e, item) {
           e.preventDefault()
-          resolve({itemUrl: item.getURL(), itemFilename: item.getFilename(), item})
+          resolve({ itemUrl: item.getURL(), itemFilename: item.getFilename(), item })
         })
       })
       w.loadURL(url)
-      const {item, itemUrl, itemFilename} = await downloadPrevented
+      const { item, itemUrl, itemFilename } = await downloadPrevented
       expect(itemUrl).to.equal(url)
       expect(itemFilename).to.equal('mockFile.txt')
       expect(() => item.getURL()).to.throw('Object has been destroyed')
@@ -297,7 +297,7 @@ describe('session module', () => {
         show: false,
         webPreferences: {
           partition: partitionName,
-          nodeIntegration: true,
+          nodeIntegration: true
         }
       })
       customSession = session.fromPartition(partitionName)
@@ -448,7 +448,7 @@ describe('session module', () => {
     afterEach(closeAllWindows)
 
     it('accepts the request when the callback is called with 0', async () => {
-      session.defaultSession.setCertificateVerifyProc(({ hostname, certificate, verificationResult, errorCode }, callback) => {
+      session.defaultSession.setCertificateVerifyProc(({ verificationResult, errorCode }, callback) => {
         expect(['net::ERR_CERT_AUTHORITY_INVALID', 'net::ERR_CERT_COMMON_NAME_INVALID'].includes(verificationResult)).to.be.true()
         expect([-202, -200].includes(errorCode)).to.be.true()
         callback(0)
@@ -483,7 +483,7 @@ describe('session module', () => {
 
     it('saves cached results', async () => {
       let numVerificationRequests = 0
-      session.defaultSession.setCertificateVerifyProc(({ hostname, certificate, verificationResult }, callback) => {
+      session.defaultSession.setCertificateVerifyProc((e, callback) => {
         numVerificationRequests++
         callback(-2)
       })
@@ -524,7 +524,7 @@ describe('session module', () => {
             resolve(data)
           })
           response.on('error', (error: any) => { reject(new Error(error)) })
-        });
+        })
         request.end()
       })
       // the first time should throw due to unauthenticated
@@ -633,7 +633,7 @@ describe('session module', () => {
       const port = address.port
       const w = new BrowserWindow({ show: false, webPreferences: { webviewTag: true } })
       await w.loadURL('about:blank')
-      function webviewDownload({fixtures, url, port}: {fixtures: string, url: string, port: string}) {
+      function webviewDownload ({ fixtures, url, port }: {fixtures: string, url: string, port: string}) {
         const webview = new (window as any).WebView()
         webview.addEventListener('did-finish-load', () => {
           webview.downloadURL(`${url}:${port}/`)
@@ -649,7 +649,7 @@ describe('session module', () => {
           })
         })
       })
-      await w.webContents.executeJavaScript(`(${webviewDownload})(${JSON.stringify({fixtures, url, port})})`)
+      await w.webContents.executeJavaScript(`(${webviewDownload})(${JSON.stringify({ fixtures, url, port })})`)
       const [state, item] = await done
       assertDownload(state, item)
     })
@@ -684,7 +684,7 @@ describe('session module', () => {
       const w = new BrowserWindow({ show: false })
       w.webContents.session.once('will-download', function (e, item) {
         item.savePath = downloadFilePath
-        item.on('done', function (e, state) {
+        item.on('done', function () {
           expect(item.getFilename()).to.equal('download.pdf')
           done()
         })
@@ -716,7 +716,7 @@ describe('session module', () => {
       w.webContents.session.once('will-download', function (e, item) {
         item.setSavePath(filePath)
         item.setSaveDialogOptions(options)
-        item.on('done', function (e, state) {
+        item.on('done', function () {
           expect(item.getSaveDialogOptions()).to.deep.equal(options)
           done()
         })
@@ -781,7 +781,7 @@ describe('session module', () => {
         const downloadCancelled: Promise<Electron.DownloadItem> = new Promise((resolve) => {
           w.webContents.session.once('will-download', function (e, item) {
             item.setSavePath(downloadFilePath)
-            item.on('done', function (e, state) {
+            item.on('done', function () {
               resolve(item)
             })
             item.cancel()
@@ -799,14 +799,14 @@ describe('session module', () => {
           offset: item.getReceivedBytes(),
           length: item.getTotalBytes(),
           lastModified: item.getLastModifiedTime(),
-          eTag: item.getETag(),
+          eTag: item.getETag()
         }
         const downloadResumed: Promise<Electron.DownloadItem> = new Promise((resolve) => {
           w.webContents.session.once('will-download', function (e, item) {
             expect(item.getState()).to.equal('interrupted')
             item.setSavePath(downloadFilePath)
             item.resume()
-            item.on('done', function (e, state) {
+            item.on('done', function () {
               resolve(item)
             })
           })
@@ -834,7 +834,7 @@ describe('session module', () => {
         show: false,
         webPreferences: {
           partition: `very-temp-permision-handler`,
-          nodeIntegration: true,
+          nodeIntegration: true
         }
       })
 
@@ -849,15 +849,15 @@ describe('session module', () => {
 
       const result = emittedOnce(require('electron').ipcMain, 'message')
 
-      function remote() {
-        (navigator as any).requestMIDIAccess({sysex: true}).then(() => {}, (err: any) => {
-          require('electron').ipcRenderer.send('message', err.name);
-        });
+      function remote () {
+        (navigator as any).requestMIDIAccess({ sysex: true }).then(() => {}, (err: any) => {
+          require('electron').ipcRenderer.send('message', err.name)
+        })
       }
 
       await w.loadURL('https://myfakesite')
 
-      const [,name] = await result
+      const [, name] = await result
       expect(name).to.deep.equal('SecurityError')
     })
   })
@@ -867,14 +867,14 @@ describe('session module', () => {
 
     it('can be retrieved with getUserAgent()', () => {
       const userAgent = 'test-agent'
-      const ses = session.fromPartition(''+Math.random())
+      const ses = session.fromPartition('' + Math.random())
       ses.setUserAgent(userAgent)
       expect(ses.getUserAgent()).to.equal(userAgent)
     })
 
     it('sets the User-Agent header for web requests made from renderers', async () => {
       const userAgent = 'test-agent'
-      const ses = session.fromPartition(''+Math.random())
+      const ses = session.fromPartition('' + Math.random())
       ses.setUserAgent(userAgent)
       const w = new BrowserWindow({ show: false, webPreferences: { session: ses } })
       let headers: http.IncomingHttpHeaders | null = null

+ 1 - 1
spec-main/api-shell-spec.ts

@@ -56,4 +56,4 @@ describe('shell module', () => {
       ])
     })
   })
-})
+})

+ 1 - 1
spec-main/api-subframe-spec.ts

@@ -5,7 +5,7 @@ import { emittedNTimes, emittedOnce } from './events-helpers'
 import { closeWindow } from './window-helpers'
 import { app, BrowserWindow, ipcMain } from 'electron'
 import { AddressInfo } from 'net'
-import { ifdescribe } from './spec-helpers';
+import { ifdescribe } from './spec-helpers'
 
 describe('renderer nodeIntegrationInSubFrames', () => {
   const generateTests = (description: string, webPreferences: any) => {

+ 5 - 5
spec-main/api-system-preferences-spec.ts

@@ -123,10 +123,10 @@ describe('systemPreferences module', () => {
         systemPreferences.getSystemColor(color as any)
       }).to.throw(`Unknown system color: ${color}`)
     })
-  
+
     it('returns a valid system color', () => {
       const colors = ['blue', 'brown', 'gray', 'green', 'orange', 'pink', 'purple', 'red', 'yellow']
-      
+
       colors.forEach(color => {
         const sysColor = systemPreferences.getSystemColor(color as any)
         expect(sysColor).to.be.a('string')
@@ -141,7 +141,7 @@ describe('systemPreferences module', () => {
         systemPreferences.getColor(color as any)
       }).to.throw(`Unknown color: ${color}`)
     })
-  
+
     it('returns a valid color', () => {
       const colors = [
         'alternate-selected-control-text',
@@ -178,7 +178,7 @@ describe('systemPreferences module', () => {
         'window-background',
         'window-frame-text'
       ]
-      
+
       colors.forEach(color => {
         const sysColor = systemPreferences.getColor(color as any)
         expect(sysColor).to.be.a('string')
@@ -236,7 +236,7 @@ describe('systemPreferences module', () => {
 
   ifdescribe(process.platform === 'darwin')('systemPreferences.getMediaAccessStatus(mediaType)', () => {
     const statuses = ['not-determined', 'granted', 'denied', 'restricted', 'unknown']
-    
+
     it('returns an access status for a camera access request', () => {
       const cameraStatus = systemPreferences.getMediaAccessStatus('camera')
       expect(statuses).to.include(cameraStatus)

+ 3 - 3
spec-main/api-touch-bar-spec.ts

@@ -36,7 +36,7 @@ describe('TouchBar module', () => {
     let window: BrowserWindow
 
     beforeEach(() => {
-      window = new BrowserWindow({show: false})
+      window = new BrowserWindow({ show: false })
     })
 
     afterEach(async () => {
@@ -72,14 +72,14 @@ describe('TouchBar module', () => {
           mode: 'fixed',
           showArrowButtons: true
         })
-      ]})
+      ] })
       const escapeButton = new TouchBarButton({ label: 'foo' })
       window.setTouchBar(touchBar)
       touchBar.escapeItem = escapeButton
       label.label = 'baz'
       escapeButton.label = 'hello'
       window.setTouchBar(null)
-      window.setTouchBar(new TouchBar({items: [new TouchBarLabel({ label: 'two' })]}))
+      window.setTouchBar(new TouchBar({ items: [new TouchBarLabel({ label: 'two' })] }))
       touchBar.escapeItem = null
     })
 

+ 3 - 3
spec-main/api-tray-spec.ts

@@ -3,7 +3,7 @@ import { Menu, Tray, nativeImage } from 'electron'
 import { ifdescribe, ifit } from './spec-helpers'
 
 describe('tray module', () => {
-  let tray: Tray;
+  let tray: Tray
 
   beforeEach(() => { tray = new Tray(nativeImage.createEmpty()) })
 
@@ -56,9 +56,9 @@ describe('tray module', () => {
   describe('tray.getBounds()', () => {
     afterEach(() => { tray.destroy() })
 
-    ifit(process.platform !== 'linux') ('returns a bounds object', function () {
+    ifit(process.platform !== 'linux')('returns a bounds object', function () {
       const bounds = tray.getBounds()
-      expect(bounds).to.be.an('object').and.to.have.all.keys('x', 'y', 'width', 'height');
+      expect(bounds).to.be.an('object').and.to.have.all.keys('x', 'y', 'width', 'height')
     })
   })
 

+ 23 - 23
spec-main/api-web-contents-spec.ts

@@ -47,22 +47,22 @@ describe('webContents module', () => {
   describe('will-prevent-unload event', () => {
     afterEach(closeAllWindows)
     it('does not emit if beforeunload returns undefined', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.once('closed', () => done())
-      w.webContents.once('will-prevent-unload', (e) => {
+      w.webContents.once('will-prevent-unload', () => {
         expect.fail('should not have fired')
       })
       w.loadFile(path.join(fixturesPath, 'api', 'close-beforeunload-undefined.html'))
     })
 
     it('emits if beforeunload returns false', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.webContents.once('will-prevent-unload', () => done())
       w.loadFile(path.join(fixturesPath, 'api', 'close-beforeunload-false.html'))
     })
 
     it('supports calling preventDefault on will-prevent-unload events', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.webContents.once('will-prevent-unload', event => event.preventDefault())
       w.once('closed', () => done())
       w.loadFile(path.join(fixturesPath, 'api', 'close-beforeunload-false.html'))
@@ -72,7 +72,7 @@ describe('webContents module', () => {
   describe('webContents.send(channel, args...)', () => {
     afterEach(closeAllWindows)
     it('throws an error when the channel is missing', () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       expect(() => {
         (w.webContents.send as any)()
       }).to.throw('Missing required channel argument')
@@ -98,7 +98,7 @@ describe('webContents module', () => {
       })
       w.loadFile(path.join(fixturesPath, 'pages', 'send-after-node.html'))
       setTimeout(() => {
-        w.webContents.send("test")
+        w.webContents.send('test')
       }, 50)
     })
   })
@@ -145,7 +145,7 @@ describe('webContents module', () => {
       let w: BrowserWindow
 
       before(async () => {
-        w = new BrowserWindow({show: false})
+        w = new BrowserWindow({ show: false })
         await w.loadURL('about:blank')
       })
       after(closeAllWindows)
@@ -169,10 +169,10 @@ describe('webContents module', () => {
       })
     })
 
-    describe("on a real page", () => {
+    describe('on a real page', () => {
       let w: BrowserWindow
       beforeEach(() => {
-        w = new BrowserWindow({show: false})
+        w = new BrowserWindow({ show: false })
       })
       afterEach(closeAllWindows)
 
@@ -211,7 +211,7 @@ describe('webContents module', () => {
 
       it('executes after page load', (done) => {
         w.webContents.executeJavaScript(`(() => "test")()`).then(result => {
-          expect(result).to.equal("test")
+          expect(result).to.equal('test')
           done()
         })
         w.loadURL(serverUrl)
@@ -222,7 +222,7 @@ describe('webContents module', () => {
   describe('loadURL() promise API', () => {
     let w: BrowserWindow
     beforeEach(async () => {
-      w = new BrowserWindow({show: false})
+      w = new BrowserWindow({ show: false })
     })
     afterEach(closeAllWindows)
 
@@ -266,7 +266,7 @@ describe('webContents module', () => {
     })
 
     it('rejects if the load is aborted', async () => {
-      const s = http.createServer((req, res) => { /* never complete the request */ })
+      const s = http.createServer(() => { /* never complete the request */ })
       await new Promise(resolve => s.listen(0, '127.0.0.1', resolve))
       const { port } = s.address() as AddressInfo
       const p = expect(w.loadURL(`http://127.0.0.1:${port}`)).to.eventually.be.rejectedWith(Error, /ERR_ABORTED/)
@@ -288,7 +288,7 @@ describe('webContents module', () => {
       await new Promise(resolve => s.listen(0, '127.0.0.1', resolve))
       const { port } = s.address() as AddressInfo
       const p = new Promise(resolve => {
-        w.webContents.on('did-fail-load', (event, errorCode, errorDescription, validatedURL, isMainFrame, frameProcessId, frameRoutingId) => {
+        w.webContents.on('did-fail-load', (event, errorCode, errorDescription, validatedURL, isMainFrame) => {
           if (!isMainFrame) {
             resolve()
           }
@@ -312,7 +312,7 @@ describe('webContents module', () => {
       await new Promise(resolve => s.listen(0, '127.0.0.1', resolve))
       const { port } = s.address() as AddressInfo
       const p = new Promise(resolve => {
-        w.webContents.on('did-frame-finish-load', (event, isMainFrame, frameProcessId, frameRoutingId) => {
+        w.webContents.on('did-frame-finish-load', (event, isMainFrame) => {
           if (!isMainFrame) {
             resolve()
           }
@@ -332,7 +332,7 @@ describe('webContents module', () => {
 
     const testFn = (process.platform === 'win32' && process.arch === 'arm64' ? it.skip : it)
     testFn('returns the focused web contents', async () => {
-      const w = new BrowserWindow({show: true})
+      const w = new BrowserWindow({ show: true })
       await w.loadURL('about:blank')
       expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.id)
 
@@ -347,7 +347,7 @@ describe('webContents module', () => {
     })
 
     it('does not crash when called on a detached dev tools window', async () => {
-      const w = new BrowserWindow({show: true})
+      const w = new BrowserWindow({ show: true })
 
       w.webContents.openDevTools({ mode: 'detach' })
       w.webContents.inspectElement(100, 100)
@@ -358,7 +358,7 @@ describe('webContents module', () => {
       expect(() => { webContents.getFocusedWebContents() }).to.not.throw()
 
       // Work around https://github.com/electron/electron/issues/19985
-      await new Promise(r => setTimeout(r, 0))
+      await new Promise(resolve => setTimeout(resolve, 0))
 
       const devToolsClosed = emittedOnce(w.webContents, 'devtools-closed')
       w.webContents.closeDevTools()
@@ -420,7 +420,7 @@ describe('webContents module', () => {
   describe('getWebPreferences() API', () => {
     afterEach(closeAllWindows)
     it('should not crash when called for devTools webContents', (done) => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.webContents.openDevTools()
       w.webContents.once('devtools-opened', () => {
         expect(w.webContents.devToolsWebContents.getWebPreferences()).to.be.null()
@@ -432,7 +432,7 @@ describe('webContents module', () => {
   describe('openDevTools() API', () => {
     afterEach(closeAllWindows)
     it('can show window with activation', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const focused = emittedOnce(w, 'focus')
       w.show()
       await focused
@@ -440,14 +440,14 @@ describe('webContents module', () => {
       w.webContents.openDevTools({ mode: 'detach', activate: true })
       await Promise.all([
         emittedOnce(w.webContents, 'devtools-opened'),
-        emittedOnce(w.webContents, 'devtools-focused'),
+        emittedOnce(w.webContents, 'devtools-focused')
       ])
       await new Promise(resolve => setTimeout(resolve, 0))
       expect(w.isFocused()).to.be.false()
     })
 
     it('can show window without activation', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       const devtoolsOpened = emittedOnce(w.webContents, 'devtools-opened')
       w.webContents.openDevTools({ mode: 'detach', activate: false })
       await devtoolsOpened
@@ -464,7 +464,7 @@ describe('webContents module', () => {
         ipcMain.once('keydown', (event, key) => resolve(key))
       })
       w.webContents.once('before-input-event', (event, input) => {
-        if ('a' === input.key) event.preventDefault()
+        if (input.key === 'a') event.preventDefault()
       })
       w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'a' })
       w.webContents.sendInputEvent({ type: 'keyDown', keyCode: 'b' })
@@ -472,7 +472,7 @@ describe('webContents module', () => {
     })
 
     it('has the correct properties', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       await w.loadFile(path.join(fixturesPath, 'pages', 'base-page.html'))
       const testBeforeInput = async (opts: any) => {
         const modifiers = []

+ 1 - 1
spec-main/api-web-frame-spec.ts

@@ -37,4 +37,4 @@ describe('webFrame module', () => {
     expect(words.sort()).to.deep.equal(['spleling', 'test', `you're`, 'you', 're'].sort())
     expect(callbackDefined).to.be.true()
   })
-})
+})

+ 4 - 4
spec-main/api-web-request-spec.ts

@@ -3,7 +3,7 @@ import * as http from 'http'
 import * as qs from 'querystring'
 import * as path from 'path'
 import { session, WebContents, webContents } from 'electron'
-import { AddressInfo } from 'net';
+import { AddressInfo } from 'net'
 
 const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
 
@@ -40,7 +40,7 @@ describe('webRequest module', () => {
   let contents: WebContents = null as unknown as WebContents
   // NB. sandbox: true is used because it makes navigations much (~8x) faster.
   before(async () => {
-    contents = (webContents as any).create({sandbox: true})
+    contents = (webContents as any).create({ sandbox: true })
     await contents.loadFile(path.join(fixturesPath, 'pages', 'jquery.html'))
   })
   after(() => (contents as any).destroy())
@@ -103,7 +103,7 @@ describe('webRequest module', () => {
       })
       await expect(ajax(defaultURL, {
         type: 'POST',
-        data: postData,
+        data: postData
       })).to.eventually.be.rejectedWith('404')
     })
 
@@ -227,7 +227,7 @@ describe('webRequest module', () => {
       })
       const { headers } = await contents.executeJavaScript(`new Promise((resolve, reject) => {
         const options = {
-          ...${JSON.stringify({url: defaultURL})},
+          ...${JSON.stringify({ url: defaultURL })},
           success: (data, status, request) => {
             reject(new Error('expected failure'))
           },

+ 1 - 1
spec-main/asar-spec.ts

@@ -79,4 +79,4 @@ describe('asar package', () => {
       })
     })
   })
-})
+})

+ 43 - 51
spec-main/chromium-spec.ts

@@ -1,5 +1,4 @@
 import * as chai from 'chai'
-import { expect } from 'chai'
 import * as chaiAsPromised from 'chai-as-promised'
 import { BrowserWindow, WebContents, session, ipcMain, app, protocol, webContents } from 'electron'
 import { emittedOnce } from './events-helpers'
@@ -15,6 +14,8 @@ import { promisify } from 'util'
 import { ifit, ifdescribe } from './spec-helpers'
 import { AddressInfo } from 'net'
 
+const { expect } = chai
+
 const features = process.electronBinding('features')
 
 chai.use(chaiAsPromised)
@@ -22,7 +23,7 @@ const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures')
 
 describe('reporting api', () => {
   it('sends a report for a deprecation', async () => {
-    const reports = new EventEmitter
+    const reports = new EventEmitter()
 
     // The Reporting API only works on https with valid certs. To dodge having
     // to set up a trusted certificate, hack the validator.
@@ -44,7 +45,7 @@ describe('reporting api', () => {
     const server = https.createServer(options, (req, res) => {
       if (req.url === '/report') {
         let data = ''
-        req.on('data', (d) => data += d.toString('utf-8'))
+        req.on('data', (d) => { data += d.toString('utf-8') })
         req.on('end', () => {
           reports.emit('report', JSON.parse(data))
         })
@@ -52,16 +53,16 @@ describe('reporting api', () => {
       res.setHeader('Report-To', JSON.stringify({
         group: 'default',
         max_age: 120,
-        endpoints: [ {url: `https://localhost:${(server.address() as any).port}/report`} ],
+        endpoints: [ { url: `https://localhost:${(server.address() as any).port}/report` } ]
       }))
       res.setHeader('Content-Type', 'text/html')
       // using the deprecated `webkitRequestAnimationFrame` will trigger a
       // "deprecation" report.
       res.end('<script>webkitRequestAnimationFrame(() => {})</script>')
     })
-    await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
+    await new Promise(resolve => server.listen(0, '127.0.0.1', resolve))
     const bw = new BrowserWindow({
-      show: false,
+      show: false
     })
     try {
       const reportGenerated = emittedOnce(reports, 'report')
@@ -85,7 +86,7 @@ describe('window.postMessage', () => {
   })
 
   it('sets the source and origin correctly', async () => {
-    const w = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true}})
+    const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
     w.loadURL(`file://${fixturesPath}/pages/window-open-postMessage-driver.html`)
     const [, message] = await emittedOnce(ipcMain, 'complete')
     expect(message.data).to.equal('testing')
@@ -604,7 +605,7 @@ describe('chromium features', () => {
     })
 
     it('can return labels of enumerated devices', async () => {
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'))
       const labels = await w.webContents.executeJavaScript(`navigator.mediaDevices.enumerateDevices().then(ds => ds.map(d => d.label))`)
       expect(labels.some((l: any) => l)).to.be.true()
@@ -612,7 +613,7 @@ describe('chromium features', () => {
 
     it('does not return labels of enumerated devices when permission denied', async () => {
       session.defaultSession.setPermissionCheckHandler(() => false)
-      const w = new BrowserWindow({show: false})
+      const w = new BrowserWindow({ show: false })
       w.loadFile(path.join(fixturesPath, 'pages', 'blank.html'))
       const labels = await w.webContents.executeJavaScript(`navigator.mediaDevices.enumerateDevices().then(ds => ds.map(d => d.label))`)
       expect(labels.some((l: any) => l)).to.be.false()
@@ -646,31 +647,31 @@ describe('chromium features', () => {
     const httpBlank = `${scheme}://origin1/blank`
 
     const table = [
-      {parent: fileBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false},
-      {parent: fileBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false},
-      {parent: fileBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true},
-      {parent: fileBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false},
+      { parent: fileBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false },
+      { parent: fileBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false },
+      { parent: fileBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true },
+      { parent: fileBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false },
 
-      {parent: httpBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false},
-      //{parent: httpBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false}, // can't window.open()
-      {parent: httpBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true},
-      //{parent: httpBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false}, // can't window.open()
+      { parent: httpBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false },
+      // {parent: httpBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false}, // can't window.open()
+      { parent: httpBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true },
+      // {parent: httpBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false}, // can't window.open()
 
       // NB. this is different from Chrome's behavior, which isolates file: urls from each other
-      {parent: fileBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: true},
-      {parent: fileBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: true},
-      {parent: fileBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true},
-      {parent: fileBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: true},
-
-      {parent: httpBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: true},
-      {parent: httpBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: true},
-      {parent: httpBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true},
-      {parent: httpBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: true},
-
-      {parent: httpBlank, child: httpUrl2, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false},
-      {parent: httpBlank, child: httpUrl2, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false},
-      {parent: httpBlank, child: httpUrl2, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true},
-      {parent: httpBlank, child: httpUrl2, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false},
+      { parent: fileBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: true },
+      { parent: fileBlank, child: fileUrl, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: true },
+      { parent: fileBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true },
+      { parent: fileBlank, child: fileUrl, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: true },
+
+      { parent: httpBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: true },
+      { parent: httpBlank, child: httpUrl1, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: true },
+      { parent: httpBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true },
+      { parent: httpBlank, child: httpUrl1, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: true },
+
+      { parent: httpBlank, child: httpUrl2, nodeIntegration: false, nativeWindowOpen: false, openerAccessible: false },
+      { parent: httpBlank, child: httpUrl2, nodeIntegration: false, nativeWindowOpen: true, openerAccessible: false },
+      { parent: httpBlank, child: httpUrl2, nodeIntegration: true, nativeWindowOpen: false, openerAccessible: true },
+      { parent: httpBlank, child: httpUrl2, nodeIntegration: true, nativeWindowOpen: true, openerAccessible: false }
     ]
     const s = (url: string) => url.startsWith('file') ? 'file://...' : url
 
@@ -689,16 +690,16 @@ describe('chromium features', () => {
     afterEach(closeAllWindows)
 
     describe('when opened from main window', () => {
-      for (const {parent, child, nodeIntegration, nativeWindowOpen, openerAccessible} of table) {
+      for (const { parent, child, nodeIntegration, nativeWindowOpen, openerAccessible } of table) {
         const description = `when parent=${s(parent)} opens child=${s(child)} with nodeIntegration=${nodeIntegration} nativeWindowOpen=${nativeWindowOpen}, child should ${openerAccessible ? '' : 'not '}be able to access opener`
         it(description, async () => {
-          const w = new BrowserWindow({show: false, webPreferences: { nodeIntegration: true, nativeWindowOpen }})
+          const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, nativeWindowOpen } })
           await w.loadURL(parent)
           const childOpenerLocation = await w.webContents.executeJavaScript(`new Promise(resolve => {
             window.addEventListener('message', function f(e) {
               resolve(e.data)
             })
-            window.open(${JSON.stringify(child)}, "", "show=no,nodeIntegration=${nodeIntegration ? "yes" : "no"}")
+            window.open(${JSON.stringify(child)}, "", "show=no,nodeIntegration=${nodeIntegration ? 'yes' : 'no'}")
           })`)
           if (openerAccessible) {
             expect(childOpenerLocation).to.be.a('string')
@@ -710,7 +711,7 @@ describe('chromium features', () => {
     })
 
     describe('when opened from <webview>', () => {
-      for (const {parent, child, nodeIntegration, nativeWindowOpen, openerAccessible} of table) {
+      for (const { parent, child, nodeIntegration, nativeWindowOpen, openerAccessible } of table) {
         const description = `when parent=${s(parent)} opens child=${s(child)} with nodeIntegration=${nodeIntegration} nativeWindowOpen=${nativeWindowOpen}, child should ${openerAccessible ? '' : 'not '}be able to access opener`
         // WebView erroneously allows access to the parent window when nativeWindowOpen is false.
         const skip = !nativeWindowOpen && !openerAccessible
@@ -722,7 +723,7 @@ describe('chromium features', () => {
           // We are testing whether context (3) can access context (2) under various conditions.
 
           // This is context (1), the base window for the test.
-          const w = new BrowserWindow({show: false, webPreferences: { nodeIntegration: true, webviewTag: true }})
+          const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, webviewTag: true } })
           await w.loadURL('about:blank')
 
           const parentCode = `new Promise((resolve) => {
@@ -735,8 +736,8 @@ describe('chromium features', () => {
           const childOpenerLocation = await w.webContents.executeJavaScript(`new Promise((resolve, reject) => {
             // This is context (2), a WebView which will call window.open()
             const webview = new WebView()
-            webview.setAttribute('nodeintegration', '${nodeIntegration ? "on" : "off"}')
-            webview.setAttribute('webpreferences', 'nativeWindowOpen=${nativeWindowOpen ? "yes" : "no"}')
+            webview.setAttribute('nodeintegration', '${nodeIntegration ? 'on' : 'off'}')
+            webview.setAttribute('webpreferences', 'nativeWindowOpen=${nativeWindowOpen ? 'yes' : 'no'}')
             webview.setAttribute('allowpopups', 'on')
             webview.src = ${JSON.stringify(parent + '?p=' + encodeURIComponent(child))}
             webview.addEventListener('dom-ready', async () => {
@@ -976,7 +977,7 @@ describe('chromium features', () => {
       const w = createBrowserWindow({ plugins: false, preload: 'preload-pdf-loaded.js' })
       w.webContents.loadURL(pdfSource)
       const [state, filename, mimeType] = await new Promise(resolve => {
-        session.defaultSession.once('will-download', (event, item, webContents) => {
+        session.defaultSession.once('will-download', (event, item) => {
           item.setSavePath(path.join(fixturesPath, 'mock.pdf'))
           item.on('done', (e, state) => {
             resolve([state, item.getFilename(), item.getMimeType()])
@@ -1026,7 +1027,6 @@ describe('chromium features', () => {
   })
 })
 
-
 describe('font fallback', () => {
   async function getRenderedFonts (html: string) {
     const w = new BrowserWindow({ show: false })
@@ -1048,12 +1048,7 @@ describe('font fallback', () => {
     const fonts = await getRenderedFonts(html)
     expect(fonts).to.be.an('array')
     expect(fonts).to.have.length(1)
-    if (process.platform === 'win32')
-      expect(fonts[0].familyName).to.equal('Arial')
-    else if (process.platform === 'darwin')
-      expect(fonts[0].familyName).to.equal('Helvetica')
-    else if (process.platform === 'linux')
-      expect(fonts[0].familyName).to.equal('DejaVu Sans') // I think this depends on the distro? We don't specify a default.
+    if (process.platform === 'win32') { expect(fonts[0].familyName).to.equal('Arial') } else if (process.platform === 'darwin') { expect(fonts[0].familyName).to.equal('Helvetica') } else if (process.platform === 'linux') { expect(fonts[0].familyName).to.equal('DejaVu Sans') } // I think this depends on the distro? We don't specify a default.
   })
 
   ifit(process.platform !== 'linux')('should fall back to Japanese font for sans-serif Japanese script', async function () {
@@ -1068,9 +1063,6 @@ describe('font fallback', () => {
     const fonts = await getRenderedFonts(html)
     expect(fonts).to.be.an('array')
     expect(fonts).to.have.length(1)
-    if (process.platform === 'win32')
-      expect(fonts[0].familyName).to.be.oneOf(['Meiryo', 'Yu Gothic'])
-    else if (process.platform === 'darwin')
-      expect(fonts[0].familyName).to.equal('Hiragino Kaku Gothic ProN')
+    if (process.platform === 'win32') { expect(fonts[0].familyName).to.be.oneOf(['Meiryo', 'Yu Gothic']) } else if (process.platform === 'darwin') { expect(fonts[0].familyName).to.equal('Hiragino Kaku Gothic ProN') }
   })
-})
+})

+ 5 - 6
spec-main/extensions-spec.ts

@@ -1,13 +1,12 @@
 import { expect } from 'chai'
 import { session, BrowserWindow, ipcMain } from 'electron'
-import { closeAllWindows } from './window-helpers'
+import { closeAllWindows, closeWindow } from './window-helpers'
 import * as http from 'http'
 import { AddressInfo } from 'net'
 import * as path from 'path'
 import * as fs from 'fs'
 import { ifdescribe } from './spec-helpers'
 import { emittedOnce } from './events-helpers'
-import { closeWindow } from './window-helpers';
 
 const fixtures = path.join(__dirname, 'fixtures')
 
@@ -34,7 +33,7 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex
     // default session.
     const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
     (customSession as any).loadChromeExtension(path.join(fixtures, 'extensions', 'red-bg'))
-    const w = new BrowserWindow({show: false, webPreferences: {session: customSession}})
+    const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } })
     await w.loadURL(url)
     const bg = await w.webContents.executeJavaScript('document.documentElement.style.backgroundColor')
     expect(bg).to.equal('red')
@@ -43,7 +42,7 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex
   it('confines an extension to the session it was loaded in', async () => {
     const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
     (customSession as any).loadChromeExtension(path.join(fixtures, 'extensions', 'red-bg'))
-    const w = new BrowserWindow({show: false}) // not in the session
+    const w = new BrowserWindow({ show: false }) // not in the session
     await w.loadURL(url)
     const bg = await w.webContents.executeJavaScript('document.documentElement.style.backgroundColor')
     expect(bg).to.equal('')
@@ -54,7 +53,7 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex
     before(async () => {
       const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
       (customSession as any).loadChromeExtension(path.join(fixtures, 'extensions', 'chrome-runtime'))
-      const w = new BrowserWindow({show: false, webPreferences: { session: customSession }})
+      const w = new BrowserWindow({ show: false, webPreferences: { session: customSession } })
       try {
         await w.loadURL(url)
         content = JSON.parse(await w.webContents.executeJavaScript('document.documentElement.textContent'))
@@ -78,7 +77,7 @@ ifdescribe(process.electronBinding('features').isExtensionsEnabled())('chrome ex
     it('stores and retrieves a key', async () => {
       const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
       (customSession as any).loadChromeExtension(path.join(fixtures, 'extensions', 'chrome-storage'))
-      const w = new BrowserWindow({show: false, webPreferences: { session: customSession, nodeIntegration: true }})
+      const w = new BrowserWindow({ show: false, webPreferences: { session: customSession, nodeIntegration: true } })
       try {
         const p = emittedOnce(ipcMain, 'storage-success')
         await w.loadURL(url)

+ 2 - 1
spec-main/fixtures/extensions/chrome-runtime/main.js

@@ -1,5 +1,6 @@
+/* eslint-disable */
 document.documentElement.textContent = JSON.stringify({
   manifest: chrome.runtime.getManifest(),
   id: chrome.runtime.id,
-  url: chrome.runtime.getURL('main.js'),
+  url: chrome.runtime.getURL('main.js')
 })

+ 3 - 2
spec-main/fixtures/extensions/chrome-storage/main.js

@@ -1,5 +1,6 @@
-chrome.storage.local.set({key: 'value'}, () => {
-  chrome.storage.local.get(['key'], ({key}) => {
+/* eslint-disable */
+chrome.storage.local.set({ key: 'value' }, () => {
+  chrome.storage.local.get(['key'], ({ key }) => {
     const script = document.createElement('script')
     script.textContent = `require('electron').ipcRenderer.send('storage-success', ${JSON.stringify(key)})`
     document.documentElement.appendChild(script)

+ 3 - 3
spec-main/node-spec.ts

@@ -2,9 +2,9 @@ import { expect } from 'chai'
 import * as childProcess from 'child_process'
 import * as path from 'path'
 import * as util from 'util'
-import { emittedOnce } from './events-helpers';
-import { ifdescribe, ifit } from './spec-helpers';
-import { webContents, WebContents } from 'electron';
+import { emittedOnce } from './events-helpers'
+import { ifdescribe, ifit } from './spec-helpers'
+import { webContents, WebContents } from 'electron'
 
 const features = process.electronBinding('features')
 

+ 3 - 3
spec-main/security-warnings-spec.ts

@@ -7,8 +7,8 @@ import * as url from 'url'
 import { BrowserWindow, WebPreferences } from 'electron'
 
 import { closeWindow } from './window-helpers'
-import { AddressInfo } from 'net';
-import { emittedUntil } from './events-helpers';
+import { AddressInfo } from 'net'
+import { emittedUntil } from './events-helpers'
 
 const messageContainsSecurityWarning = (event: Event, level: number, message: string) => {
   return message.indexOf('Electron Security Warning') > -1
@@ -200,7 +200,7 @@ describe('security warnings', () => {
         })
 
         w.loadURL(`${serverUrl}/insecure-resources.html`)
-        const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning)        
+        const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning)
         expect(message).to.not.include('insecure-resources.html')
       })
 

+ 1 - 1
spec-main/spec-helpers.ts

@@ -1,4 +1,4 @@
 export const ifit = (condition: boolean) => (condition ? it : it.skip)
 export const ifdescribe = (condition: boolean) => (condition ? describe : describe.skip)
 
-export const delay = (time: number) => new Promise(r => setTimeout(r, time))
+export const delay = (time: number) => new Promise(resolve => setTimeout(resolve, time))

+ 2 - 2
spec-main/version-bump-spec.ts

@@ -1,7 +1,7 @@
 import { expect } from 'chai'
 import { nextVersion } from '../script/release/version-bumper'
 import * as utils from '../script/release/version-utils'
-import { ifdescribe } from './spec-helpers';
+import { ifdescribe } from './spec-helpers'
 
 describe('version-bumper', () => {
   describe('makeVersion', () => {
@@ -126,4 +126,4 @@ describe('version-bumper', () => {
       ).to.be.rejectedWith('Invalid bump type.')
     })
   })
-})
+})

+ 15 - 15
spec-main/visibility-state-spec.ts

@@ -1,11 +1,11 @@
 import { expect } from 'chai'
-import * as cp from 'child_process';
+import * as cp from 'child_process'
 import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
 import * as path from 'path'
 
 import { emittedOnce } from './events-helpers'
-import { closeWindow } from './window-helpers';
-import { ifdescribe } from './spec-helpers';
+import { closeWindow } from './window-helpers'
+import { ifdescribe, delay } from './spec-helpers'
 
 // visibilityState specs pass on linux with a real window manager but on CI
 // the environment does not let these specs pass
@@ -45,7 +45,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
   })
 
   itWithOptions('should be visible when the window is initially shown', {
-    show: true,
+    show: true
   }, async () => {
     await load()
     const state = await getVisibilityState()
@@ -53,7 +53,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
   })
 
   itWithOptions('should be hidden when the window is initially hidden', {
-    show: false,
+    show: false
   }, async () => {
     await load()
     const state = await getVisibilityState()
@@ -61,7 +61,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
   })
 
   itWithOptions('should be visible when the window is initially hidden but shown before the page is loaded', {
-    show: false,
+    show: false
   }, async () => {
     w.show()
     await load()
@@ -70,12 +70,12 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
   })
 
   itWithOptions('should be hidden when the window is initially shown but hidden before the page is loaded', {
-    show: true,
+    show: true
   }, async () => {
     // TODO(MarshallOfSound): Figure out if we can work around this 1 tick issue for users
     if (process.platform === 'darwin') {
       // Wait for a tick, the window being "shown" takes 1 tick on macOS
-      await new Promise(r => setTimeout(r, 0))
+      await delay(0)
     }
     w.hide()
     await load()
@@ -110,7 +110,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
   describe('on platforms that support occlusion detection', () => {
     let child: cp.ChildProcess
 
-    before(function() {
+    before(function () {
       if (process.platform !== 'darwin') this.skip()
     })
 
@@ -133,13 +133,13 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
       x: 0,
       y: 0,
       width: 200,
-      height: 200,
+      height: 200
     }, async () => {
       await makeOtherWindow({
         x: 200,
         y: 0,
         width: 200,
-        height: 200,
+        height: 200
       })
       await load()
       const state = await getVisibilityState()
@@ -150,13 +150,13 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
       x: 50,
       y: 50,
       width: 150,
-      height: 150,
+      height: 150
     }, async () => {
       await makeOtherWindow({
         x: 100,
         y: 0,
         width: 200,
-        height: 200,
+        height: 200
       })
       await load()
       const state = await getVisibilityState()
@@ -167,7 +167,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
       x: 50,
       y: 50,
       width: 50,
-      height: 50,
+      height: 50
     }, async function () {
       this.timeout(240000)
       await load()
@@ -176,7 +176,7 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
           x: 0,
           y: 0,
           width: 300,
-          height: 300,
+          height: 300
         })
       })
       const state = await getVisibilityState()

+ 4 - 5
spec-main/webview-spec.ts

@@ -4,7 +4,7 @@ import { closeAllWindows } from './window-helpers'
 import { emittedOnce } from './events-helpers'
 import { expect } from 'chai'
 
-async function loadWebView(w: WebContents, attributes: Record<string, string>): Promise<void> {
+async function loadWebView (w: WebContents, attributes: Record<string, string>): Promise<void> {
   await w.executeJavaScript(`
     new Promise((resolve, reject) => {
       const webview = new WebView()
@@ -395,7 +395,7 @@ describe('<webview> tag', function () {
       await w.loadURL('about:blank')
     })
     afterEach(closeAllWindows)
-    
+
     it('can enable context isolation', async () => {
       loadWebView(w.webContents, {
         allowpopups: 'yes',
@@ -439,7 +439,7 @@ describe('<webview> tag', function () {
 
     const partition = 'permissionTest'
 
-    function setUpRequestHandler(webContentsId: number, requestedPermission: string) {
+    function setUpRequestHandler (webContentsId: number, requestedPermission: string) {
       return new Promise((resolve, reject) => {
         session.fromPartition(partition).setPermissionRequestHandler(function (webContents, permission, callback) {
           if (webContents.id === webContentsId) {
@@ -523,7 +523,7 @@ describe('<webview> tag', function () {
     it('emits when accessing external protocol', async () => {
       loadWebView(w.webContents, {
         src: `magnet:test`,
-        partition,
+        partition
       })
       const [, webViewContents] = await emittedOnce(app, 'web-contents-created')
       await setUpRequestHandler(webViewContents.id, 'openExternal')
@@ -544,5 +544,4 @@ describe('<webview> tag', function () {
       expect(error).to.equal('denied')
     })
   })
-
 })

+ 4 - 4
spec-main/window-helpers.ts

@@ -1,8 +1,8 @@
 import { expect } from 'chai'
 import { BrowserWindow } from 'electron'
-import { emittedOnce } from './events-helpers';
+import { emittedOnce } from './events-helpers'
 
-async function ensureWindowIsClosed(window: BrowserWindow | null) {
+async function ensureWindowIsClosed (window: BrowserWindow | null) {
   if (window && !window.isDestroyed()) {
     if (window.webContents && !window.webContents.isDestroyed()) {
       // If a window isn't destroyed already, and it has non-destroyed WebContents,
@@ -40,8 +40,8 @@ export const closeWindow = async (
   }
 }
 
-export async function closeAllWindows() {
+export async function closeAllWindows () {
   for (const w of BrowserWindow.getAllWindows()) {
-    await closeWindow(w, {assertNotWindows: false})
+    await closeWindow(w, { assertNotWindows: false })
   }
 }

+ 1 - 1
vsts-arm32v7.yml

@@ -1,7 +1,7 @@
 resources:
   containers:
   - container: arm32v7-test-container
-    image: electronbuilds/arm32v7:0.0.2
+    image: electronbuilds/arm32v7:0.0.3
     options: --shm-size 128m
 
 jobs:

+ 123 - 65
yarn.lock

@@ -3,9 +3,9 @@
 
 
 "@babel/code-frame@^7.0.0":
-  version "7.0.0"
-  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8"
-  integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==
+  version "7.5.5"
+  resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d"
+  integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==
   dependencies:
     "@babel/highlight" "^7.0.0"
 
@@ -219,6 +219,11 @@
   dependencies:
     "@types/node" "*"
 
+"@types/json-schema@^7.0.3":
+  version "7.0.3"
+  resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.3.tgz#bdfd69d61e464dcc81b25159c270d75a73c1a636"
+  integrity sha512-Il2DtDVRGDcqjDtE+rF8iqg1CArehSK84HZJCT7AMITlyXRBpuPhqGLDQMowraqqu1coEaimg4ZOqggt6L6L+A==
+
 "@types/linkify-it@*":
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-2.1.0.tgz#ea3dd64c4805597311790b61e872cbd1ed2cd806"
@@ -344,42 +349,46 @@
     "@types/uglify-js" "*"
     source-map "^0.6.0"
 
-"@typescript-eslint/eslint-plugin@^1.4.2":
-  version "1.11.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.11.0.tgz#870f752c520db04db6d3668af7479026a6f2fb9a"
-  integrity sha512-mXv9ccCou89C8/4avKHuPB2WkSZyY/XcTQUXd5LFZAcLw1I3mWYVjUu6eS9Ja0QkP/ClolbcW9tb3Ov/pMdcqw==
+"@typescript-eslint/eslint-plugin@^2.6.0":
+  version "2.6.0"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.6.0.tgz#e82ed43fc4527b21bfe35c20a2d6e4ed49fc7957"
+  integrity sha512-iCcXREU4RciLmLniwKLRPCOFVXrkF7z27XuHq5DrykpREv/mz6ztKAyLg2fdkM0hQC7659p5ZF5uStH7uzAJ/w==
   dependencies:
-    "@typescript-eslint/experimental-utils" "1.11.0"
-    eslint-utils "^1.3.1"
+    "@typescript-eslint/experimental-utils" "2.6.0"
+    eslint-utils "^1.4.2"
     functional-red-black-tree "^1.0.1"
     regexpp "^2.0.1"
-    tsutils "^3.7.0"
+    tsutils "^3.17.1"
 
-"@typescript-eslint/experimental-utils@1.11.0":
-  version "1.11.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.11.0.tgz#594abe47091cbeabac1d6f9cfed06d0ad99eb7e3"
-  integrity sha512-7LbfaqF6B8oa8cp/315zxKk8FFzosRzzhF8Kn/ZRsRsnpm7Qcu25cR/9RnAQo5utZ2KIWVgaALr+ZmcbG47ruw==
+"@typescript-eslint/experimental-utils@2.6.0":
+  version "2.6.0"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.6.0.tgz#ed70bef72822bff54031ff0615fc888b9e2b6e8a"
+  integrity sha512-34BAFpNOwHXeqT+AvdalLxOvcPYnCxA5JGmBAFL64RGMdP0u65rXjii7l/nwpgk5aLEE1LaqF+SsCU0/Cb64xA==
   dependencies:
-    "@typescript-eslint/typescript-estree" "1.11.0"
-    eslint-scope "^4.0.0"
+    "@types/json-schema" "^7.0.3"
+    "@typescript-eslint/typescript-estree" "2.6.0"
+    eslint-scope "^5.0.0"
 
-"@typescript-eslint/parser@^1.4.2":
-  version "1.11.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.11.0.tgz#2f6d4f7e64eeb1e7c25b422f8df14d0c9e508e36"
-  integrity sha512-5xBExyXaxVyczrZvbRKEXvaTUFFq7gIM9BynXukXZE0zF3IQP/FxF4mPmmh3gJ9egafZFqByCpPTFm3dk4SY7Q==
+"@typescript-eslint/parser@^2.6.0":
+  version "2.6.0"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.6.0.tgz#5106295c6a7056287b4719e24aae8d6293d5af49"
+  integrity sha512-AvLejMmkcjRTJ2KD72v565W4slSrrzUIzkReu1JN34b8JnsEsxx7S9Xx/qXEuMQas0mkdUfETr0j3zOhq2DIqQ==
   dependencies:
     "@types/eslint-visitor-keys" "^1.0.0"
-    "@typescript-eslint/experimental-utils" "1.11.0"
-    "@typescript-eslint/typescript-estree" "1.11.0"
-    eslint-visitor-keys "^1.0.0"
+    "@typescript-eslint/experimental-utils" "2.6.0"
+    "@typescript-eslint/typescript-estree" "2.6.0"
+    eslint-visitor-keys "^1.1.0"
 
-"@typescript-eslint/typescript-estree@1.11.0":
-  version "1.11.0"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.11.0.tgz#b7b5782aab22e4b3b6d84633652c9f41e62d37d5"
-  integrity sha512-fquUHF5tAx1sM2OeRCC7wVxFd1iMELWMGCzOSmJ3pLzArj9+kRixdlC4d5MncuzXpjEqc6045p3KwM0o/3FuUA==
+"@typescript-eslint/typescript-estree@2.6.0":
+  version "2.6.0"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.6.0.tgz#d3e9d8e001492e2b9124c4d4bd4e7f03c0fd7254"
+  integrity sha512-A3lSBVIdj2Gp0lFEL6in2eSPqJ33uAc3Ko+Y4brhjkxzjbzLnwBH22CwsW2sCo+iwogfIyvb56/AJri15H0u5Q==
   dependencies:
+    debug "^4.1.1"
+    glob "^7.1.4"
+    is-glob "^4.0.1"
     lodash.unescape "4.0.1"
-    semver "5.5.0"
+    semver "^6.3.0"
 
 "@webassemblyjs/[email protected]":
   version "1.8.5"
@@ -551,15 +560,20 @@ accepts@~1.3.7:
     negotiator "0.6.2"
 
 acorn-jsx@^5.0.0:
-  version "5.0.1"
-  resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e"
-  integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==
+  version "5.1.0"
+  resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384"
+  integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==
 
-acorn@^6.0.2, acorn@^6.0.7, acorn@^6.2.0:
+acorn@^6.0.2, acorn@^6.2.0:
   version "6.2.0"
   resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3"
   integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw==
 
+acorn@^6.0.7:
+  version "6.3.0"
+  resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e"
+  integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==
+
 ajv-errors@^1.0.0:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d"
@@ -570,7 +584,7 @@ ajv-keywords@^3.0.0, ajv-keywords@^3.1.0:
   resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da"
   integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==
 
-ajv@^6.0.1, ajv@^6.1.0, ajv@^6.5.0, ajv@^6.5.5, ajv@^6.9.1:
+ajv@^6.0.1, ajv@^6.1.0, ajv@^6.5.0, ajv@^6.5.5:
   version "6.10.1"
   resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.1.tgz#ebf8d3af22552df9dd049bfbe50cc2390e823593"
   integrity sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ==
@@ -580,6 +594,16 @@ ajv@^6.0.1, ajv@^6.1.0, ajv@^6.5.0, ajv@^6.5.5, ajv@^6.9.1:
     json-schema-traverse "^0.4.1"
     uri-js "^4.2.2"
 
+ajv@^6.10.2, ajv@^6.9.1:
+  version "6.10.2"
+  resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52"
+  integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==
+  dependencies:
+    fast-deep-equal "^2.0.1"
+    fast-json-stable-stringify "^2.0.0"
+    json-schema-traverse "^0.4.1"
+    uri-js "^4.2.2"
+
 ansi-escapes@^3.0.0, ansi-escapes@^3.2.0:
   version "3.2.0"
   resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
@@ -2188,14 +2212,29 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3:
     esrecurse "^4.1.0"
     estraverse "^4.1.1"
 
-eslint-utils@^1.3.0, eslint-utils@^1.3.1:
+eslint-scope@^5.0.0:
+  version "5.0.0"
+  resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
+  integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==
+  dependencies:
+    esrecurse "^4.1.0"
+    estraverse "^4.1.1"
+
+eslint-utils@^1.3.0:
   version "1.4.2"
   resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab"
   integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==
   dependencies:
     eslint-visitor-keys "^1.0.0"
 
-eslint-visitor-keys@^1.0.0:
+eslint-utils@^1.3.1, eslint-utils@^1.4.2:
+  version "1.4.3"
+  resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f"
+  integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==
+  dependencies:
+    eslint-visitor-keys "^1.1.0"
+
+eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
   version "1.1.0"
   resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
   integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==
@@ -2324,14 +2363,14 @@ esrecurse@^4.1.0:
     estraverse "^4.1.0"
 
 estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
-  version "4.2.0"
-  resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
-  integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=
+  version "4.3.0"
+  resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
+  integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
 
 esutils@^2.0.2:
-  version "2.0.2"
-  resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
-  integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=
+  version "2.0.3"
+  resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
+  integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
 
 etag@~1.8.1:
   version "1.8.1"
@@ -2943,7 +2982,7 @@ glob-to-regexp@^0.3.0:
   resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
   integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
 
-glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
+glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.4:
   version "7.1.4"
   resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
   integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
@@ -2955,6 +2994,18 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
     once "^1.3.0"
     path-is-absolute "^1.0.0"
 
+glob@^7.1.2, glob@^7.1.3:
+  version "7.1.5"
+  resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.5.tgz#6714c69bee20f3c3e64c4dd905553e532b40cdc0"
+  integrity sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==
+  dependencies:
+    fs.realpath "^1.0.0"
+    inflight "^1.0.4"
+    inherits "2"
+    minimatch "^3.0.4"
+    once "^1.3.0"
+    path-is-absolute "^1.0.0"
+
 [email protected]:
   version "2.0.0"
   resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780"
@@ -3354,9 +3405,9 @@ inquirer@^5.2.0:
     through "^2.3.6"
 
 inquirer@^6.2.2:
-  version "6.4.1"
-  resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.4.1.tgz#7bd9e5ab0567cd23b41b0180b68e0cfa82fc3c0b"
-  integrity sha512-/Jw+qPZx4EDYsaT6uz7F4GJRNFMRdKNeUZw3ZnKV8lyuUgz/YWRCSUAJMZSVhSq4Ec0R2oYnyi6b3d4JXcL5Nw==
+  version "6.5.2"
+  resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca"
+  integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==
   dependencies:
     ansi-escapes "^3.2.0"
     chalk "^2.4.2"
@@ -3364,7 +3415,7 @@ inquirer@^6.2.2:
     cli-width "^2.0.0"
     external-editor "^3.0.3"
     figures "^2.0.0"
-    lodash "^4.17.11"
+    lodash "^4.17.12"
     mute-stream "0.0.7"
     run-async "^2.2.0"
     rxjs "^6.4.0"
@@ -3577,7 +3628,7 @@ is-glob@^3.1.0:
   dependencies:
     is-extglob "^2.1.0"
 
-is-glob@^4.0.0:
+is-glob@^4.0.0, is-glob@^4.0.1:
   version "4.0.1"
   resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"
   integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==
@@ -4122,7 +4173,7 @@ lodash.uniq@^4.5.0:
   resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
   integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
 
-lodash@^4.0.0, lodash@^4.17.11:
+lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14:
   version "4.17.15"
   resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
   integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
@@ -6414,13 +6465,20 @@ rxjs@^5.5.2:
   dependencies:
     symbol-observable "1.0.1"
 
-rxjs@^6.3.3, rxjs@^6.4.0:
+rxjs@^6.3.3:
   version "6.5.2"
   resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7"
   integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==
   dependencies:
     tslib "^1.9.0"
 
+rxjs@^6.4.0:
+  version "6.5.3"
+  resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a"
+  integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==
+  dependencies:
+    tslib "^1.9.0"
+
 [email protected], safe-buffer@~5.1.0, safe-buffer@~5.1.1:
   version "5.1.2"
   resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -6462,17 +6520,12 @@ semver-compare@^1.0.0:
   resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
   integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
 
-"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
+"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.6.0:
   version "5.7.0"
   resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
   integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
 
[email protected]:
-  version "5.5.0"
-  resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
-  integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==
-
-semver@^5.1.0:
+semver@^5.1.0, semver@^5.5.0, semver@^5.5.1:
   version "5.7.1"
   resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
   integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
@@ -6482,6 +6535,11 @@ semver@^6.0.0:
   resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db"
   integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==
 
+semver@^6.3.0:
+  version "6.3.0"
+  resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
+  integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
+
 [email protected]:
   version "0.17.1"
   resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"
@@ -7045,12 +7103,12 @@ table@^4.0.3:
     string-width "^2.1.1"
 
 table@^5.2.3:
-  version "5.4.1"
-  resolved "https://registry.yarnpkg.com/table/-/table-5.4.1.tgz#0691ae2ebe8259858efb63e550b6d5f9300171e8"
-  integrity sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w==
+  version "5.4.6"
+  resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
+  integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==
   dependencies:
-    ajv "^6.9.1"
-    lodash "^4.17.11"
+    ajv "^6.10.2"
+    lodash "^4.17.14"
     slice-ansi "^2.1.0"
     string-width "^3.0.0"
 
@@ -7342,10 +7400,10 @@ tslib@^1.8.1, tslib@^1.9.0:
   resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
   integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
 
-tsutils@^3.7.0:
-  version "3.14.0"
-  resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.14.0.tgz#bf8d5a7bae5369331fa0f2b0a5a10bd7f7396c77"
-  integrity sha512-SmzGbB0l+8I0QwsPgjooFRaRvHLBLNYM8SeQ0k6rtNDru5sCGeLJcZdwilNndN+GysuFjF5EIYgN8GfFG6UeUw==
+tsutils@^3.17.1:
+  version "3.17.1"
+  resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
+  integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==
   dependencies:
     tslib "^1.8.1"