From b5afad9da707b7ba597b72d067d4ffbeb86cf4f5 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 30 Mar 2016 14:06:50 -0700 Subject: [PATCH] avoid using eslint comment exceptions --- lib/browser/api/web-contents.js | 6 +++--- lib/browser/rpc-server.js | 4 ++-- spec/api-browser-window-spec.js | 6 +++--- spec/api-debugger-spec.js | 5 +---- spec/api-ipc-spec.js | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index ef3d703dee7f..2ec7c14bae11 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -128,14 +128,14 @@ let wrapWebContents = function (webContents) { return ipcMain.emit.apply(ipcMain, [channel, event].concat(args)) }) webContents.on('ipc-message-sync', function (event, [channel, ...args]) { - /* eslint-disable */ - // standard complains: Getter is not present Object.defineProperty(event, 'returnValue', { set: function (value) { return event.sendReply(JSON.stringify(value)) + }, + get: function () { + return undefined } }) - /* eslint-enable */ return ipcMain.emit.apply(ipcMain, [channel, event].concat(args)) }) diff --git a/lib/browser/rpc-server.js b/lib/browser/rpc-server.js index eb1d0385fa15..79a52b132626 100644 --- a/lib/browser/rpc-server.js +++ b/lib/browser/rpc-server.js @@ -281,7 +281,7 @@ ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function (event, id, args) { // Call new with array of arguments. // http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible - let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) // eslint-disable-line + let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) event.returnValue = valueToMeta(event.sender, obj) } catch (error) { event.returnValue = exceptionToMeta(error) @@ -304,7 +304,7 @@ ipcMain.on('ATOM_BROWSER_MEMBER_CONSTRUCTOR', function (event, id, method, args) let constructor = objectsRegistry.get(id)[method] // Call new with array of arguments. - let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) // eslint-disable-line + let obj = new (Function.prototype.bind.apply(constructor, [null].concat(args))) event.returnValue = valueToMeta(event.sender, obj) } catch (error) { event.returnValue = exceptionToMeta(error) diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index a5b14c174253..468586eb7bb8 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -759,19 +759,19 @@ describe('browser-window module', function () { describe('deprecated options', function () { it('throws a deprecation error for option keys using hyphens instead of camel case', function () { assert.throws(function () { - new BrowserWindow({'min-width': 500}) // eslint-disable-line + return new BrowserWindow({'min-width': 500}) }, 'min-width is deprecated. Use minWidth instead.') }) it('throws a deprecation error for webPreference keys using hyphens instead of camel case', function () { assert.throws(function () { - new BrowserWindow({webPreferences: {'node-integration': false}}) // eslint-disable-line + return new BrowserWindow({webPreferences: {'node-integration': false}}) }, 'node-integration is deprecated. Use nodeIntegration instead.') }) it('throws a deprecation error for option keys that should be set on webPreferences', function () { assert.throws(function () { - new BrowserWindow({zoomFactor: 1}) // eslint-disable-line + return new BrowserWindow({zoomFactor: 1}) }, 'options.zoomFactor is deprecated. Use options.webPreferences.zoomFactor instead.') }) }) diff --git a/spec/api-debugger-spec.js b/spec/api-debugger-spec.js index 634d965a85fe..27aacc7671cf 100644 --- a/spec/api-debugger-spec.js +++ b/spec/api-debugger-spec.js @@ -82,16 +82,13 @@ describe('debugger module', function () { } catch (err) { return done('unexpected error : ' + err) } - /* eslint-disable */ - // standard expects callback errors to be handled, - // but for some reason this err is not actually null.. var callback = function (err, res) { + assert(!err.message) assert(!res.wasThrown) assert.equal(res.result.value, 6) w.webContents.debugger.detach() done() } - /* eslint-enable */ const params = { 'expression': '4+2' } diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index 0b279ef7266e..be4f788fb0d0 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -60,7 +60,7 @@ describe('ipc module', function () { it('can construct an object from its member', function () { var call = remote.require(path.join(fixtures, 'module', 'call.js')) - var obj = new call.constructor // eslint-disable-line + var obj = new call.constructor() assert.equal(obj.test, 'test') })