Use const for requires

This commit is contained in:
Kevin Sawicki 2016-02-16 16:46:49 -08:00
parent 57f322a818
commit 709661156a
8 changed files with 41 additions and 66 deletions

View file

@ -1,14 +1,10 @@
var BrowserWindow, ChildProcess, app, assert, path, ref, remote;
const assert = require('assert');
const ChildProcess = require('child_process');
const path = require('path');
const remote = require('electron').remote;
assert = require('assert');
ChildProcess = require('child_process');
path = require('path');
remote = require('electron').remote;
ref = remote.require('electron'), app = ref.app, BrowserWindow = ref.BrowserWindow;
const app = remote.require('electron').app;
const BrowserWindow = remote.require('electron').BrowserWindow;
describe('electron module', function() {
it ('can prevent exposing internal modules to require', function(done) {

View file

@ -1,10 +1,8 @@
var assert, clipboard, nativeImage, path, ref;
const assert = require('assert');
const path = require('path');
assert = require('assert');
path = require('path');
ref = require('electron'), clipboard = ref.clipboard, nativeImage = ref.nativeImage;
const clipboard = require('electron').clipboard;
const nativeImage = require('electron').nativeImage;
describe('clipboard module', function() {
var fixtures;

View file

@ -1,18 +1,13 @@
var BrowserWindow, app, assert, crashReporter, http, multiparty, path, ref, remote, url;
const assert = require('assert');
const http = require('http');
const multiparty = require('multiparty');
const path = require('path');
const url = require('url');
assert = require('assert');
path = require('path');
http = require('http');
url = require('url');
multiparty = require('multiparty');
remote = require('electron').remote;
ref = remote.require('electron'), app = ref.app, crashReporter = ref.crashReporter, BrowserWindow = ref.BrowserWindow;
const remote = require('electron').remote;
const app = remote.require('electron').app;
const crashReporter = remote.require('electron').crashReporter;
const BrowserWindow = remote.require('electron').BrowserWindow;
describe('crash-reporter module', function() {
var fixtures, isCI, w;
@ -63,7 +58,7 @@ describe('crash-reporter module', function() {
return server.listen(port, '127.0.0.1', function() {
port = server.address().port;
remote.process.port = port;
url = url.format({
const crashUrl = url.format({
protocol: 'file',
pathname: path.join(fixtures, 'api', 'crash.html'),
search: "?port=" + port
@ -74,7 +69,7 @@ describe('crash-reporter module', function() {
submitURL: "http://127.0.0.1:" + port
});
}
return w.loadURL(url);
return w.loadURL(crashUrl);
});
});
return describe(".start(options)", function() {

View file

@ -1,12 +1,6 @@
var assert, path, remote, BrowserWindow;
assert = require('assert');
path = require('path');
remote = require('electron').remote;
BrowserWindow = remote.BrowserWindow;
const assert = require('assert');
const path = require('path');
const BrowserWindow = require('electron').remote.BrowserWindow;
describe('debugger module', function() {
var fixtures, w;

View file

@ -1,14 +1,13 @@
var BrowserWindow, assert, comparePaths, ipcMain, ipcRenderer, path, ref, ref1, remote;
const assert = require('assert');
const path = require('path');
assert = require('assert');
const ipcRenderer = require('electron').ipcRenderer;
const remote = require('electron').remote;
path = require('path');
const ipcMain = remote.require('electron').ipcMain;
const BrowserWindow = remote.require('electron').BrowserWindow;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, remote = ref.remote;
ref1 = remote.require('electron'), ipcMain = ref1.ipcMain, BrowserWindow = ref1.BrowserWindow;
comparePaths = function(path1, path2) {
const comparePaths = function(path1, path2) {
if (process.platform === 'win32') {
path1 = path1.toLowerCase();
path2 = path2.toLowerCase();

View file

@ -1,10 +1,10 @@
var Menu, MenuItem, assert, ipcRenderer, ref, ref1, remote;
const assert = require('assert');
assert = require('assert');
const remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
ref = require('electron'), remote = ref.remote, ipcRenderer = ref.ipcRenderer;
ref1 = remote.require('electron'), Menu = ref1.Menu, MenuItem = ref1.MenuItem;
const Menu = remote.require('electron').Menu;
const MenuItem = remote.require('electron').MenuItem;
describe('menu module', function() {
describe('Menu.buildFromTemplate', function() {

View file

@ -1,8 +1,5 @@
var assert, screen;
assert = require('assert');
screen = require('electron').screen;
const assert = require('assert');
const screen = require('electron').screen;
describe('screen module', function() {
describe('screen.getCursorScreenPoint()', function() {

View file

@ -1,10 +1,6 @@
var assert, path, webFrame;
assert = require('assert');
path = require('path');
webFrame = require('electron').webFrame;
const assert = require('assert');
const path = require('path');
const webFrame = require('electron').webFrame;
describe('webFrame module', function() {
var fixtures;