diff --git a/client/scripts/actions/AuthActions.js b/client/scripts/actions/AuthActions.js index e932f6ac..683fcc67 100644 --- a/client/scripts/actions/AuthActions.js +++ b/client/scripts/actions/AuthActions.js @@ -3,7 +3,7 @@ import axios from 'axios'; import ActionTypes from '../constants/ActionTypes'; import AppDispatcher from '../dispatcher/AppDispatcher'; -const AuthActions = { +let AuthActions = { authenticate: (credentials) => { return axios.post('/auth/authenticate', credentials) .then((json = {}) => { diff --git a/client/scripts/actions/ClientActions.js b/client/scripts/actions/ClientActions.js index d67fe80b..ee68895c 100644 --- a/client/scripts/actions/ClientActions.js +++ b/client/scripts/actions/ClientActions.js @@ -3,7 +3,7 @@ import axios from 'axios'; import ActionTypes from '../constants/ActionTypes'; import AppDispatcher from '../dispatcher/AppDispatcher'; -const ClientActions = { +let ClientActions = { fetchSettings: (property) => { return axios.get('/api/client/settings', {params: {property}}) .then((json = {}) => { diff --git a/client/scripts/actions/FloodActions.js b/client/scripts/actions/FloodActions.js index 1f0da68b..f7843496 100644 --- a/client/scripts/actions/FloodActions.js +++ b/client/scripts/actions/FloodActions.js @@ -4,7 +4,7 @@ import AppDispatcher from '../dispatcher/AppDispatcher'; import ActionTypes from '../constants/ActionTypes'; import AuthStore from '../stores/AuthStore'; -const FloodActions = { +let FloodActions = { fetchTransferData: () => { return axios.get('/api/stats') .then((json = {}) => { diff --git a/client/scripts/actions/SettingsActions.js b/client/scripts/actions/SettingsActions.js index 1f2f4382..edf9e475 100644 --- a/client/scripts/actions/SettingsActions.js +++ b/client/scripts/actions/SettingsActions.js @@ -3,7 +3,7 @@ import axios from 'axios'; import AppDispatcher from '../dispatcher/AppDispatcher'; import ActionTypes from '../constants/ActionTypes'; -const SettingsActions = { +let SettingsActions = { addFeed: (feed) => { return axios.put('/api/feed-monitor/feeds', feed) .then((json = {}) => { diff --git a/client/scripts/actions/TorrentActions.js b/client/scripts/actions/TorrentActions.js index 351a78c3..34ac4fcd 100644 --- a/client/scripts/actions/TorrentActions.js +++ b/client/scripts/actions/TorrentActions.js @@ -3,7 +3,7 @@ import axios from 'axios'; import AppDispatcher from '../dispatcher/AppDispatcher'; import ActionTypes from '../constants/ActionTypes'; -const TorrentActions = { +let TorrentActions = { addTorrentsByUrls: (options) => { return axios.post('/api/client/add', options) .then((json = {}) => { diff --git a/client/scripts/actions/UIActions.js b/client/scripts/actions/UIActions.js index c4df0535..965253c8 100644 --- a/client/scripts/actions/UIActions.js +++ b/client/scripts/actions/UIActions.js @@ -4,7 +4,7 @@ import AppDispatcher from '../dispatcher/AppDispatcher'; import ActionTypes from '../constants/ActionTypes'; import TorrentStore from '../stores/TorrentStore'; -const UIActions = { +let UIActions = { displayContextMenu: (data) => { AppDispatcher.dispatchUIAction({ type: ActionTypes.UI_DISPLAY_CONTEXT_MENU, diff --git a/client/scripts/components/Modals/FeedsModal/DownloadRulesTab.js b/client/scripts/components/Modals/FeedsModal/DownloadRulesTab.js index a5fbaf8b..70459d65 100644 --- a/client/scripts/components/Modals/FeedsModal/DownloadRulesTab.js +++ b/client/scripts/components/Modals/FeedsModal/DownloadRulesTab.js @@ -16,7 +16,7 @@ import SettingsActions from '../../../actions/SettingsActions'; import TorrentDestination from '../../General/Filesystem/TorrentDestination'; import Validator from '../../../util/Validator'; -const messages = defineMessages({ +const MESSAGES = defineMessages({ mustSpecifyDestination: { id: 'settings.feeds.validation.must.specify.destination', defaultMessage: 'You must specify a destination.' @@ -78,21 +78,21 @@ class DownloadRulesTab extends React.Component { this.validatedFields = { destination: { isValid: Validator.isNotEmpty, - error: this.props.intl.formatMessage(messages.mustSpecifyDestination) + error: this.props.intl.formatMessage(MESSAGES.mustSpecifyDestination) }, feedID: { isValid: Validator.isNotEmpty, - error: this.props.intl.formatMessage(messages.mustSelectFeed) + error: this.props.intl.formatMessage(MESSAGES.mustSelectFeed) }, label: { isValid: Validator.isNotEmpty, - error: this.props.intl.formatMessage(messages.mustSpecifyLabel) + error: this.props.intl.formatMessage(MESSAGES.mustSpecifyLabel) }, match: { isValid: (value) => { return Validator.isNotEmpty(value) && Validator.isRegExValid(value); }, - error: this.props.intl.formatMessage(messages.invalidRegularExpression) + error: this.props.intl.formatMessage(MESSAGES.invalidRegularExpression) }, exclude: { isValid: (value) => { @@ -102,7 +102,7 @@ class DownloadRulesTab extends React.Component { return true; }, - error: this.props.intl.formatMessage(messages.invalidRegularExpression) + error: this.props.intl.formatMessage(MESSAGES.invalidRegularExpression) } }; } @@ -139,7 +139,7 @@ class DownloadRulesTab extends React.Component { this.inputRefs.ruleLabel = ref} type="text" /> @@ -159,7 +159,7 @@ class DownloadRulesTab extends React.Component { this.inputRefs.ruleMatch = ref} type="text" /> @@ -169,7 +169,7 @@ class DownloadRulesTab extends React.Component { this.inputRefs.ruleExclude = ref} type="text" /> @@ -178,7 +178,7 @@ class DownloadRulesTab extends React.Component { defaultMessage="Apply Tags" /> this.inputRefs.tags = ref} type="text" /> , diff --git a/client/scripts/components/Modals/FeedsModal/FeedsTab.js b/client/scripts/components/Modals/FeedsModal/FeedsTab.js index 4bb63786..6cbc2e84 100644 --- a/client/scripts/components/Modals/FeedsModal/FeedsTab.js +++ b/client/scripts/components/Modals/FeedsModal/FeedsTab.js @@ -24,7 +24,7 @@ const METHODS_TO_BIND = [ 'handleRemoveFeedClick' ]; -const messages = defineMessages({ +const MESSAGES = defineMessages({ mustSpecifyURL: { id: 'settings.feeds.validation.must.specify.valid.feed.url', defaultMessage: 'You must specify a valid feed URL.' @@ -61,22 +61,22 @@ class FeedsTab extends React.Component { errors: {}, intervals: [ { - displayName: `5 ${this.props.intl.formatMessage(messages.min)}`, + displayName: `5 ${this.props.intl.formatMessage(MESSAGES.min)}`, selected: true, value: 5 }, { - displayName: `15 ${this.props.intl.formatMessage(messages.min)}`, + displayName: `15 ${this.props.intl.formatMessage(MESSAGES.min)}`, selected: false, value: 15 }, { - displayName: `30 ${this.props.intl.formatMessage(messages.min)}`, + displayName: `30 ${this.props.intl.formatMessage(MESSAGES.min)}`, selected: false, value: 30 }, { - displayName: `5 ${this.props.intl.formatMessage(messages.hr)}`, + displayName: `5 ${this.props.intl.formatMessage(MESSAGES.hr)}`, selected: false, value: 60 } @@ -94,11 +94,11 @@ class FeedsTab extends React.Component { this.validatedFields = { url: { isValid: Validator.isURLValid, - error: this.props.intl.formatMessage(messages.mustSpecifyURL) + error: this.props.intl.formatMessage(MESSAGES.mustSpecifyURL) }, label: { isValid: Validator.isNotEmpty, - error: this.props.intl.formatMessage(messages.mustSpecifyLabel) + error: this.props.intl.formatMessage(MESSAGES.mustSpecifyLabel) } }; } @@ -155,7 +155,7 @@ class FeedsTab extends React.Component { this.inputRefs.feedURL = ref} type="text" /> @@ -178,7 +178,7 @@ class FeedsTab extends React.Component { this.inputRefs.feedLabel = ref} type="text" /> diff --git a/client/scripts/components/Modals/TorrentDetailsModal/TorrentGeneralInfo.js b/client/scripts/components/Modals/TorrentDetailsModal/TorrentGeneralInfo.js index d4b24b43..ae448d47 100644 --- a/client/scripts/components/Modals/TorrentDetailsModal/TorrentGeneralInfo.js +++ b/client/scripts/components/Modals/TorrentDetailsModal/TorrentGeneralInfo.js @@ -21,13 +21,12 @@ class TorrentGeneralInfo extends React.Component { let totalSize = format.data(torrent.sizeBytes); let freeDiskSpace = format.data(torrent.freeDiskSpace); - const valueNotAvailable = + const VALUE_NOT_AVAILABLE = ( - - ; + + + ); return (
@@ -108,7 +107,7 @@ class TorrentGeneralInfo extends React.Component { {(torrent.tags.length ? this.getTags(torrent.tags) - : valueNotAvailable)} + : VALUE_NOT_AVAILABLE)} @@ -177,7 +176,7 @@ class TorrentGeneralInfo extends React.Component { {(torrent.comment.substr(10) ? torrent.comment.substr(10) - : valueNotAvailable)} + : VALUE_NOT_AVAILABLE)} @@ -254,7 +253,7 @@ class TorrentGeneralInfo extends React.Component { /> - {(torrent.message ? torrent.message : valueNotAvailable)} + {(torrent.message ? torrent.message : VALUE_NOT_AVAILABLE)} diff --git a/client/scripts/components/Sidebar/FeedsButton.js b/client/scripts/components/Sidebar/FeedsButton.js index 060dc225..549003d6 100644 --- a/client/scripts/components/Sidebar/FeedsButton.js +++ b/client/scripts/components/Sidebar/FeedsButton.js @@ -5,7 +5,7 @@ import FeedIcon from '../Icons/FeedIcon'; import Tooltip from '../General/Tooltip'; import UIActions from '../../actions/UIActions'; -const messages = defineMessages({ +const MESSAGES = defineMessages({ feeds: { id: 'sidebar.button.feeds', defaultMessage: 'Feeds' @@ -34,7 +34,7 @@ class FeedsButton extends React.Component { } render() { - let label = this.props.intl.formatMessage(messages.feeds); + let label = this.props.intl.formatMessage(MESSAGES.feeds); return ( + title={this.props.intl.formatMessage(MESSAGES.speedLimits)}> - + ); } getDropdownTrigger() { - let label = this.props.intl.formatMessage(messages.speedLimits); + let label = this.props.intl.formatMessage(MESSAGES.speedLimits); return ( { if (eta === 'Infinity') { return '∞'; @@ -136,4 +136,4 @@ const format = { } }; -export default format; +export default FORMAT_DATA_UTIL; diff --git a/config.template.js b/config.template.js index 4d8ead72..d6dd10b6 100644 --- a/config.template.js +++ b/config.template.js @@ -1,4 +1,4 @@ -const config = { +const CONFIG = { dbCleanInterval: 1000 * 60 * 60, dbPath: './server/db/', floodServerPort: 3000, @@ -13,4 +13,4 @@ const config = { } }; -module.exports = config; +module.exports = CONFIG; diff --git a/server/models/Torrent.js b/server/models/Torrent.js index 1ce5a1f0..1433874a 100644 --- a/server/models/Torrent.js +++ b/server/models/Torrent.js @@ -5,7 +5,7 @@ let _ = require('lodash'); let regEx = require('../../shared/util/regEx'); let stringUtil = require('../../shared/util/stringUtil'); -const CALCULATED_DATA = [ +let calculatedData = [ 'eta', 'percentComplete', 'status', @@ -14,7 +14,7 @@ const CALCULATED_DATA = [ 'totalSeeds' ]; -const REQUESTED_DATA = [ +let requestedData = [ // Torrent List data 'hash', 'added', @@ -85,8 +85,7 @@ class Torrent { } getCalculatedClientData(clientData, opts) { - let keysToProcess = CALCULATED_DATA; - let requestedData = REQUESTED_DATA; + let keysToProcess = calculatedData; let torrentData = {}; diff --git a/server/util/rTorrentPropMap.js b/server/util/rTorrentPropMap.js index f3984a5b..31e66f7d 100644 --- a/server/util/rTorrentPropMap.js +++ b/server/util/rTorrentPropMap.js @@ -1,4 +1,4 @@ -const rTorrentPropMap = { +const RTORRENT_PROPS_MAP = { transferData: { uploadRate: 'throttle.global_up.rate', uploadTotal: 'throttle.global_up.total', @@ -9,4 +9,4 @@ const rTorrentPropMap = { } }; -module.exports = rTorrentPropMap; +module.exports = RTORRENT_PROPS_MAP; diff --git a/shared/constants/clientSettingsMap.js b/shared/constants/clientSettingsMap.js index 732e7e8e..101f4f1f 100644 --- a/shared/constants/clientSettingsMap.js +++ b/shared/constants/clientSettingsMap.js @@ -2,7 +2,7 @@ let objectUtil = require('../util/objectUtil'); -const clientSettingsMap = objectUtil.reflect({ +let clientSettingsMap = objectUtil.reflect({ dhtPort: 'dht.port', dhtStats: 'dht.statistics', directoryDefault: 'directory.default', diff --git a/shared/constants/propsMap.js b/shared/constants/propsMap.js index bf4a3ba5..60fed1c1 100644 --- a/shared/constants/propsMap.js +++ b/shared/constants/propsMap.js @@ -1,6 +1,6 @@ 'use strict'; -const propsMap = { +const PROPS_MAP = { serverStatus: { ch: 'checking', sd: 'seeding', @@ -26,4 +26,4 @@ const propsMap = { } }; -module.exports = propsMap; +module.exports = PROPS_MAP; diff --git a/shared/util/formatUtil.js b/shared/util/formatUtil.js index c7e4c172..54344ca1 100644 --- a/shared/util/formatUtil.js +++ b/shared/util/formatUtil.js @@ -1,18 +1,18 @@ 'use strict'; let moment = require('moment'); -var FormatUtil = { +const FORMAT_UTIL = { minToHumanReadable: min => { return moment.duration(min * 60 * 1000).humanize(); }, parsePeers: (string) => { - var markerPosition = string.indexOf('@!@'); + let markerPosition = string.indexOf('@!@'); return string.substr(0, markerPosition); }, status: (isHashChecking, isComplete, isOpen, uploadRate, downloadRate, state, message) => { - var torrentStatus = []; + let torrentStatus = []; if (isHashChecking === '1') { torrentStatus.push('ch'); // checking @@ -44,4 +44,4 @@ var FormatUtil = { } } -module.exports = FormatUtil; +module.exports = FORMAT_UTIL; diff --git a/shared/util/objectUtil.js b/shared/util/objectUtil.js index f9f890c0..439b1b36 100644 --- a/shared/util/objectUtil.js +++ b/shared/util/objectUtil.js @@ -1,6 +1,6 @@ 'use strict'; -let objectUtil = { +const OBJECT_UTIL = { reflect: (hash) => { return Object.keys(hash).reduce((memo, key) => { memo[key] = hash[key]; @@ -10,4 +10,4 @@ let objectUtil = { } } -module.exports = objectUtil; +module.exports = OBJECT_UTIL; diff --git a/shared/util/regEx.js b/shared/util/regEx.js index 8cd270ad..1c4dcbbc 100644 --- a/shared/util/regEx.js +++ b/shared/util/regEx.js @@ -1,8 +1,8 @@ 'use strict'; -const regEx = { +const REG_EX = { url: /^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/, domainName: /https?:\/\/(?:www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,18}\b)*(\/[\/\d\w\.-]*)*(?:[\?])*(.+)*/i }; -module.exports = regEx; +module.exports = REG_EX; diff --git a/shared/util/stringUtil.js b/shared/util/stringUtil.js index 7d465607..eb08fb56 100644 --- a/shared/util/stringUtil.js +++ b/shared/util/stringUtil.js @@ -1,6 +1,6 @@ 'use strict'; -let stringUtil = { +const STRING_UTIL = { capitalize: (string) => { return string.charAt(0).toUpperCase() + string.slice(1); }, @@ -18,4 +18,4 @@ let stringUtil = { } } -module.exports = stringUtil; +module.exports = STRING_UTIL;