standardize by hand
authorZeke Sikelianos <zeke@sikelianos.com>
Tue, 29 Mar 2016 00:35:49 +0000 (17:35 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Thu, 31 Mar 2016 00:00:33 +0000 (17:00 -0700)
13 files changed:
lib/browser/api/navigation-controller.js
lib/browser/api/web-contents.js
lib/browser/init.js
lib/common/api/callbacks-registry.js
lib/common/api/deprecate.js
lib/common/asar.js
lib/renderer/api/ipc.js
lib/renderer/api/remote.js
lib/renderer/init.js
lib/renderer/override.js
lib/renderer/web-view/web-view-attributes.js
lib/renderer/web-view/web-view.js
spec/api-app-spec.js

index 21d885c..d9dedc9 100644 (file)
@@ -5,12 +5,12 @@ const ipcMain = require('electron').ipcMain
 // The history operation in renderer is redirected to browser.
 ipcMain.on('ATOM_SHELL_NAVIGATION_CONTROLLER', function (event, method, ...args) {
   var ref
-  return (ref = event.sender)[method].apply(ref, args)
+  (ref = event.sender)[method].apply(ref, args)
 })
 
 ipcMain.on('ATOM_SHELL_SYNC_NAVIGATION_CONTROLLER', function (event, method, ...args) {
   var ref
-  return event.returnValue = (ref = event.sender)[method].apply(ref, args)
+  event.returnValue = (ref = event.sender)[method].apply(ref, args)
 })
 
 // JavaScript implementation of Chromium's NavigationController.
@@ -41,10 +41,10 @@ var NavigationController = (function () {
         // Go to index.
         this.currentIndex = this.pendingIndex
         this.pendingIndex = -1
-        return this.history[this.currentIndex] = url
+        this.history[this.currentIndex] = url
       } else if (replaceEntry) {
         // Non-user initialized navigation.
-        return this.history[this.currentIndex] = url
+        this.history[this.currentIndex] = url
       } else {
         // Normal navigation. Clear history.
         this.history = this.history.slice(0, this.currentIndex + 1)
@@ -111,7 +111,7 @@ var NavigationController = (function () {
     this.history = []
     this.currentIndex = -1
     this.pendingIndex = -1
-    return this.inPageIndex = -1
+    this.inPageIndex = -1
   }
 
   NavigationController.prototype.goBack = function () {
index acdd8da..9187c87 100644 (file)
@@ -87,7 +87,7 @@ let wrapWebContents = function (webContents) {
     method = ref1[name]
     if (method instanceof Function) {
       (function (name, method) {
-        return webContents[name] = function () {
+        webContents[name] = function () {
           return method.apply(controller, arguments)
         }
       })(name, method)
@@ -104,8 +104,7 @@ let wrapWebContents = function (webContents) {
   const asyncWebFrameMethods = function (requestId, method, callback, ...args) {
     this.send('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', requestId, method, args)
     ipcMain.once(`ELECTRON_INTERNAL_BROWSER_ASYNC_WEB_FRAME_RESPONSE_${requestId}`, function (event, result) {
-      if (callback)
-        callback(result)
+      if (callback) callback(result)
     })
   }
 
@@ -117,10 +116,11 @@ let wrapWebContents = function (webContents) {
       callback = hasUserGesture
       hasUserGesture = false
     }
-    if (this.getURL() && !this.isLoading())
+    if (this.getURL() && !this.isLoading()) {
       return asyncWebFrameMethods.call(this, requestId, 'executeJavaScript', callback, code, hasUserGesture)
-    else
+    } else {
       return this.once('did-finish-load', asyncWebFrameMethods.bind(this, requestId, 'executeJavaScript', callback, code, hasUserGesture))
+    }
   }
 
   // Dispatch IPC messages to the ipc module.
@@ -128,11 +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))
       }
     })
+    /* eslint-enable */
     return ipcMain.emit.apply(ipcMain, [channel, event].concat(args))
   })
 
index ad871cd..d04b174 100644 (file)
@@ -46,7 +46,7 @@ if (process.platform === 'win32') {
 
   // Always returns EOF for stdin stream.
   var Readable = require('stream').Readable
-  var stdin = new Readable
+  var stdin = new Readable()
   stdin.push(null)
   process.__defineGetter__('stdin', function () {
     return stdin
index c8b8579..3e71899 100644 (file)
@@ -20,7 +20,7 @@ class CallbacksRegistry {
     // Capture the location of the function and put it in the ID string,
     // so that release errors can be tracked down easily.
     regexp = /at (.*)/gi
-    stackString = (new Error).stack
+    stackString = (new Error()).stack
     while ((match = regexp.exec(stackString)) !== null) {
       location = match[1]
       if (location.indexOf('(native)') !== -1) {
index f272915..ff34a2b 100644 (file)
@@ -23,9 +23,9 @@ deprecate.rename = function (object, oldName, newName) {
     return this[newName].apply(this, arguments)
   }
   if (typeof object === 'function') {
-    return object.prototype[oldName] = newMethod
+    object.prototype[oldName] = newMethod
   } else {
-    return object[oldName] = newMethod
+    object[oldName] = newMethod
   }
 }
 
@@ -33,7 +33,7 @@ deprecate.rename = function (object, oldName, newName) {
 deprecate.member = function (object, method, member) {
   var warned
   warned = false
-  return object.prototype[method] = function () {
+  object.prototype[method] = function () {
     if (!(warned || process.noDeprecation)) {
       warned = true
       deprecate.warn(method, member + '.' + method)
index dbf5670..f79075c 100644 (file)
@@ -1,4 +1,4 @@
-/* globals $, xit */
+/* globals $ */
 
 (function () {
   const asar = process.binding('atom_common_asar')
index bda68f7..25519a3 100644 (file)
@@ -6,7 +6,7 @@ const EventEmitter = require('events').EventEmitter
 deprecate.warn('ipc module', 'require("electron").ipcRenderer')
 
 // Routes events of ipcRenderer.
-var ipc = new EventEmitter
+var ipc = new EventEmitter()
 
 ipcRenderer.emit = function (channel, event, ...args) {
   ipc.emit.apply(ipc, [channel].concat(args))
index 0028a61..5f60a97 100644 (file)
@@ -5,11 +5,11 @@ const CallbacksRegistry = require('electron').CallbacksRegistry
 const v8Util = process.atomBinding('v8_util')
 const IDWeakMap = process.atomBinding('id_weak_map').IDWeakMap
 
-const callbacksRegistry = new CallbacksRegistry
+const callbacksRegistry = new CallbacksRegistry()
 
 var includes = [].includes
 
-var remoteObjectCache = new IDWeakMap
+var remoteObjectCache = new IDWeakMap()
 
 // Check for circular reference.
 var isCircular = function (field, visited) {
@@ -48,7 +48,7 @@ var wrapArgs = function (args, visited) {
     } else if ((value != null ? value.constructor.name : void 0) === 'Promise') {
       return {
         type: 'promise',
-        then: valueToMeta(function (v) { value.then(v); })
+        then: valueToMeta(function (v) { value.then(v) })
       }
     } else if ((value != null) && typeof value === 'object' && v8Util.getHiddenValue(value, 'atomId')) {
       return {
@@ -94,8 +94,7 @@ var wrapArgs = function (args, visited) {
 // This matches |getObjectMemebers| in rpc-server.
 let setObjectMembers = function (object, metaId, members) {
   for (let member of members) {
-    if (object.hasOwnProperty(member.name))
-      continue
+    if (object.hasOwnProperty(member.name)) continue
 
     let descriptor = { enumerable: member.enumerable }
     if (member.type === 'method') {
@@ -134,8 +133,7 @@ let setObjectMembers = function (object, metaId, members) {
 // Populate object's prototype from descriptor.
 // This matches |getObjectPrototype| in rpc-server.
 let setObjectPrototype = function (object, metaId, descriptor) {
-  if (descriptor === null)
-    return
+  if (descriptor === null) return
   let proto = {}
   setObjectMembers(proto, metaId, descriptor.members)
   setObjectPrototype(proto, metaId, descriptor.proto)
@@ -169,8 +167,7 @@ let metaToValue = function (meta) {
     case 'exception':
       throw new Error(meta.message + '\n' + meta.stack)
     default:
-      if (remoteObjectCache.has(meta.id))
-        return remoteObjectCache.get(meta.id)
+      if (remoteObjectCache.has(meta.id)) return remoteObjectCache.get(meta.id)
 
       if (meta.type === 'function') {
         // A shadow class to represent the remote function object.
@@ -220,7 +217,7 @@ var metaToPlainObject = function (meta) {
   obj = (function () {
     switch (meta.type) {
       case 'error':
-        return new Error
+        return new Error()
       default:
         return {}
     }
index 511f9e5..a005261 100644 (file)
@@ -26,7 +26,7 @@ globalPaths.push(path.join(__dirname, 'api', 'exports'))
 // The global variable will be used by ipc for event dispatching
 var v8Util = process.atomBinding('v8_util')
 
-v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter)
+v8Util.setHiddenValue(global, 'ipc', new events.EventEmitter())
 
 // Use electron module after everything is ready.
 const electron = require('electron')
index ddabf79..e1fa947 100644 (file)
@@ -1,3 +1,5 @@
+/* globals Event */
+
 'use strict'
 
 const ipcRenderer = require('electron').ipcRenderer
@@ -199,7 +201,7 @@ if (process.openerId != null) {
 }
 
 ipcRenderer.on('ATOM_RENDERER_WINDOW_VISIBILITY_CHANGE', function (event, isVisible, isMinimized) {
-  var hasChanged = _isVisible != isVisible || _isMinimized != isMinimized
+  var hasChanged = _isVisible !== isVisible || _isMinimized !== isMinimized
 
   if (hasChanged) {
     _isVisible = isVisible
index 922aaa8..72395fe 100644 (file)
@@ -40,7 +40,7 @@ class WebViewAttribute {
   setValueIgnoreMutation (value) {
     this.ignoreMutation = true
     this.setValue(value)
-    return this.ignoreMutation = false
+    this.ignoreMutation = false
   }
 
   // Defines this attribute as a property on the webview node.
index 55d9482..d5b57c6 100644 (file)
@@ -423,8 +423,7 @@ var registerWebViewElement = function () {
     let requestId = getNextId()
     ipcRenderer.send('ATOM_BROWSER_ASYNC_CALL_TO_GUEST_VIEW', requestId, internal.guestInstanceId, 'executeJavaScript', code, hasUserGesture)
     ipcRenderer.once(`ATOM_RENDERER_ASYNC_CALL_TO_GUEST_VIEW_RESPONSE_${requestId}`, function (event, result) {
-      if (callback)
-        callback(result)
+      if (callback) callback(result)
     })
   }
 
index 2a5417b..c237ef1 100644 (file)
@@ -18,7 +18,7 @@ describe('electron module', function () {
     electron.hideInternalModules()
     try {
       require('clipboard')
-    } catch(err) {
+    } catch (err) {
       assert.equal(err.message, "Cannot find module 'clipboard'")
       done()
     }