Browse Source

avoid using eslint comment exceptions

Zeke Sikelianos 9 years ago
parent
commit
b5afad9da7

+ 3 - 3
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))
   })
 

+ 2 - 2
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)

+ 3 - 3
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.')
     })
   })

+ 1 - 4
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'
       }

+ 1 - 1
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')
     })