From 82af000a371eb74cddc16ed4ef025b7481c54c50 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Thu, 25 May 2023 03:09:17 +0200 Subject: [PATCH] chore: cleanup eslint suppressions (#38417) * chore: cleanup eslint suppressions * address feedback * revert script/lib/azput.js * revert spec/fixtures/apps/remote-control/main.js * address feedback * revert typings/internal-ambient.d.ts --- lib/asar/fs-wrapper.ts | 1 - .../api/auto-updater/squirrel-update-win.ts | 6 --- lib/browser/api/dialog.ts | 2 - lib/browser/api/web-contents.ts | 4 +- lib/browser/guest-view-manager.ts | 1 - lib/common/deprecate.ts | 3 +- lib/renderer/init.ts | 2 +- lib/renderer/web-view/web-view-element.ts | 4 +- lib/renderer/web-view/web-view-impl.ts | 2 - lib/worker/init.ts | 2 +- spec/api-browser-view-spec.ts | 3 +- spec/api-browser-window-spec.ts | 5 +-- spec/api-ipc-spec.ts | 3 +- spec/api-menu-spec.ts | 1 - spec/api-net-spec.ts | 6 --- spec/api-power-monitor-spec.ts | 1 - spec/api-session-spec.ts | 3 -- spec/api-utility-process-spec.ts | 8 ---- spec/asar-spec.ts | 12 ++--- .../fixtures/api/utility-process/exception.js | 2 +- .../webcontentsview-create-leak-exit/index.js | 3 +- .../worker-multiple-destroy/worklet.js | 3 +- spec/fixtures/extensions/chrome-i18n/main.js | 36 +++++++-------- .../extensions/chrome-runtime/main.js | 44 +++++++++---------- .../extensions/chrome-storage/main.js | 12 ++--- .../extensions/devtools-extension/foo.js | 4 +- .../extensions/devtools-extension/index.js | 4 +- .../lazy-background-page/background.js | 2 +- .../lazy-background-page/content_script.js | 2 +- .../persistent-background-page/background.js | 1 - spec/fixtures/module/preload-context.js | 2 +- spec/fixtures/module/preload-sandbox.js | 2 +- spec/fixtures/testsnap.js | 2 +- spec/node-spec.ts | 3 -- 34 files changed, 76 insertions(+), 115 deletions(-) diff --git a/lib/asar/fs-wrapper.ts b/lib/asar/fs-wrapper.ts index 2059dc447fe5..e4db56b0b811 100644 --- a/lib/asar/fs-wrapper.ts +++ b/lib/asar/fs-wrapper.ts @@ -574,7 +574,6 @@ export const wrapFsWithAsar = (fs: Record) => { }; const { readFile: readFilePromise } = fs.promises; - // eslint-disable-next-line @typescript-eslint/no-unused-vars fs.promises.readFile = function (pathArgument: string, options: any) { const pathInfo = splitPath(pathArgument); if (!pathInfo.isAsar) { diff --git a/lib/browser/api/auto-updater/squirrel-update-win.ts b/lib/browser/api/auto-updater/squirrel-update-win.ts index 800873082169..3f5735cfecd2 100644 --- a/lib/browser/api/auto-updater/squirrel-update-win.ts +++ b/lib/browser/api/auto-updater/squirrel-update-win.ts @@ -24,8 +24,6 @@ const spawnUpdate = function (args: string[], detached: boolean, callback: Funct // Process spawned, different args: Return with error // No process spawned: Spawn new process if (spawnedProcess && !isSameArgs(args)) { - // Disabled for backwards compatibility: - // eslint-disable-next-line standard/no-callback-literal return callback(`AutoUpdater process with arguments ${args} is already running`); } else if (!spawnedProcess) { spawnedProcess = spawn(updateExe, args, { @@ -66,8 +64,6 @@ const spawnUpdate = function (args: string[], detached: boolean, callback: Funct // Process terminated with error. if (code !== 0) { - // Disabled for backwards compatibility: - // eslint-disable-next-line standard/no-callback-literal return callback(`Command failed: ${signal ?? code}\n${stderr}`); } @@ -93,8 +89,6 @@ export function checkForUpdate (updateURL: string, callback: (error: Error | nul const json = stdout.trim().split('\n').pop(); update = (ref = JSON.parse(json!)) != null ? (ref1 = ref.releasesToApply) != null ? typeof ref1.pop === 'function' ? ref1.pop() : undefined : undefined : undefined; } catch { - // Disabled for backwards compatibility: - // eslint-disable-next-line standard/no-callback-literal return callback(new Error(`Invalid result:\n${stdout}`)); } return callback(null, update); diff --git a/lib/browser/api/dialog.ts b/lib/browser/api/dialog.ts index 4dc623dff092..c71fde0f86dc 100644 --- a/lib/browser/api/dialog.ts +++ b/lib/browser/api/dialog.ts @@ -237,8 +237,6 @@ const messageBox = (sync: boolean, window: BrowserWindow | null, options?: Messa } }; -// eat dirt, eslint -/* eslint-disable import/export */ export function showOpenDialog(window: BrowserWindow, options: OpenDialogOptions): OpenDialogReturnValue; export function showOpenDialog(options: OpenDialogOptions): OpenDialogReturnValue; export function showOpenDialog (windowOrOptions: BrowserWindow | OpenDialogOptions, maybeOptions?: OpenDialogOptions): OpenDialogReturnValue { diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index 88503a7e7282..23c655ce10e7 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -14,8 +14,8 @@ import * as deprecate from '@electron/internal/common/deprecate'; // session is not used here, the purpose is to make sure session is initialized // before the webContents module. -// eslint-disable-next-line -session +// eslint-disable-next-line no-unused-expressions +session; const webFrameMainBinding = process._linkedBinding('electron_browser_web_frame_main'); diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts index a43c9cacfbd6..03f786a30a00 100644 --- a/lib/browser/guest-view-manager.ts +++ b/lib/browser/guest-view-manager.ts @@ -96,7 +96,6 @@ const createGuest = function (embedder: Electron.WebContents, embedderFrameId: n return -1; } - // eslint-disable-next-line no-undef const guest = (webContents as typeof ElectronInternal.WebContents).create({ ...webPreferences, type: 'webview', diff --git a/lib/common/deprecate.ts b/lib/common/deprecate.ts index dc6d9d0eb981..5d71548561ad 100644 --- a/lib/common/deprecate.ts +++ b/lib/common/deprecate.ts @@ -81,7 +81,8 @@ export function event (emitter: NodeJS.EventEmitter, oldName: string, newName: s // remove a property with no replacement export function removeProperty(object: T, removedName: K, onlyForValues?: any[]): T { // if the property's already been removed, warn about it - const info = Object.getOwnPropertyDescriptor((object as any).__proto__, removedName) // eslint-disable-line + // eslint-disable-next-line no-proto + const info = Object.getOwnPropertyDescriptor((object as any).__proto__, removedName); if (!info) { log(`Unable to remove property '${removedName}' from an object that lacks it.`); return object; diff --git a/lib/renderer/init.ts b/lib/renderer/init.ts index 7047c4ffea92..c8fb8bcfb7e2 100644 --- a/lib/renderer/init.ts +++ b/lib/renderer/init.ts @@ -57,7 +57,7 @@ require('@electron/internal/renderer/common-init'); if (nodeIntegration) { // Export node bindings to global. - const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers') // eslint-disable-line + const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers'); global.module = new Module('electron/js2c/renderer_init'); global.require = makeRequireFunction(global.module); diff --git a/lib/renderer/web-view/web-view-element.ts b/lib/renderer/web-view/web-view-element.ts index 005c41ba2417..7d2dd14a3f32 100644 --- a/lib/renderer/web-view/web-view-element.ts +++ b/lib/renderer/web-view/web-view-element.ts @@ -86,9 +86,7 @@ const defineWebViewElement = (hooks: WebViewImplHooks) => { // Register custom element. const registerWebViewElement = (hooks: WebViewImplHooks) => { - // I wish eslint wasn't so stupid, but it is - // eslint-disable-next-line - const WebViewElement = defineWebViewElement(hooks) as unknown as typeof ElectronInternal.WebViewElement + const WebViewElement = defineWebViewElement(hooks) as unknown as typeof ElectronInternal.WebViewElement; setupMethods(WebViewElement, hooks); diff --git a/lib/renderer/web-view/web-view-impl.ts b/lib/renderer/web-view/web-view-impl.ts index d071a41abdb8..c83ec2e5868a 100644 --- a/lib/renderer/web-view/web-view-impl.ts +++ b/lib/renderer/web-view/web-view-impl.ts @@ -197,8 +197,6 @@ export class WebViewImpl { } } -// I wish eslint wasn't so stupid, but it is -// eslint-disable-next-line export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElement, hooks: WebViewImplHooks) => { // Focusing the webview should move page focus to the underlying iframe. WebViewElement.prototype.focus = function () { diff --git a/lib/worker/init.ts b/lib/worker/init.ts index 5c537892caa3..a72f643c8ac4 100644 --- a/lib/worker/init.ts +++ b/lib/worker/init.ts @@ -16,7 +16,7 @@ require('@electron/internal/common/init'); const { hasSwitch, getSwitchValue } = process._linkedBinding('electron_common_command_line'); // Export node bindings to global. -const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers') // eslint-disable-line +const { makeRequireFunction } = __non_webpack_require__('internal/modules/cjs/helpers'); global.module = new Module('electron/js2c/worker_init'); global.require = makeRequireFunction(global.module); diff --git a/spec/api-browser-view-spec.ts b/spec/api-browser-view-spec.ts index d485be567edf..0099d85c338b 100644 --- a/spec/api-browser-view-spec.ts +++ b/spec/api-browser-view-spec.ts @@ -321,7 +321,8 @@ describe('BrowserView module', () => { const rc = await startRemoteControlApp(); await rc.remotely(() => { const { BrowserView, app } = require('electron'); - new BrowserView({}) // eslint-disable-line + // eslint-disable-next-line no-new + new BrowserView({}); setTimeout(() => { app.quit(); }); diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 76a18a060cff..cc0267e1173e 100644 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -84,7 +84,6 @@ describe('BrowserWindow module', () => { it('window does not get garbage collected when opened', async () => { const w = new BrowserWindow({ show: false }); // Keep a weak reference to the window. - // eslint-disable-next-line no-undef const wr = new WeakRef(w); await setTimeout(); // Do garbage collection, since |w| is not referenced in this closure @@ -3158,15 +3157,15 @@ describe('BrowserWindow module', () => { afterEach(closeAllWindows); it('can be set on a window', () => { expect(() => { - /* eslint-disable no-new */ + /* eslint-disable-next-line no-new */ new BrowserWindow({ tabbingIdentifier: 'group1' }); + /* eslint-disable-next-line no-new */ new BrowserWindow({ tabbingIdentifier: 'group2', frame: false }); - /* eslint-enable no-new */ }).not.to.throw(); }); }); diff --git a/spec/api-ipc-spec.ts b/spec/api-ipc-spec.ts index ec8df285e765..c2befb323ca9 100644 --- a/spec/api-ipc-spec.ts +++ b/spec/api-ipc-spec.ts @@ -113,8 +113,7 @@ describe('ipc module', () => { }); it('throws an error in the renderer if the reply callback is dropped', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - ipcMain.handleOnce('test', () => new Promise(resolve => { + ipcMain.handleOnce('test', () => new Promise(() => { setTimeout(() => v8Util.requestGarbageCollectionForTesting()); /* never resolve */ })); diff --git a/spec/api-menu-spec.ts b/spec/api-menu-spec.ts index 5bcdbc515a6d..824d5117a2af 100644 --- a/spec/api-menu-spec.ts +++ b/spec/api-menu-spec.ts @@ -859,7 +859,6 @@ describe('Menu module', function () { menu.popup({ window: w }); // Keep a weak reference to the menu. - // eslint-disable-next-line no-undef const wr = new WeakRef(menu); await setTimeout(); diff --git a/spec/api-net-spec.ts b/spec/api-net-spec.ts index c38d80bf0970..7560f989e8df 100644 --- a/spec/api-net-spec.ts +++ b/spec/api-net-spec.ts @@ -1336,8 +1336,6 @@ describe('net module', () => { (details, callback) => { if (details.url === `${serverUrl}${requestUrl}`) { requestIsIntercepted = true; - // Disabled due to false positive in StandardJS - // eslint-disable-next-line standard/no-callback-literal callback({ redirectURL: `${serverUrl}${redirectUrl}` }); @@ -1375,8 +1373,6 @@ describe('net module', () => { customSession.webRequest.onBeforeRequest((details, callback) => { if (details.url === `${serverUrl}${requestUrl}`) { requestIsIntercepted = true; - // Disabled due to false positive in StandardJS - // eslint-disable-next-line standard/no-callback-literal callback({ redirectURL: `${serverUrl}${redirectUrl}` }); @@ -1416,8 +1412,6 @@ describe('net module', () => { customSession.webRequest.onBeforeRequest((details, callback) => { if (details.url === `${serverUrl}${requestUrl}`) { requestIsIntercepted = true; - // Disabled due to false positive in StandardJS - // eslint-disable-next-line standard/no-callback-literal callback({ redirectURL: `${serverUrl}${redirectUrl}` }); diff --git a/spec/api-power-monitor-spec.ts b/spec/api-power-monitor-spec.ts index 9fda9528465e..485b5f62e5e9 100644 --- a/spec/api-power-monitor-spec.ts +++ b/spec/api-power-monitor-spec.ts @@ -141,7 +141,6 @@ describe('powerMonitor', () => { }); describe('when powerMonitor module is loaded', () => { - // eslint-disable-next-line no-undef let powerMonitor: typeof Electron.powerMonitor; before(() => { powerMonitor = require('electron').powerMonitor; diff --git a/spec/api-session-spec.ts b/spec/api-session-spec.ts index 07b10e5666e4..7b4c5ed2951a 100644 --- a/spec/api-session-spec.ts +++ b/spec/api-session-spec.ts @@ -12,9 +12,6 @@ import { defer, listen } from './lib/spec-helpers'; import { once } from 'events'; import { setTimeout } from 'timers/promises'; -/* The whole session API doesn't use standard callbacks */ -/* eslint-disable standard/no-callback-literal */ - describe('session module', () => { const fixtures = path.resolve(__dirname, 'fixtures'); const url = 'http://127.0.0.1'; diff --git a/spec/api-utility-process-spec.ts b/spec/api-utility-process-spec.ts index 9d7f81eeefe3..1c24a7a1c077 100644 --- a/spec/api-utility-process-spec.ts +++ b/spec/api-utility-process-spec.ts @@ -13,41 +13,33 @@ describe('utilityProcess module', () => { describe('UtilityProcess constructor', () => { it('throws when empty script path is provided', async () => { expect(() => { - /* eslint-disable no-new */ utilityProcess.fork(''); - /* eslint-disable no-new */ }).to.throw(); }); it('throws when options.stdio is not valid', async () => { expect(() => { - /* eslint-disable no-new */ utilityProcess.fork(path.join(fixturesPath, 'empty.js'), [], { execArgv: ['--test', '--test2'], serviceName: 'test', stdio: 'ipc' }); - /* eslint-disable no-new */ }).to.throw(/stdio must be of the following values: inherit, pipe, ignore/); expect(() => { - /* eslint-disable no-new */ utilityProcess.fork(path.join(fixturesPath, 'empty.js'), [], { execArgv: ['--test', '--test2'], serviceName: 'test', stdio: ['ignore', 'ignore'] }); - /* eslint-disable no-new */ }).to.throw(/configuration missing for stdin, stdout or stderr/); expect(() => { - /* eslint-disable no-new */ utilityProcess.fork(path.join(fixturesPath, 'empty.js'), [], { execArgv: ['--test', '--test2'], serviceName: 'test', stdio: ['pipe', 'inherit', 'inherit'] }); - /* eslint-disable no-new */ }).to.throw(/stdin value other than ignore is not supported/); }); }); diff --git a/spec/asar-spec.ts b/spec/asar-spec.ts index 1035259c3136..92cf07164bff 100644 --- a/spec/asar-spec.ts +++ b/spec/asar-spec.ts @@ -1111,29 +1111,25 @@ describe('asar package', function () { describe('fs.exists', function () { itremote('handles an existing file', async function () { const p = path.join(asarDir, 'a.asar', 'file1'); - // eslint-disable-next-line - const exists = await new Promise(resolve => fs.exists(p, resolve)) + const exists = await new Promise(resolve => fs.exists(p, resolve)); expect(exists).to.be.true(); }); itremote('handles a non-existent file', async function () { const p = path.join(asarDir, 'a.asar', 'not-exist'); - // eslint-disable-next-line - const exists = await new Promise(resolve => fs.exists(p, resolve)) + const exists = await new Promise(resolve => fs.exists(p, resolve)); expect(exists).to.be.false(); }); itremote('promisified version handles an existing file', async () => { const p = path.join(asarDir, 'a.asar', 'file1'); - // eslint-disable-next-line - const exists = await require('util').promisify(fs.exists)(p) + const exists = await require('util').promisify(fs.exists)(p); expect(exists).to.be.true(); }); itremote('promisified version handles a non-existent file', async function () { const p = path.join(asarDir, 'a.asar', 'not-exist'); - // eslint-disable-next-line - const exists = await require('util').promisify(fs.exists)(p) + const exists = await require('util').promisify(fs.exists)(p); expect(exists).to.be.false(); }); }); diff --git a/spec/fixtures/api/utility-process/exception.js b/spec/fixtures/api/utility-process/exception.js index 5f3b3af5ac84..e6f79525dcba 100644 --- a/spec/fixtures/api/utility-process/exception.js +++ b/spec/fixtures/api/utility-process/exception.js @@ -1 +1 @@ -nonExistingFunc(); // eslint-disable-line +nonExistingFunc(); // eslint-disable-line no-undef diff --git a/spec/fixtures/crash-cases/webcontentsview-create-leak-exit/index.js b/spec/fixtures/crash-cases/webcontentsview-create-leak-exit/index.js index 3211bfd40b00..c21e6f7266a7 100644 --- a/spec/fixtures/crash-cases/webcontentsview-create-leak-exit/index.js +++ b/spec/fixtures/crash-cases/webcontentsview-create-leak-exit/index.js @@ -1,6 +1,7 @@ const { WebContentsView, app } = require('electron'); app.whenReady().then(function () { - new WebContentsView({}) // eslint-disable-line + // eslint-disable-next-line no-new + new WebContentsView({}); app.quit(); }); diff --git a/spec/fixtures/crash-cases/worker-multiple-destroy/worklet.js b/spec/fixtures/crash-cases/worker-multiple-destroy/worklet.js index 61e24a06021e..47ff1456f5db 100644 --- a/spec/fixtures/crash-cases/worker-multiple-destroy/worklet.js +++ b/spec/fixtures/crash-cases/worker-multiple-destroy/worklet.js @@ -1,3 +1,5 @@ +/* global registerPaint */ + class CheckerboardPainter { paint (ctx, geom, properties) { const colors = ['red', 'green', 'blue']; @@ -14,5 +16,4 @@ class CheckerboardPainter { } } -// eslint-disable-next-line no-undef registerPaint('checkerboard', CheckerboardPainter); diff --git a/spec/fixtures/extensions/chrome-i18n/main.js b/spec/fixtures/extensions/chrome-i18n/main.js index 77657ebf4e38..7508b056a2da 100644 --- a/spec/fixtures/extensions/chrome-i18n/main.js +++ b/spec/fixtures/extensions/chrome-i18n/main.js @@ -1,33 +1,33 @@ -/* eslint-disable */ +/* global chrome */ -function evalInMainWorld(fn) { - const script = document.createElement('script') - script.textContent = `((${fn})())` - document.documentElement.appendChild(script) +function evalInMainWorld (fn) { + const script = document.createElement('script'); + script.textContent = `((${fn})())`; + document.documentElement.appendChild(script); } -async function exec(name) { - let result +async function exec (name) { + let result; switch (name) { case 'getMessage': result = { id: chrome.i18n.getMessage('@@extension_id'), - name: chrome.i18n.getMessage('extName'), - } - break + name: chrome.i18n.getMessage('extName') + }; + break; case 'getAcceptLanguages': - result = await new Promise(resolve => chrome.i18n.getAcceptLanguages(resolve)) - break + result = await new Promise(resolve => chrome.i18n.getAcceptLanguages(resolve)); + break; } - const funcStr = `() => { require('electron').ipcRenderer.send('success', ${JSON.stringify(result)}) }` - evalInMainWorld(funcStr) + const funcStr = `() => { require('electron').ipcRenderer.send('success', ${JSON.stringify(result)}) }`; + evalInMainWorld(funcStr); } window.addEventListener('message', event => { - exec(event.data.name) -}) + exec(event.data.name); +}); evalInMainWorld(() => { - window.exec = name => window.postMessage({ name }) -}) + window.exec = name => window.postMessage({ name }); +}); diff --git a/spec/fixtures/extensions/chrome-runtime/main.js b/spec/fixtures/extensions/chrome-runtime/main.js index c830b951dddb..f1e0f8da9a90 100644 --- a/spec/fixtures/extensions/chrome-runtime/main.js +++ b/spec/fixtures/extensions/chrome-runtime/main.js @@ -1,39 +1,39 @@ -/* eslint-disable */ +/* global chrome */ -function evalInMainWorld(fn) { - const script = document.createElement('script') - script.textContent = `((${fn})())` - document.documentElement.appendChild(script) +function evalInMainWorld (fn) { + const script = document.createElement('script'); + script.textContent = `((${fn})())`; + document.documentElement.appendChild(script); } -async function exec(name) { - let result +async function exec (name) { + let result; switch (name) { case 'getManifest': - result = chrome.runtime.getManifest() - break + result = chrome.runtime.getManifest(); + break; case 'id': - result = chrome.runtime.id - break + result = chrome.runtime.id; + break; case 'getURL': - result = chrome.runtime.getURL('main.js') - break + result = chrome.runtime.getURL('main.js'); + break; case 'getPlatformInfo': { result = await new Promise(resolve => { - chrome.runtime.sendMessage(name, resolve) - }) - break + chrome.runtime.sendMessage(name, resolve); + }); + break; } } - const funcStr = `() => { require('electron').ipcRenderer.send('success', ${JSON.stringify(result)}) }` - evalInMainWorld(funcStr) + const funcStr = `() => { require('electron').ipcRenderer.send('success', ${JSON.stringify(result)}) }`; + evalInMainWorld(funcStr); } window.addEventListener('message', event => { - exec(event.data.name) -}) + exec(event.data.name); +}); evalInMainWorld(() => { - window.exec = name => window.postMessage({ name }) -}) + window.exec = name => window.postMessage({ name }); +}); diff --git a/spec/fixtures/extensions/chrome-storage/main.js b/spec/fixtures/extensions/chrome-storage/main.js index b8804809d95f..dbe26e6f0e32 100644 --- a/spec/fixtures/extensions/chrome-storage/main.js +++ b/spec/fixtures/extensions/chrome-storage/main.js @@ -1,8 +1,8 @@ -/* eslint-disable */ +/* global chrome */ 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) - }) -}) + const script = document.createElement('script'); + script.textContent = `require('electron').ipcRenderer.send('storage-success', ${JSON.stringify(key)})`; + document.documentElement.appendChild(script); + }); +}); diff --git a/spec/fixtures/extensions/devtools-extension/foo.js b/spec/fixtures/extensions/devtools-extension/foo.js index 3196c3e4ab40..30ba014abc5c 100644 --- a/spec/fixtures/extensions/devtools-extension/foo.js +++ b/spec/fixtures/extensions/devtools-extension/foo.js @@ -1,2 +1,2 @@ -// eslint-disable-next-line -chrome.devtools.panels.create('Foo', 'icon.png', 'index.html') +/* global chrome */ +chrome.devtools.panels.create('Foo', 'icon.png', 'index.html'); diff --git a/spec/fixtures/extensions/devtools-extension/index.js b/spec/fixtures/extensions/devtools-extension/index.js index 0cd6e38ed956..ff0c1cb69c45 100644 --- a/spec/fixtures/extensions/devtools-extension/index.js +++ b/spec/fixtures/extensions/devtools-extension/index.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line -chrome.devtools.inspectedWindow.eval(`require("electron").ipcRenderer.send("winning")`, (result, exc) => { +/* global chrome */ +chrome.devtools.inspectedWindow.eval('require("electron").ipcRenderer.send("winning")', (result, exc) => { console.log(result, exc); }); diff --git a/spec/fixtures/extensions/lazy-background-page/background.js b/spec/fixtures/extensions/lazy-background-page/background.js index 5fcd9fdad481..a954e7fa882e 100644 --- a/spec/fixtures/extensions/lazy-background-page/background.js +++ b/spec/fixtures/extensions/lazy-background-page/background.js @@ -1,4 +1,4 @@ -/* eslint-disable no-undef */ +/* global chrome */ chrome.runtime.onMessage.addListener((message, sender, reply) => { window.receivedMessage = message; reply({ message, sender }); diff --git a/spec/fixtures/extensions/lazy-background-page/content_script.js b/spec/fixtures/extensions/lazy-background-page/content_script.js index f8f0bf6f8a51..938c908e44a2 100644 --- a/spec/fixtures/extensions/lazy-background-page/content_script.js +++ b/spec/fixtures/extensions/lazy-background-page/content_script.js @@ -1,4 +1,4 @@ -/* eslint-disable no-undef */ +/* global chrome */ chrome.runtime.sendMessage({ some: 'message' }, (response) => { const script = document.createElement('script'); script.textContent = `require('electron').ipcRenderer.send('bg-page-message-response', ${JSON.stringify(response)})`; diff --git a/spec/fixtures/extensions/persistent-background-page/background.js b/spec/fixtures/extensions/persistent-background-page/background.js index 2a49b2bd9e68..e69de29bb2d1 100644 --- a/spec/fixtures/extensions/persistent-background-page/background.js +++ b/spec/fixtures/extensions/persistent-background-page/background.js @@ -1 +0,0 @@ -/* eslint-disable no-undef */ diff --git a/spec/fixtures/module/preload-context.js b/spec/fixtures/module/preload-context.js index 4dbc3a9a58d3..8dca8a018ecb 100644 --- a/spec/fixtures/module/preload-context.js +++ b/spec/fixtures/module/preload-context.js @@ -1,4 +1,4 @@ -var test = 'test' // eslint-disable-line +var test = 'test'; // eslint-disable-line no-var const types = { require: typeof require, diff --git a/spec/fixtures/module/preload-sandbox.js b/spec/fixtures/module/preload-sandbox.js index d774c54301f3..051754c75b16 100644 --- a/spec/fixtures/module/preload-sandbox.js +++ b/spec/fixtures/module/preload-sandbox.js @@ -52,7 +52,7 @@ ipcRenderer.on('touch-the-opener', () => { let errorMessage = null; try { - const openerDoc = opener.document; // eslint-disable-line no-unused-vars + const openerDoc = opener.document; } catch (error) { errorMessage = error.message; } diff --git a/spec/fixtures/testsnap.js b/spec/fixtures/testsnap.js index 3ac89c522a8b..c6e1bd0a2c2e 100644 --- a/spec/fixtures/testsnap.js +++ b/spec/fixtures/testsnap.js @@ -1,3 +1,3 @@ // taken from https://chromium.googlesource.com/v8/v8.git/+/HEAD/test/cctest/test-serialize.cc#1127 -function f () { return g() * 2; } // eslint-disable-line no-unused-vars +function f () { return g() * 2; } function g () { return 43; } diff --git a/spec/node-spec.ts b/spec/node-spec.ts index 47991c2177ae..eac32fa0d7d1 100644 --- a/spec/node-spec.ts +++ b/spec/node-spec.ts @@ -200,7 +200,6 @@ describe('node feature', () => { emitter.on(eventName, listener); }); - // eslint-disable-next-line standard/no-callback-literal callback(...args); }); }; @@ -422,9 +421,7 @@ describe('node feature', () => { // Needed to test specific DiffieHellman ctors. - // eslint-disable-next-line no-octal crypto.createDiffieHellman('abc', Buffer.from([2])); - // eslint-disable-next-line no-octal crypto.createDiffieHellman('abc', '123'); });