Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer const over let #1497

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/extra-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ files.forEach(function (file) {
}

if (error) {
let name = path.basename(file)
const name = path.basename(file)
console.log('%s:%d - %s:\n%s', name, i + 1, error, line)
hasErrors = true
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function sliceArgv (argv) {
}

function processArgv (argv) {
let torrentIds = []
const torrentIds = []
argv.forEach(function (arg) {
if (arg === '-n' || arg === '-o' || arg === '-u') {
// Critical path: Only load the 'dialog' package if it is needed
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/controllers/torrent-list-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ module.exports = class TorrentListController {
function findFilesRecursive (paths, cb_) {
if (paths.length > 1) {
let numComplete = 0
let ret = []
const ret = []
paths.forEach(function (path) {
findFilesRecursive([path], function (fileObjs) {
ret.push(...fileObjs)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function saveImmediate (state, cb) {
.filter((x) => x.infoHash)
.map(function (x) {
const torrent = {}
for (let key in x) {
for (const key in x) {
if (key === 'progress' || key === 'torrentKey') {
continue // Don't save progress info or key for the webtorrent process
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function getSystemInfo () {
function getTorrentStats (state) {
const count = state.saved.torrents.length
let sizeMB = 0
let byStatus = {
const byStatus = {
new: { count: 0, sizeMB: 0 },
downloading: { count: 0, sizeMB: 0 },
seeding: { count: 0, sizeMB: 0 },
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/torrent-poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function scoreAudioCoverFile (imgFile) {
spectrogram: -80
}

for (let keyword in relevanceScore) {
for (const keyword in relevanceScore) {
if (fileName === keyword) {
return relevanceScore[keyword]
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* actually used because auto-prefixing is disabled with
* `darkBaseTheme.userAgent = false`. Return a fake object.
*/
let Module = require('module')
const Module = require('module')
const _require = Module.prototype.require
Module.prototype.require = function (id) {
if (id === 'inline-style-prefixer') return {}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/pages/player-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,14 @@ function formatTime (time, total) {
return '0:00'
}

let totalHours = Math.floor(total / 3600)
let totalMinutes = Math.floor(total % 3600 / 60)
let hours = Math.floor(time / 3600)
const totalHours = Math.floor(total / 3600)
const totalMinutes = Math.floor(total % 3600 / 60)
const hours = Math.floor(time / 3600)
let minutes = Math.floor(time % 3600 / 60)
if (totalMinutes > 9) {
minutes = zeroFill(2, minutes)
}
let seconds = zeroFill(2, Math.floor(time % 60))
const seconds = zeroFill(2, Math.floor(time % 60))

return (totalHours > 0 ? hours + ':' : '') + minutes + ':' + seconds
}