Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
Cleanup warnings
Browse files Browse the repository at this point in the history
Fixes a bunch of jshint and Moment warnings.
  • Loading branch information
dariusk committed Mar 14, 2018
1 parent d80755b commit bed0c62
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class AdminComponent extends React.PureComponent {
return (
<div>
<Paper>
<div class="content">
<div className="content">
</div>
</Paper>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ClippingContainerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class ClippingContainer extends React.PureComponent {
</div>
}

const friendlyDate = moment(this.props.airDate).format('LL');
const friendlyDate = moment(this.props.airDate, 'LL');

// axis of slider should be top or left?
// const scrubberAxis = window.innerWidth > '992' ? 'x' : 'y-reverse';
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Landing(props) {
<span className="episode-name">
{ep.title}
<span className="episode-date">
{ep.original_air_date ? ` | ${moment(ep.original_air_date).format('LL')}` : ''}
{ep.original_air_date ? ` | ${moment(ep.original_air_date, 'LL')}` : ''}
</span>
</span>
<p className="episode-description">
Expand Down
1 change: 0 additions & 1 deletion client/src/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const Store = require('store'); // localStorage

const isSecure = window.location.protocol == 'https:';
const apiEndpoint_default = isSecure ? require('config').default.apiEndpointSsl : require('config').default.apiEndpoint;
const dataBucket = require('config').default.dataBucket;
const maxClipSeconds = require('config').default.maxClipSeconds;
const minClipSeconds = require('config').default.minClipSeconds;
const env = require('config').default.appEnv;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ShareContainerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ShareContainerComponent extends React.Component {
return (
<div className="sharecontainer-component content">
<div className="row hide-s">
<div className="episode-header"><div className="state-tag">Previewing</div> <span className="episode-title">{this.props.episode}</span> | <span className="air-date">{moment(this.props.airDate).format('LL')}</span></div>
<div className="episode-header"><div className="state-tag">Previewing</div> <span className="episode-title">{this.props.episode}</span> | <span className="air-date">{moment(this.props.airDate, 'LL')}</span></div>
</div>
<Subhead
heading="Share Video"
Expand Down
2 changes: 0 additions & 2 deletions client/src/data/most-recent-placeholder.js

This file was deleted.

2 changes: 1 addition & 1 deletion server/routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ router.post('/setEpisode', function (req, res) {
const newObject = {
value: guid,
enabled: enabled === 'true'
}
};
if (episodeIndex > -1) {
episodes[episodeIndex] = newObject;
}
Expand Down
2 changes: 1 addition & 1 deletion server/routes/all-episode-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let cache;

// update `allEpisodes` and `episodeDataVersions`
const update = function(globalCache, cb) {
cb = cb || function(err, success) {
cb = cb || function(err) {
if (err) {
throw new Error('Unable to update episode data: ' + err);
}
Expand Down
8 changes: 4 additions & 4 deletions server/routes/create-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function(req, res) {
// event variables
const params = req.query;
let showID, startTime, duration, type, bgColor, wordArray, opts;
let tweetData = false, bucketName;
let tweetData = false;
let event = req.body;

// destination file name / key
Expand Down Expand Up @@ -114,8 +114,8 @@ module.exports = function(req, res) {

localFilePaths.push(tempOutName);

res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
let videoData = {
Bucket: results.s3.Bucket,
Key: results.s3.Key,
Expand Down Expand Up @@ -191,7 +191,7 @@ function timeToSegmentID(timeInSeconds) {
return zeroPad( Math.floor(timeInSeconds / segmentLength) );
}

// segment IDs need to be formatted like this "001"
// segment IDs need to be formatted like this '001'
function zeroPad(number) {
var str = String(number);

Expand Down
4 changes: 2 additions & 2 deletions server/routes/get-episode.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module.exports = function(req, res) {
// generate signed url
const protectedUrl = `${process.env.CLOUDFRONT_URL}${epVersion}`;
const signedUrl = cfSign.getSignedUrl(protectedUrl, req);
res.setHeader("Cache-Control", "public, max-age=2592000");
res.setHeader("Expires", new Date(Date.now() + 2592000000).toUTCString());
res.setHeader('Cache-Control', 'public, max-age=2592000');
res.setHeader('Expires', new Date(Date.now() + 2592000000).toUTCString());

// redirect to signedURL if url contains 'api'
if (req.baseUrl.indexOf('api') > -1) {
Expand Down
4 changes: 2 additions & 2 deletions server/routes/getTranscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ function episodeDataCallback(err, body, _startTime, _endTime, episodeNumber, epi
timestamp = lastValidTimestamp+1;
}
lastValidTimestamp = timestamp;
return [Math.round(timestamp)+"", striptags(decodeHTMLEntities(showData.transcript.substr(word.startOffset, nextWord.startOffset-word.startOffset)).trim(), ['&'])];
return [Math.round(timestamp)+'', striptags(decodeHTMLEntities(showData.transcript.substr(word.startOffset, nextWord.startOffset-word.startOffset)).trim(), ['&'])];
});
// add a placeholder empty string at time 0 (necessary for the reduce function that the client does)
wordsInRange.unshift(["0",""]);
wordsInRange.unshift(['0','']);

// Fake paragraph breaks on every word that contains a terminal punctuation.
paragraphsInRange = wordsInRange.filter(word => (word[1].match(/(\?$|\.$|\!$|(\.|\?|\!)\"$)$/) && word[1].length > 3))
Expand Down
14 changes: 8 additions & 6 deletions server/routes/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const fs = require('fs');
const request = require('request');
const path = require('path');
const inactiveEpisodes = process.env.BAD_EPISODES.split(',');
const Parser = require('rss-parser');
const parser = new Parser();
Expand All @@ -22,7 +21,7 @@ module.exports = {
let unfilteredEpisodes = feed.items.sort((a,b) => {
return Date.parse(b.pubDate) - Date.parse(a.pubDate);
})
.map((episode, index, array) => {
.map((episode) => {
let guid = episode.guid || episode.link;
// set the ID number to the guid
let number = guid;
Expand Down Expand Up @@ -65,10 +64,13 @@ module.exports = {

var tempName = tempDir + '/' + origPath.split('/').pop();
var dlStream = fs.createWriteStream(tempName);
dlStream.on('finish', function(err, msg) {
dlStream.close(function(err, msg) {
dlStream.on('finish', function(err) {
if (err) {
throw new Error(err);
}
dlStream.close(function(err) {
if (err) {
console.log(err);
throw new Error(err);
}
console.log('finish');
setTimeout(function() {
Expand All @@ -82,7 +84,7 @@ module.exports = {
.on('response', function(response) {
response.pipe(dlStream);
})
.on('end', function(resp) {
.on('end', function() {
console.log('downloaded');
dlStream.end();
});
Expand Down
5 changes: 1 addition & 4 deletions server/routes/makeWaveform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
waveform = require('waveform-util');
const waveform = require('waveform-util');

// ... via waveform-util module documentation:
//
Expand Down Expand Up @@ -48,6 +48,3 @@ module.exports = {
}

};



0 comments on commit bed0c62

Please sign in to comment.