Skip to content

Commit

Permalink
Style: no more var
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Sep 2, 2016
1 parent 0bda535 commit 3f6cc97
Show file tree
Hide file tree
Showing 54 changed files with 682 additions and 685 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
node_js:
- 'node'
install: npm install standard depcheck
install: npm install standard depcheck walk-sync
7 changes: 3 additions & 4 deletions bin/extra-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ files.forEach(function (file) {
error = 'Line >100 chars'
}

// TODO: No vars
// if (line.match(/^var /) || line.match(/ var /)) {
// error = 'Use const or let'
// }
if (line.match(/^var /) || line.match(/ var /)) {
error = 'Use const or let'
}

if (error) {
let name = path.basename(file)
Expand Down
16 changes: 8 additions & 8 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
var appConfig = require('application-config')('WebTorrent')
var fs = require('fs')
var path = require('path')
const appConfig = require('application-config')('WebTorrent')
const fs = require('fs')
const path = require('path')

var APP_NAME = 'WebTorrent'
var APP_TEAM = 'WebTorrent, LLC'
var APP_VERSION = require('../package.json').version
const APP_NAME = 'WebTorrent'
const APP_TEAM = 'WebTorrent, LLC'
const APP_VERSION = require('../package.json').version

var PORTABLE_PATH = path.join(path.dirname(process.execPath), 'Portable Settings')
const PORTABLE_PATH = path.join(path.dirname(process.execPath), 'Portable Settings')

module.exports = {
ANNOUNCEMENT_URL: 'https://webtorrent.io/desktop/announcement',
Expand Down Expand Up @@ -95,7 +95,7 @@ function getDefaultDownloadPath () {
return path.join(getConfigPath(), 'Downloads')
}

var electron = require('electron')
const electron = require('electron')

return process.type === 'renderer'
? electron.remote.app.getPath('downloads')
Expand Down
4 changes: 2 additions & 2 deletions src/crash-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module.exports = {
init
}

var config = require('./config')
var electron = require('electron')
const config = require('./config')
const electron = require('electron')

function init () {
electron.crashReporter.start({
Expand Down
10 changes: 5 additions & 5 deletions src/main/announcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = {
init
}

var electron = require('electron')
const electron = require('electron')

var config = require('../config')
var log = require('./log')
const config = require('../config')
const log = require('./log')

var ANNOUNCEMENT_URL = config.ANNOUNCEMENT_URL +
const ANNOUNCEMENT_URL = config.ANNOUNCEMENT_URL +
'?version=' + config.APP_VERSION +
'&platform=' + process.platform

Expand All @@ -26,7 +26,7 @@ var ANNOUNCEMENT_URL = config.ANNOUNCEMENT_URL +
* }
*/
function init () {
var get = require('simple-get')
const get = require('simple-get')
get.concat(ANNOUNCEMENT_URL, onResponse)
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ module.exports = {
openFiles
}

var electron = require('electron')
const electron = require('electron')

var log = require('./log')
var windows = require('./windows')
const log = require('./log')
const windows = require('./windows')

/**
* Show open dialog to create a single-file torrent.
*/
function openSeedFile () {
if (!windows.main.win) return
log('openSeedFile')
var opts = {
const opts = {
title: 'Select a file for the torrent.',
properties: [ 'openFile' ]
}
Expand All @@ -37,7 +37,7 @@ function openSeedFile () {
function openSeedDirectory () {
if (!windows.main.win) return
log('openSeedDirectory')
var opts = process.platform === 'darwin'
const opts = process.platform === 'darwin'
? {
title: 'Select a file or folder for the torrent.',
properties: [ 'openFile', 'openDirectory' ]
Expand All @@ -61,7 +61,7 @@ function openSeedDirectory () {
function openFiles () {
if (!windows.main.win) return
log('openFiles')
var opts = process.platform === 'darwin'
const opts = process.platform === 'darwin'
? {
title: 'Select a file or folder to add.',
properties: [ 'openFile', 'openDirectory' ]
Expand All @@ -84,7 +84,7 @@ function openFiles () {
function openTorrentFile () {
if (!windows.main.win) return
log('openTorrentFile')
var opts = {
const opts = {
title: 'Select a .torrent file.',
filters: [{ name: 'Torrent Files', extensions: ['torrent'] }],
properties: [ 'openFile', 'multiSelections' ]
Expand Down
8 changes: 4 additions & 4 deletions src/main/dock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ module.exports = {
setBadge
}

var {app, Menu} = require('electron')
const {app, Menu} = require('electron')

var dialog = require('./dialog')
var log = require('./log')
const dialog = require('./dialog')
const log = require('./log')

/**
* Add a right-click menu to the dock icon. (Mac)
*/
function init () {
if (!app.dock) return
var menu = Menu.buildFromTemplate(getMenuTemplate())
const menu = Menu.buildFromTemplate(getMenuTemplate())
app.dock.setMenu(menu)
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/external-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ module.exports = {
checkInstall
}

var cp = require('child_process')
var vlcCommand = require('vlc-command')
const cp = require('child_process')
const vlcCommand = require('vlc-command')

var log = require('./log')
var windows = require('./windows')
const log = require('./log')
const windows = require('./windows')

// holds a ChildProcess while we're playing a video in an external player, null otherwise
var proc
let proc = null

function checkInstall (path, cb) {
// check for VLC if external player has not been specified by the user
Expand All @@ -26,7 +26,7 @@ function spawn (path, url, title) {
// Try to find and use VLC if external player is not specified
vlcCommand(function (err, vlcPath) {
if (err) return windows.main.dispatch('externalPlayerNotFound')
var args = [
const args = [
'--play-and-exit',
'--video-on-top',
'--quiet',
Expand All @@ -50,7 +50,7 @@ function spawnExternal (path, args) {
proc = cp.spawn(path, args, {stdio: 'ignore'})

// If it works, close the modal after a second
var closeModalTimeout = setTimeout(() =>
const closeModalTimeout = setTimeout(() =>
windows.main.dispatch('exitModal'), 1000)

proc.on('close', function (code) {
Expand Down
Loading

0 comments on commit 3f6cc97

Please sign in to comment.