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',
'githubLink',
'challengeType',
'files',
'files'
]);

View File

@ -350,7 +350,9 @@ function createShowCert(app) {
messages: [
{
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) {
const path = req.path.split('/')[1];
if (/(^api$|^unauthenticated$|^internal$|^p$)/.test(path)) {
if ((/(^api$|^unauthenticated$|^internal$|^p$)/).test(path)) {
return next();
}
return protection(req, res, next);

View File

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

View File

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