Permalink
Browse files

Update eslint, fix lint issues

  • Loading branch information...
1 parent c50510d commit 74592e72b474073af4c52162956e6cb0142af40d @BerkeleyTrue BerkeleyTrue committed Mar 3, 2016
View
@@ -1,6 +1,9 @@
{
- "ecmaFeatures": {
- "jsx": true
+ "parserOption": {
+ "ecmaVersion": 6,
+ "ecmaFeatures": {
+ "jsx": true
+ }
},
"env": {
"browser": true,
@@ -12,6 +15,7 @@
"react"
],
"globals": {
+ "Promise": true,
"window": true,
"$": true,
"ga": true,
@@ -58,7 +62,6 @@
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 0,
- "no-empty-label": 2,
"no-eq-null": 1,
"no-eval": 2,
"no-extend-native": 2,
@@ -182,10 +185,7 @@
"always"
],
"sort-vars": 0,
- "space-after-keywords": [
- 2,
- "always"
- ],
+ "keyword-spacing": [ 2 ],
"space-before-function-paren": [
2,
"never"
@@ -197,7 +197,6 @@
"space-in-brackets": 0,
"space-in-parens": 0,
"space-infix-ops": 2,
- "space-return-throw-case": 2,
"space-unary-ops": [
1,
{
@@ -214,7 +213,7 @@
"max-depth": 0,
"max-len": [
- 1,
+ 2,
80,
2
],
@@ -34,6 +34,7 @@ window.common = (function(global) {
}
}
}
+ return null;
},
isAlive: function(key) {
@@ -51,10 +51,10 @@ $(document).ready(function() {
<h1>${err}</h1>
`).subscribe(() => {});
}
+ return null;
},
err => console.error(err)
);
-
}
common.resetBtn$
@@ -74,6 +74,7 @@ $(document).ready(function() {
common.codeStorage.updateStorage(challengeName, originalCode);
common.codeUri.querify(originalCode);
common.updateOutputDisplay(output);
+ return null;
},
(err) => {
if (err) {
@@ -112,6 +113,7 @@ $(document).ready(function() {
if (solved) {
common.showCompletion();
}
+ return null;
},
({ err }) => {
console.error(err);
@@ -138,6 +140,7 @@ $(document).ready(function() {
return common.updateOutputDisplay('' + err);
}
common.displayTestResults(tests);
+ return null;
},
({ err }) => {
console.error(err);
@@ -149,7 +152,7 @@ $(document).ready(function() {
challengeType === challengeTypes.BONFIRE ||
challengeType === challengeTypes.JS
) {
- Observable.just({})
+ return Observable.just({})
.delay(500)
.flatMap(() => common.executeChallenge$())
.catch(err => Observable.just({ err }))
@@ -161,11 +164,13 @@ $(document).ready(function() {
}
common.codeStorage.updateStorage(challengeName, originalCode);
common.displayTestResults(tests);
+ return null;
},
(err) => {
console.error(err);
common.updateOutputDisplay('' + err);
}
);
}
+ return null;
});
@@ -110,7 +110,7 @@ window.common = (function({ common = { init: [] }}) {
return null;
}
execInProgress = true;
- setTimeout(function() {
+ return setTimeout(function() {
if (
$($('.scroll-locker').children()[0]).height() - 800 > e.detail
) {
@@ -92,18 +92,16 @@ window.common = (function({ $, common = { init: [] }}) {
}
function handleActionClick(e) {
- var props = common.challengeSeed[0] ||
- { stepIndex: [] };
+ var props = common.challengeSeed[0] || { stepIndex: [] };
var $el = $(this);
var index = +$el.attr('id');
var propIndex = props.stepIndex.indexOf(index);
if (propIndex === -1) {
- return $el
- .parent()
- .find('.disabled')
- .removeClass('disabled');
+ return $el.parent()
+ .find('.disabled')
+ .removeClass('disabled');
}
// an API action
@@ -112,30 +110,26 @@ window.common = (function({ $, common = { init: [] }}) {
var prop = props.properties[propIndex];
var api = props.apis[propIndex];
if (common[prop]) {
- return $el
- .parent()
- .find('.disabled')
- .removeClass('disabled');
- }
- $
- .post(api)
- .done(function(data) {
- // assume a boolean indicates passing
- if (typeof data === 'boolean') {
- return $el
- .parent()
+ return $el.parent()
.find('.disabled')
.removeClass('disabled');
- }
- // assume api returns string when fails
- $el
- .parent()
- .find('.disabled')
- .replaceWith('<p>' + data + '</p>');
- })
- .fail(function() {
- console.log('failed');
- });
+ }
+ return $.post(api)
+ .done(function(data) {
+ // assume a boolean indicates passing
+ if (typeof data === 'boolean') {
+ return $el.parent()
+ .find('.disabled')
+ .removeClass('disabled');
+ }
+ // assume api returns string when fails
+ return $el.parent()
+ .find('.disabled')
+ .replaceWith('<p>' + data + '</p>');
+ })
+ .fail(function() {
+ console.log('failed');
+ });
}
function handleFinishClick(e) {
@@ -199,6 +193,7 @@ window.common = (function({ $, common = { init: [] }}) {
$(nextBtnClass).click(handleNextStepClick);
$(actionBtnClass).click(handleActionClick);
$(finishBtnClass).click(handleFinishClick);
+ return null;
});
return common;
View
@@ -93,6 +93,7 @@ main = (function(main, global) {
'<span>Free Code Camp\'s Main Chat</span>' +
'</div>'
);
+ return null;
});
@@ -233,7 +234,7 @@ $(document).ready(function() {
};
$('#story-submit').unbind('click');
- $.post('/stories/', data)
+ return $.post('/stories/', data)
.fail(function() {
$('#story-submit').bind('click', storySubmitButtonHandler);
})
@@ -243,6 +244,7 @@ $(document).ready(function() {
return null;
}
window.location = '/stories/' + storyLink;
+ return null;
});
};
@@ -4,15 +4,16 @@
// errSaga(action: Action) => Object|Void
export default () => ({ dispatch }) => next => {
return function errorSaga(action) {
- if (!action.error) { return next(action); }
+ const result = next(action);
+ if (!action.error) { return result; }
console.error(action.error);
- dispatch({
+ return dispatch({
type: 'app.makeToast',
payload: {
type: 'error',
title: 'Oops, something went wrong',
- message: `Something went wrong, please try again later`
+ message: 'Something went wrong, please try again later'
}
});
};
@@ -103,6 +103,7 @@ class Question extends React.Component {
.subscribe();
this._subscriptions.add(subscription);
+ return null;
}
handleMouseMove(isPressed, { delta, moveQuestion }) {
@@ -132,7 +132,7 @@ export class NewJob extends React.Component {
if (certType === name) {
return fields[certType].onChange(true);
}
- fields[certType].onChange(false);
+ return fields[certType].onChange(false);
});
}
View
@@ -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();
- });
- });
- }
- }
- });
@@ -105,7 +105,7 @@ export default function contain(options = {}, Component) {
getChildContext(Component.contextTypes, this.context)
);
- professor.fetchContext.push({
+ return professor.fetchContext.push({
name: options.fetchAction,
action,
actionArgs,
@@ -136,7 +136,7 @@ export default function contain(options = {}, Component) {
() => {},
options.handleError
);
- this.__subscriptions.add(subscription);
+ return this.__subscriptions.add(subscription);
}
componentWillReceiveProps(nextProps, nextContext) {
@@ -17,7 +17,7 @@ export function fetch({ fetchContext = [] }) {
.doOnNext(fetch$ => {
if (!Observable.isObservable(fetch$)) {
throw new Error(
- `action creator should return an observable`
+ 'action creator should return an observable'
);
}
})
@@ -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 {
query = { username: userObj.username };
}
- userModel.findOrCreate({ where: query }, userObj, function(err, user) {
+ return userModel.findOrCreate({ where: query }, userObj, (err, user) => {
if (err) {
return cb(err);
}
var date = new Date();
- userIdentityModel.create({
+ return userIdentityModel.create({
provider: getSocialProvider(provider),
externalId: profile.id,
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');
return next();
}
- userIdent.user(function(err, user) {
+ return userIdent.user(function(err, user) {
let userChanged = false;
if (err) { return next(err); }
if (!user) {
@@ -175,11 +175,11 @@ export default function(UserIdent) {
if (userChanged) {
return user.save(function(err) {
if (err) { return next(err); }
- next();
+ return next();
});
}
debug('exiting after user identity before save');
- next();
+ return next();
});
});
}
Oops, something went wrong.

0 comments on commit 74592e7

Please sign in to comment.