chore: Fix api linting

This commit is contained in:
Bouncey
2019-02-16 00:31:05 +00:00
committed by mrugesh mohapatra
parent 09e563f742
commit 0ccd0a6f77
6 changed files with 25 additions and 22 deletions

View File

@ -18,5 +18,5 @@ export const fixCompletedChallengeItem = obj =>
'solution', 'solution',
'githubLink', 'githubLink',
'challengeType', 'challengeType',
'files', 'files'
]); ]);

View File

@ -350,7 +350,9 @@ function createShowCert(app) {
messages: [ messages: [
{ {
type: 'info', type: 'info',
message: `We could not find a user with the username "${username}"` message: `We could not find a user with the username "${
username
}"`
} }
] ]
}); });

View File

@ -11,7 +11,7 @@ export default function() {
return function csrf(req, res, next) { return function csrf(req, res, next) {
const path = req.path.split('/')[1]; const path = req.path.split('/')[1];
if (/(^api$|^unauthenticated$|^internal$|^p$)/.test(path)) { if ((/(^api$|^unauthenticated$|^internal$|^p$)/).test(path)) {
return next(); return next();
} }
return protection(req, res, next); return protection(req, res, next);

View File

@ -22,26 +22,27 @@ export function getLybsynFeed() {
} catch (err) { } catch (err) {
return reject(err); return reject(err);
} }
const items = feed.map( const items = feed
item => _.pick(item, [ .map(item =>
'full_item_url', _.pick(item, [
'item_title', 'full_item_url',
'release_date', 'item_title',
'item_body_short' 'release_date',
]) 'item_body_short'
) ])
/* eslint-disable camelcase */ )
.map(({ full_item_url, item_title, release_date, item_body_short}) => ({ /* eslint-disable camelcase */
title: item_title, .map(
extract: item_body_short, ({ full_item_url, item_title, release_date, item_body_short }) => ({
isoDate: new Date(release_date).toISOString(), title: item_title,
link: full_item_url extract: item_body_short,
})); isoDate: new Date(release_date).toISOString(),
link: full_item_url
})
);
/* eslint-enable camelcase */ /* eslint-enable camelcase */
return resolve(items); return resolve(items);
}); });
}); });
}); });
} }

View File

@ -22,7 +22,7 @@ export default function populateUser(db, user) {
db.collection('user') db.collection('user')
.aggregate([ .aggregate([
{ $match: { _id: user.id } }, { $match: { _id: user.id } },
{ $project: { points: { $size: '$progressTimestamps' } } }, { $project: { points: { $size: '$progressTimestamps' } } }
]) ])
.get(function(err, [{ points = 1 } = {}]) { .get(function(err, [{ points = 1 } = {}]) {
if (err) { if (err) {