Skip to content
Browse files

Update eslint, fix lint issues

  • Loading branch information...
1 parent c50510d commit 74592e72b474073af4c52162956e6cb0142af40d @BerkeleyTrue BerkeleyTrue committed
View
17 .eslintrc
@@ -1,6 +1,9 @@
{ {
- "ecmaFeatures": { + "parserOption": {
- "jsx": true + "ecmaVersion": 6,
+ "ecmaFeatures": {
+ "jsx": true
+ }
}, },
"env": { "env": {
"browser": true, "browser": true,
@@ -12,6 +15,7 @@
"react" "react"
], ],
"globals": { "globals": {
+ "Promise": true,
"window": true, "window": true,
"$": true, "$": true,
"ga": true, "ga": true,
@@ -58,7 +62,6 @@
"no-caller": 2, "no-caller": 2,
"no-div-regex": 2, "no-div-regex": 2,
"no-else-return": 0, "no-else-return": 0,
- "no-empty-label": 2,
"no-eq-null": 1, "no-eq-null": 1,
"no-eval": 2, "no-eval": 2,
"no-extend-native": 2, "no-extend-native": 2,
@@ -182,10 +185,7 @@
"always" "always"
], ],
"sort-vars": 0, "sort-vars": 0,
- "space-after-keywords": [ + "keyword-spacing": [ 2 ],
- 2,
- "always"
- ],
"space-before-function-paren": [ "space-before-function-paren": [
2, 2,
"never" "never"
@@ -197,7 +197,6 @@
"space-in-brackets": 0, "space-in-brackets": 0,
"space-in-parens": 0, "space-in-parens": 0,
"space-infix-ops": 2, "space-infix-ops": 2,
- "space-return-throw-case": 2,
"space-unary-ops": [ "space-unary-ops": [
1, 1,
{ {
@@ -214,7 +213,7 @@
"max-depth": 0, "max-depth": 0,
"max-len": [ "max-len": [
- 1, + 2,
80, 80,
2 2
], ],
View
1 client/commonFramework/code-storage.js
@@ -34,6 +34,7 @@ window.common = (function(global) {
} }
} }
} }
+ return null;
}, },
isAlive: function(key) { isAlive: function(key) {
View
9 client/commonFramework/end.js
@@ -51,10 +51,10 @@ $(document).ready(function() {
<h1>${err}</h1> <h1>${err}</h1>
`).subscribe(() => {}); `).subscribe(() => {});
} }
+ return null;
}, },
err => console.error(err) err => console.error(err)
); );
-
} }
common.resetBtn$ common.resetBtn$
@@ -74,6 +74,7 @@ $(document).ready(function() {
common.codeStorage.updateStorage(challengeName, originalCode); common.codeStorage.updateStorage(challengeName, originalCode);
common.codeUri.querify(originalCode); common.codeUri.querify(originalCode);
common.updateOutputDisplay(output); common.updateOutputDisplay(output);
+ return null;
}, },
(err) => { (err) => {
if (err) { if (err) {
@@ -112,6 +113,7 @@ $(document).ready(function() {
if (solved) { if (solved) {
common.showCompletion(); common.showCompletion();
} }
+ return null;
}, },
({ err }) => { ({ err }) => {
console.error(err); console.error(err);
@@ -138,6 +140,7 @@ $(document).ready(function() {
return common.updateOutputDisplay('' + err); return common.updateOutputDisplay('' + err);
} }
common.displayTestResults(tests); common.displayTestResults(tests);
+ return null;
}, },
({ err }) => { ({ err }) => {
console.error(err); console.error(err);
@@ -149,7 +152,7 @@ $(document).ready(function() {
challengeType === challengeTypes.BONFIRE || challengeType === challengeTypes.BONFIRE ||
challengeType === challengeTypes.JS challengeType === challengeTypes.JS
) { ) {
- Observable.just({}) + return Observable.just({})
.delay(500) .delay(500)
.flatMap(() => common.executeChallenge$()) .flatMap(() => common.executeChallenge$())
.catch(err => Observable.just({ err })) .catch(err => Observable.just({ err }))
@@ -161,6 +164,7 @@ $(document).ready(function() {
} }
common.codeStorage.updateStorage(challengeName, originalCode); common.codeStorage.updateStorage(challengeName, originalCode);
common.displayTestResults(tests); common.displayTestResults(tests);
+ return null;
}, },
(err) => { (err) => {
console.error(err); console.error(err);
@@ -168,4 +172,5 @@ $(document).ready(function() {
} }
); );
} }
+ return null;
}); });
View
2 client/commonFramework/phone-scroll-lock.js
@@ -110,7 +110,7 @@ window.common = (function({ common = { init: [] }}) {
return null; return null;
} }
execInProgress = true; execInProgress = true;
- setTimeout(function() { + return setTimeout(function() {
if ( if (
$($('.scroll-locker').children()[0]).height() - 800 > e.detail $($('.scroll-locker').children()[0]).height() - 800 > e.detail
) { ) {
View
51 client/commonFramework/step-challenge.js
@@ -92,18 +92,16 @@ window.common = (function({ $, common = { init: [] }}) {
} }
function handleActionClick(e) { function handleActionClick(e) {
- var props = common.challengeSeed[0] || + var props = common.challengeSeed[0] || { stepIndex: [] };
- { stepIndex: [] };
var $el = $(this); var $el = $(this);
var index = +$el.attr('id'); var index = +$el.attr('id');
var propIndex = props.stepIndex.indexOf(index); var propIndex = props.stepIndex.indexOf(index);
if (propIndex === -1) { if (propIndex === -1) {
- return $el + return $el.parent()
- .parent() + .find('.disabled')
- .find('.disabled') + .removeClass('disabled');
- .removeClass('disabled');
} }
// an API action // an API action
@@ -112,30 +110,26 @@ window.common = (function({ $, common = { init: [] }}) {
var prop = props.properties[propIndex]; var prop = props.properties[propIndex];
var api = props.apis[propIndex]; var api = props.apis[propIndex];
if (common[prop]) { if (common[prop]) {
- return $el + return $el.parent()
- .parent()
- .find('.disabled')
- .removeClass('disabled');
- }
- $
- .post(api)
- .done(function(data) {
- // assume a boolean indicates passing
- if (typeof data === 'boolean') {
- return $el
- .parent()
.find('.disabled') .find('.disabled')
.removeClass('disabled'); .removeClass('disabled');
- } + }
- // assume api returns string when fails + return $.post(api)
- $el + .done(function(data) {
- .parent() + // assume a boolean indicates passing
- .find('.disabled') + if (typeof data === 'boolean') {
- .replaceWith('<p>' + data + '</p>'); + return $el.parent()
- }) + .find('.disabled')
- .fail(function() { + .removeClass('disabled');
- console.log('failed'); + }
- }); + // assume api returns string when fails
+ return $el.parent()
+ .find('.disabled')
+ .replaceWith('<p>' + data + '</p>');
+ })
+ .fail(function() {
+ console.log('failed');
+ });
} }
function handleFinishClick(e) { function handleFinishClick(e) {
@@ -199,6 +193,7 @@ window.common = (function({ $, common = { init: [] }}) {
$(nextBtnClass).click(handleNextStepClick); $(nextBtnClass).click(handleNextStepClick);
$(actionBtnClass).click(handleActionClick); $(actionBtnClass).click(handleActionClick);
$(finishBtnClass).click(handleFinishClick); $(finishBtnClass).click(handleFinishClick);
+ return null;
}); });
return common; return common;
View
4 client/main.js
@@ -93,6 +93,7 @@ main = (function(main, global) {
'<span>Free Code Camp\'s Main Chat</span>' + '<span>Free Code Camp\'s Main Chat</span>' +
'</div>' '</div>'
); );
+ return null;
}); });
@@ -233,7 +234,7 @@ $(document).ready(function() {
}; };
$('#story-submit').unbind('click'); $('#story-submit').unbind('click');
- $.post('/stories/', data) + return $.post('/stories/', data)
.fail(function() { .fail(function() {
$('#story-submit').bind('click', storySubmitButtonHandler); $('#story-submit').bind('click', storySubmitButtonHandler);
}) })
@@ -243,6 +244,7 @@ $(document).ready(function() {
return null; return null;
} }
window.location = '/stories/' + storyLink; window.location = '/stories/' + storyLink;
+ return null;
}); });
}; };
View
7 client/sagas/err-saga.js
@@ -4,15 +4,16 @@
// errSaga(action: Action) => Object|Void // errSaga(action: Action) => Object|Void
export default () => ({ dispatch }) => next => { export default () => ({ dispatch }) => next => {
return function errorSaga(action) { return function errorSaga(action) {
- if (!action.error) { return next(action); } + const result = next(action);
+ if (!action.error) { return result; }
console.error(action.error); console.error(action.error);
- dispatch({ + return dispatch({
type: 'app.makeToast', type: 'app.makeToast',
payload: { payload: {
type: 'error', type: 'error',
title: 'Oops, something went wrong', title: 'Oops, something went wrong',
- message: `Something went wrong, please try again later` + message: 'Something went wrong, please try again later'
} }
}); });
}; };
View
1 common/app/routes/Hikes/components/Questions.jsx
@@ -103,6 +103,7 @@ class Question extends React.Component {
.subscribe(); .subscribe();
this._subscriptions.add(subscription); this._subscriptions.add(subscription);
+ return null;
} }
handleMouseMove(isPressed, { delta, moveQuestion }) { handleMouseMove(isPressed, { delta, moveQuestion }) {
View
2 common/app/routes/Jobs/components/NewJob.jsx
@@ -132,7 +132,7 @@ export class NewJob extends React.Component {
if (certType === name) { if (certType === name) {
return fields[certType].onChange(true); return fields[certType].onChange(true);
} }
- fields[certType].onChange(false); + return fields[certType].onChange(false);
}); });
} }
View
40 common/app/temp.js
@@ -1,40 +0,0 @@
-import stamp from 'stampit';
-import { post$, postJSON$ } from '../utils/ajax-stream.js';
-
- const serviceStamp = stamp({
- methods: {
- readService$(resource, params, config) {
-
- return Observable.create(function(observer) {
- services.read(resource, params, config, (err, res) => {
- if (err) {
- return observer.onError(err);
- }
-
- observer.onNext(res);
- observer.onCompleted();
- });
-
- return Disposable.create(function() {
- observer.dispose();
- });
- });
- },
- createService$(resource, params, body, config) {
- return Observable.create(function(observer) {
- services.create(resource, params, body, config, (err, res) => {
- if (err) {
- return observer.onError(err);
- }
-
- observer.onNext(res);
- observer.onCompleted();
- });
-
- return Disposable.create(function() {
- observer.dispose();
- });
- });
- }
- }
- });
View
4 common/app/utils/professor-x.js
@@ -105,7 +105,7 @@ export default function contain(options = {}, Component) {
getChildContext(Component.contextTypes, this.context) getChildContext(Component.contextTypes, this.context)
); );
- professor.fetchContext.push({ + return professor.fetchContext.push({
name: options.fetchAction, name: options.fetchAction,
action, action,
actionArgs, actionArgs,
@@ -136,7 +136,7 @@ export default function contain(options = {}, Component) {
() => {}, () => {},
options.handleError options.handleError
); );
- this.__subscriptions.add(subscription); + return this.__subscriptions.add(subscription);
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
View
2 common/app/utils/render-to-string.js
@@ -17,7 +17,7 @@ export function fetch({ fetchContext = [] }) {
.doOnNext(fetch$ => { .doOnNext(fetch$ => {
if (!Observable.isObservable(fetch$)) { if (!Observable.isObservable(fetch$)) {
throw new Error( throw new Error(
- `action creator should return an observable` + 'action creator should return an observable'
); );
} }
}) })
View
14 common/models/User-Identity.js
@@ -73,7 +73,7 @@ export default function(UserIdent) {
} }
); );
} }
- cb(err, user, identity); + return cb(err, user, identity);
}); });
}); });
} }
@@ -99,12 +99,12 @@ export default function(UserIdent) {
} else { } else {
query = { username: userObj.username }; query = { username: userObj.username };
} }
- userModel.findOrCreate({ where: query }, userObj, function(err, user) { + return userModel.findOrCreate({ where: query }, userObj, (err, user) => {
if (err) { if (err) {
return cb(err); return cb(err);
} }
var date = new Date(); var date = new Date();
- userIdentityModel.create({ + return userIdentityModel.create({
provider: getSocialProvider(provider), provider: getSocialProvider(provider),
externalId: profile.id, externalId: profile.id,
authScheme: authScheme, authScheme: authScheme,
@@ -122,7 +122,7 @@ export default function(UserIdent) {
} }
); );
} }
- cb(err, user, identity); + return cb(err, user, identity);
}); });
}); });
}); });
@@ -134,7 +134,7 @@ export default function(UserIdent) {
debug('no user identity instance found'); debug('no user identity instance found');
return next(); return next();
} }
- userIdent.user(function(err, user) { + return userIdent.user(function(err, user) {
let userChanged = false; let userChanged = false;
if (err) { return next(err); } if (err) { return next(err); }
if (!user) { if (!user) {
@@ -175,11 +175,11 @@ export default function(UserIdent) {
if (userChanged) { if (userChanged) {
return user.save(function(err) { return user.save(function(err) {
if (err) { return next(err); } if (err) { return next(err); }
- next(); + return next();
}); });
} }
debug('exiting after user identity before save'); debug('exiting after user identity before save');
- next(); + return next();
}); });
}); });
} }
View
4 common/models/user.js
@@ -271,7 +271,7 @@ module.exports = function(User) {
)); ));
}); });
} }
- User.findOne({ where: { username } }, (err, user) => { + return User.findOne({ where: { username } }, (err, user) => {
if (err) { if (err) {
return cb(err); return cb(err);
} }
@@ -327,7 +327,7 @@ module.exports = function(User) {
.valueOf(); .valueOf();
const user$ = findUser({ where: { username: receiver }}); const user$ = findUser({ where: { username: receiver }});
- user$ + return user$
.tapOnNext((user) => { .tapOnNext((user) => {
if (!user) { if (!user) {
throw new Error(`could not find receiver for ${ receiver }`); throw new Error(`could not find receiver for ${ receiver }`);
View
4 common/utils/services-creator.js
@@ -1,4 +1,4 @@
-import{ Observable, Disposable } from 'rx'; +import { Observable, Disposable } from 'rx';
import Fetchr from 'fetchr'; import Fetchr from 'fetchr';
import stampit from 'stampit'; import stampit from 'stampit';
@@ -9,7 +9,7 @@ function callbackObserver(observer) {
} }
observer.onNext(res); observer.onNext(res);
- observer.onCompleted(); + return observer.onCompleted();
}; };
} }
View
4 package.json
@@ -49,7 +49,7 @@
"emmet-codemirror": "^1.2.5", "emmet-codemirror": "^1.2.5",
"errorhandler": "^1.4.2", "errorhandler": "^1.4.2",
"es6-map": "~0.1.1", "es6-map": "~0.1.1",
- "eslint": "~1.10.2", + "eslint": "^2.2.0",
"eslint-plugin-react": "^4.1.0", "eslint-plugin-react": "^4.1.0",
"express": "^4.13.3", "express": "^4.13.3",
"express-flash": "~0.0.2", "express-flash": "~0.0.2",
@@ -61,7 +61,7 @@
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-babel": "^6.1.1", "gulp-babel": "^6.1.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
- "gulp-eslint": "^1.1.0", + "gulp-eslint": "^2.0.0",
"gulp-jsonlint": "^1.1.0", "gulp-jsonlint": "^1.1.0",
"gulp-less": "^3.0.3", "gulp-less": "^3.0.3",
"gulp-nodemon": "^2.0.3", "gulp-nodemon": "^2.0.3",
View
35 server/boot/a-extendUser.js
@@ -21,7 +21,7 @@ module.exports = function(app) {
if (!id) { if (!id) {
return next(); return next();
} }
- Observable.combineLatest( + return Observable.combineLatest(
destroyAllRelated(id, UserIdentity), destroyAllRelated(id, UserIdentity),
destroyAllRelated(id, UserCredential), destroyAllRelated(id, UserCredential),
function(identData, credData) { function(identData, credData) {
@@ -30,19 +30,20 @@ module.exports = function(app) {
credData: credData credData: credData
}; };
} }
- ).subscribe( + )
- function(data) { + .subscribe(
- debug('deleted', data); + function(data) {
- }, + debug('deleted', data);
- function(err) { + },
- debug('error deleting user %s stuff', id, err); + function(err) {
- next(err); + debug('error deleting user %s stuff', id, err);
- }, + next(err);
- function() { + },
- debug('user stuff deleted for user %s', id); + function() {
- next(); + debug('user stuff deleted for user %s', id);
- } + next();
- ); + }
+ );
}); });
// set email varified false on user email signup // set email varified false on user email signup
@@ -82,15 +83,15 @@ module.exports = function(app) {
}; };
debug('sending welcome email'); debug('sending welcome email');
- Email.send(mailOptions, function(err) { + return Email.send(mailOptions, function(err) {
if (err) { return next(err); } if (err) { return next(err); }
- req.logIn(user, function(err) { + return req.logIn(user, function(err) {
if (err) { return next(err); } if (err) { return next(err); }
req.flash('success', { req.flash('success', {
msg: [ "Welcome to Free Code Camp! We've created your account." ] msg: [ "Welcome to Free Code Camp! We've created your account." ]
}); });
- res.redirect(redirect); + return res.redirect(redirect);
}); });
}); });
}); });
View
2 server/boot/a-extendUserIdent.js
@@ -1,4 +1,4 @@
-import{ Observable } from 'rx'; +import { Observable } from 'rx';
import debugFactory from 'debug'; import debugFactory from 'debug';
import dedent from 'dedent'; import dedent from 'dedent';
View
7 server/boot/challenge.js
@@ -120,6 +120,7 @@ function shouldShowNew(element, block) {
}, 0); }, 0);
return newCount / block.length * 100 === 100; return newCount / block.length * 100 === 100;
} }
+ return null;
} }
// meant to be used with a filter method // meant to be used with a filter method
@@ -516,7 +517,7 @@ module.exports = function(app) {
if (data.id) { if (data.id) {
res.cookie('currentChallengeId', data.id); res.cookie('currentChallengeId', data.id);
} }
- res.render(view, data); + return res.render(view, data);
}, },
next, next,
function() {} function() {}
@@ -585,7 +586,7 @@ module.exports = function(app) {
alreadyCompleted alreadyCompleted
}); });
} }
- res.sendStatus(200); + return res.sendStatus(200);
} }
); );
} }
@@ -652,7 +653,7 @@ module.exports = function(app) {
user.progressTimestamps.length + 1 user.progressTimestamps.length + 1
}); });
} }
- res.status(200).send(true); + return res.status(200).send(true);
}) })
.subscribe(() => {}, next); .subscribe(() => {}, next);
} }
View
2 server/boot/commit.js
@@ -217,7 +217,7 @@ export default function commit(app) {
}) })
.subscribe( .subscribe(
pledge => { pledge => {
- let msg = `You have successfully stopped your pledge.`; + let msg = 'You have successfully stopped your pledge.';
if (!pledge) { if (!pledge) {
msg = `No pledge found for user ${user.username}.`; msg = `No pledge found for user ${user.username}.`;
} }
View
6 server/boot/home.js
@@ -14,9 +14,9 @@ module.exports = function(app) {
return next(); return next();
} }
req.user.picture = defaultProfileImage; req.user.picture = defaultProfileImage;
- req.user.save(function(err) { + return req.user.save(function(err) {
if (err) { return next(err); } if (err) { return next(err); }
- next(); + return next();
}); });
} }
@@ -24,6 +24,6 @@ module.exports = function(app) {
if (req.user) { if (req.user) {
return res.redirect('/challenges/current-challenge'); return res.redirect('/challenges/current-challenge');
} }
- res.render('home', { title: message }); + return res.render('home', { title: message });
} }
}; };
View
38 server/boot/randomAPIs.js
@@ -145,7 +145,7 @@ module.exports = function(app) {
if (err) { if (err) {
return next(err); return next(err);
} }
- process.nextTick(function() { + return process.nextTick(function() {
res.header('Content-Type', 'application/xml'); res.header('Content-Type', 'application/xml');
res.render('resources/sitemap', { res.render('resources/sitemap', {
appUrl: appUrl, appUrl: appUrl,
@@ -227,14 +227,18 @@ module.exports = function(app) {
} }
function confirmStickers(req, res) { function confirmStickers(req, res) {
- req.flash('success', { msg: 'Thank you for supporting our community! You should receive your stickers in the ' + + req.flash('success', {
- 'mail soon!'}); + msg: 'Thank you for supporting our community! You should receive ' +
- res.redirect('/shop'); + 'your stickers in the mail soon!'
+ });
+ res.redirect('/shop');
} }
function cancelStickers(req, res) { function cancelStickers(req, res) {
- req.flash('info', { msg: 'You\'ve cancelled your purchase of our stickers. You can ' + req.flash('info', {
- + 'support our community any time by buying some.'}); + msg: 'You\'ve cancelled your purchase of our stickers. You can ' +
+ 'support our community any time by buying some.'
+ });
res.redirect('/shop'); res.redirect('/shop');
} }
function submitCatPhoto(req, res) { function submitCatPhoto(req, res) {
@@ -280,18 +284,14 @@ module.exports = function(app) {
function unsubscribe(req, res, next) { function unsubscribe(req, res, next) {
User.findOne({ where: { email: req.params.email } }, function(err, user) { User.findOne({ where: { email: req.params.email } }, function(err, user) {
if (user) { if (user) {
- if (err) { + if (err) { return next(err); }
- return next(err);
- }
user.sendMonthlyEmail = false; user.sendMonthlyEmail = false;
- user.save(function() { + return user.save(function() {
- if (err) { + if (err) { return next(err); }
- return next(err); + return res.redirect('/unsubscribed');
- }
- res.redirect('/unsubscribed');
}); });
} else { } else {
- res.redirect('/unsubscribed'); + return res.redirect('/unsubscribed');
} }
}); });
} }
@@ -330,7 +330,7 @@ module.exports = function(app) {
Object.keys(JSON.parse(pulls)).length : Object.keys(JSON.parse(pulls)).length :
'Can\'t connect to github'; 'Can\'t connect to github';
- request( + return request(
[ [
'https://api.github.com/repos/freecodecamp/', 'https://api.github.com/repos/freecodecamp/',
'freecodecamp/issues?client_id=', 'freecodecamp/issues?client_id=',
@@ -344,7 +344,7 @@ module.exports = function(app) {
issues = ((pulls === parseInt(pulls, 10)) && issues) ? issues = ((pulls === parseInt(pulls, 10)) && issues) ?
Object.keys(JSON.parse(issues)).length - pulls : Object.keys(JSON.parse(issues)).length - pulls :
"Can't connect to GitHub"; "Can't connect to GitHub";
- res.send({ + return res.send({
issues: issues, issues: issues,
pulls: pulls pulls: pulls
}); });
@@ -364,7 +364,7 @@ module.exports = function(app) {
(JSON.parse(trello)) : (JSON.parse(trello)) :
'Can\'t connect to to Trello'; 'Can\'t connect to to Trello';
- res.end(JSON.stringify(trello)); + return res.end(JSON.stringify(trello));
}); });
} }
@@ -379,7 +379,7 @@ module.exports = function(app) {
blog = (status && status.statusCode === 200) ? blog = (status && status.statusCode === 200) ?
JSON.parse(blog) : JSON.parse(blog) :
'Can\'t connect to Blogger'; 'Can\'t connect to Blogger';
- res.end(JSON.stringify(blog)); + return res.end(JSON.stringify(blog));
} }
); );
} }
View
4 server/boot/story.js
@@ -207,7 +207,7 @@ module.exports = function(app) {
return upvote.upVotedByUsername === username; return upvote.upVotedByUsername === username;
}); });
- res.render('stories/index', { + return res.render('stories/index', {
title: story.headline, title: story.headline,
link: story.link, link: story.link,
originalStoryLink: dashedName, originalStoryLink: dashedName,
@@ -357,7 +357,7 @@ module.exports = function(app) {
url = 'http://' + url; url = 'http://' + url;
} }
- findStory({ where: { link: url } }) + return findStory({ where: { link: url } })
.map(function(stories) { .map(function(stories) {
if (stories.length) { if (stories.length) {
return { return {
View
34 server/boot/user.js
@@ -195,7 +195,7 @@ module.exports = function(app) {
if (req.user) { if (req.user) {
return res.redirect('/'); return res.redirect('/');
} }
- res.render('account/signin', { + return res.render('account/signin', {
title: 'Sign in to Free Code Camp using a Social Media Account' title: 'Sign in to Free Code Camp using a Social Media Account'
}); });
} }
@@ -209,7 +209,7 @@ module.exports = function(app) {
if (req.user) { if (req.user) {
return res.redirect('/'); return res.redirect('/');
} }
- res.render('account/email-signin', { + return res.render('account/email-signin', {
title: 'Sign in to Free Code Camp using your Email Address' title: 'Sign in to Free Code Camp using your Email Address'
}); });
} }
@@ -218,7 +218,7 @@ module.exports = function(app) {
if (req.user) { if (req.user) {
return res.redirect('/'); return res.redirect('/');
} }
- res.render('account/email-signup', { + return res.render('account/email-signup', {
title: 'Sign up for Free Code Camp using your Email Address' title: 'Sign up for Free Code Camp using your Email Address'
}); });
} }
@@ -387,7 +387,7 @@ module.exports = function(app) {
req.flash('errors', { req.flash('errors', {
msg: `Looks like user ${username} is not ${certText[certType]}` msg: `Looks like user ${username} is not ${certText[certType]}`
}); });
- res.redirect('back'); + return res.redirect('back');
}, },
next next
); );
@@ -406,7 +406,7 @@ module.exports = function(app) {
section at the bottom of this page. section at the bottom of this page.
` `
}); });
- res.redirect('/' + req.user.username); + return res.redirect('/' + req.user.username);
}); });
} }
req.user.isLocked = true; req.user.isLocked = true;
@@ -420,7 +420,7 @@ module.exports = function(app) {
section at the bottom of this page. section at the bottom of this page.
` `
}); });
- res.redirect('/' + req.user.username); + return res.redirect('/' + req.user.username);
}); });
} }
@@ -429,7 +429,7 @@ module.exports = function(app) {
if (err) { return next(err); } if (err) { return next(err); }
req.logout(); req.logout();
req.flash('info', { msg: 'Your account has been deleted.' }); req.flash('info', { msg: 'Your account has been deleted.' });
- res.redirect('/'); + return res.redirect('/');
}); });
} }
@@ -438,7 +438,7 @@ module.exports = function(app) {
req.flash('errors', { msg: 'access token invalid' }); req.flash('errors', { msg: 'access token invalid' });
return res.render('account/forgot'); return res.render('account/forgot');
} }
- res.render('account/reset', { + return res.render('account/reset', {
title: 'Reset your Password', title: 'Reset your Password',
accessToken: req.accessToken.id accessToken: req.accessToken.id
}); });
@@ -453,14 +453,14 @@ module.exports = function(app) {
return res.redirect('back'); return res.redirect('back');
} }
- User.findById(req.accessToken.userId, function(err, user) { + return User.findById(req.accessToken.userId, function(err, user) {
- if (err) { return next(err); }
- user.updateAttribute('password', password, function(err) {
if (err) { return next(err); } if (err) { return next(err); }
+ return user.updateAttribute('password', password, function(err) {
+ if (err) { return next(err); }
debug('password reset processed successfully'); debug('password reset processed successfully');
req.flash('info', { msg: 'password reset processed successfully' }); req.flash('info', { msg: 'password reset processed successfully' });
- res.redirect('/'); + return res.redirect('/');
}); });
}); });
} }
@@ -469,7 +469,7 @@ module.exports = function(app) {
if (req.isAuthenticated()) { if (req.isAuthenticated()) {
return res.redirect('/'); return res.redirect('/');
} }
- res.render('account/forgot', { + return res.render('account/forgot', {
title: 'Forgot Password' title: 'Forgot Password'
}); });
} }
@@ -483,7 +483,7 @@ module.exports = function(app) {
return res.redirect('/forgot'); return res.redirect('/forgot');
} }
- User.resetPassword({ + return User.resetPassword({
email: email email: email
}, function(err) { }, function(err) {
if (err) { if (err) {
@@ -496,7 +496,7 @@ module.exports = function(app) {
email + email +
' with further instructions.' ' with further instructions.'
}); });
- res.render('account/forgot'); + return res.render('account/forgot');
}); });
} }
@@ -507,7 +507,7 @@ module.exports = function(app) {
if (err) { return next(err); } if (err) { return next(err); }
req.flash('success', { msg: 'Thanks for voting!' }); req.flash('success', { msg: 'Thanks for voting!' });
- res.redirect('/map'); + return res.redirect('/map');
}); });
} else { } else {
req.flash('error', { msg: 'You must be signed in to vote.' }); req.flash('error', { msg: 'You must be signed in to vote.' });
@@ -522,7 +522,7 @@ module.exports = function(app) {
if (err) { return next(err); } if (err) { return next(err); }
req.flash('success', { msg: 'Thanks for voting!' }); req.flash('success', { msg: 'Thanks for voting!' });
- res.redirect('/map'); + return res.redirect('/map');
}); });
} else { } else {
req.flash('error', {msg: 'You must be signed in to vote.'}); req.flash('error', {msg: 'You must be signed in to vote.'});
View
7 server/middlewares/add-return-to.js
@@ -36,8 +36,9 @@ export default function addReturnToUrl() {
) { ) {
return next(); return next();
} }
- req.session.returnTo = req.originalUrl === '/map-aside' + req.session.returnTo = req.originalUrl === '/map-aside' ?
- ? '/map' : req.originalUrl; + '/map' :
- next(); + req.originalUrl;
+ return next();
}; };
} }
View
2 server/middlewares/revision-helpers.js
@@ -26,6 +26,6 @@ export default function({ globalPrepend = '' } = {}) {
// in production we take use the initially loaded manifest // in production we take use the initially loaded manifest
// since this should not change in production // since this should not change in production
res.locals.rev = boundRev; res.locals.rev = boundRev;
- next(); + return next();
}; };
} }
View
2 server/services/hikes.js
@@ -25,7 +25,7 @@ export default function hikesService(app) {
if (err) { if (err) {
return cb(err); return cb(err);
} }
- cb(null, hikes.map(hike => hike.toJSON())); + return cb(null, hikes.map(hike => hike.toJSON()));
}); });
} }
}; };
View
4 server/services/job.js
@@ -22,7 +22,7 @@ export default function getJobServices(app) {
isApproved: false isApproved: false
}); });
- Job.create(job, (err, savedJob) => { + return Job.create(job, (err, savedJob) => {
cb(err, savedJob.toJSON()); cb(err, savedJob.toJSON());
}); });
}, },
@@ -33,7 +33,7 @@ export default function getJobServices(app) {
.then(job => cb(null, job.toJSON())) .then(job => cb(null, job.toJSON()))
.catch(cb); .catch(cb);
} }
- Job.find(whereFilt) + return Job.find(whereFilt)
.then(jobs => cb(null, jobs.map(job => job.toJSON()))) .then(jobs => cb(null, jobs.map(job => job.toJSON())))
.catch(cb); .catch(cb);
} }
View
2 server/utils/index.js
@@ -75,7 +75,7 @@ module.exports = {
result.image = urlImage; result.image = urlImage;
result.description = description; result.description = description;
- callback(null, result); + return callback(null, result);
}); });
}, },
View
4 server/utils/rx.js
@@ -10,13 +10,13 @@ export function saveInstance(instance) {
observer.onNext(); observer.onNext();
return observer.onCompleted(); return observer.onCompleted();
} }
- instance.save(function(err, savedInstance) { + return instance.save(function(err, savedInstance) {
if (err) { if (err) {
return observer.onError(err); return observer.onError(err);
} }
debug('instance saved'); debug('instance saved');
observer.onNext(savedInstance); observer.onNext(savedInstance);
- observer.onCompleted(); + return observer.onCompleted();
}); });
}); });
} }

0 comments on commit 74592e7

Please sign in to comment.
Something went wrong with that request. Please try again.