avoid using eslint comment exceptions

This commit is contained in:
Zeke Sikelianos 2016-03-30 14:06:50 -07:00 committed by Kevin Sawicki
parent 1a18151eff
commit b5afad9da7
5 changed files with 10 additions and 13 deletions

View file

@ -128,14 +128,14 @@ let wrapWebContents = function (webContents) {
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args)) return ipcMain.emit.apply(ipcMain, [channel, event].concat(args))
}) })
webContents.on('ipc-message-sync', function (event, [channel, ...args]) { webContents.on('ipc-message-sync', function (event, [channel, ...args]) {
/* eslint-disable */
// standard complains: Getter is not present
Object.defineProperty(event, 'returnValue', { Object.defineProperty(event, 'returnValue', {
set: function (value) { set: function (value) {
return event.sendReply(JSON.stringify(value)) return event.sendReply(JSON.stringify(value))
},
get: function () {
return undefined
} }
}) })
/* eslint-enable */
return ipcMain.emit.apply(ipcMain, [channel, event].concat(args)) return ipcMain.emit.apply(ipcMain, [channel, event].concat(args))
}) })

View file

@ -281,7 +281,7 @@ ipcMain.on('ATOM_BROWSER_CONSTRUCTOR', function (event, id, args) {
// Call new with array of arguments. // Call new with array of arguments.
// http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible // 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) event.returnValue = valueToMeta(event.sender, obj)
} catch (error) { } catch (error) {
event.returnValue = exceptionToMeta(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] let constructor = objectsRegistry.get(id)[method]
// Call new with array of arguments. // 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) event.returnValue = valueToMeta(event.sender, obj)
} catch (error) { } catch (error) {
event.returnValue = exceptionToMeta(error) event.returnValue = exceptionToMeta(error)

View file

@ -759,19 +759,19 @@ describe('browser-window module', function () {
describe('deprecated options', function () { describe('deprecated options', function () {
it('throws a deprecation error for option keys using hyphens instead of camel case', function () { it('throws a deprecation error for option keys using hyphens instead of camel case', function () {
assert.throws(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.') }, 'min-width is deprecated. Use minWidth instead.')
}) })
it('throws a deprecation error for webPreference keys using hyphens instead of camel case', function () { it('throws a deprecation error for webPreference keys using hyphens instead of camel case', function () {
assert.throws(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.') }, 'node-integration is deprecated. Use nodeIntegration instead.')
}) })
it('throws a deprecation error for option keys that should be set on webPreferences', function () { it('throws a deprecation error for option keys that should be set on webPreferences', function () {
assert.throws(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.') }, 'options.zoomFactor is deprecated. Use options.webPreferences.zoomFactor instead.')
}) })
}) })

View file

@ -82,16 +82,13 @@ describe('debugger module', function () {
} catch (err) { } catch (err) {
return done('unexpected error : ' + 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) { var callback = function (err, res) {
assert(!err.message)
assert(!res.wasThrown) assert(!res.wasThrown)
assert.equal(res.result.value, 6) assert.equal(res.result.value, 6)
w.webContents.debugger.detach() w.webContents.debugger.detach()
done() done()
} }
/* eslint-enable */
const params = { const params = {
'expression': '4+2' 'expression': '4+2'
} }

View file

@ -60,7 +60,7 @@ describe('ipc module', function () {
it('can construct an object from its member', function () { it('can construct an object from its member', function () {
var call = remote.require(path.join(fixtures, 'module', 'call.js')) 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') assert.equal(obj.test, 'test')
}) })