fix lingering linting errors

This commit is contained in:
Cassie Tarakajian 2017-10-15 20:27:05 -07:00
parent 5de876e202
commit c30aba8e78
3 changed files with 21 additions and 22 deletions

View file

@ -118,11 +118,9 @@ export function listObjectsInS3ForUser(req, res) {
}
};
let assets = [];
const list = client.listObjects(params)
client.listObjects(params)
.on('data', (data) => {
assets = assets.concat(data["Contents"].map((object) => {
return { key: object["Key"], size: object["Size"] };
}));
assets = assets.concat(data.Contents.map(object => ({ key: object.Key, size: object.Size })));
})
.on('end', () => {
const projectAssets = [];
@ -131,7 +129,7 @@ export function listObjectsInS3ForUser(req, res) {
project.files.forEach((file) => {
if (!file.url) return;
const foundAsset = assets.find((asset) => file.url.includes(asset.key));
const foundAsset = assets.find(asset => file.url.includes(asset.key));
if (!foundAsset) return;
projectAssets.push({
name: file.name,

View file

@ -139,15 +139,15 @@ export function getProjectsForUserId(userId) {
export function getProjectAsset(req, res) {
Project.findById(req.params.project_id)
.populate('user', 'username')
.exec((err, project) => {
.exec((err, project) => { // eslint-disable-line
if (err) {
return res.status(404).send({ message: 'Project with that id does not exist' });
}
var assetURL = null;
var seekPath = req.params[0]; // req.params.asset_path;
var seekPathSplit = seekPath.split('/');
var seekFilename = seekPathSplit[seekPathSplit.length-1];
let assetURL = null;
const seekPath = req.params[0]; // req.params.asset_path;
const seekPathSplit = seekPath.split('/');
const seekFilename = seekPathSplit[seekPathSplit.length - 1];
project.files.forEach((file) => {
if (file.name === seekFilename) {
assetURL = file.url;
@ -156,11 +156,13 @@ export function getProjectAsset(req, res) {
if (!assetURL) {
return res.status(404).send({ message: 'Asset does not exist' });
} else {
request({ method: 'GET', url: assetURL, encoding: null }, (err, response, body) => {
res.send(body);
});
}
request({ method: 'GET', url: assetURL, encoding: null }, (innerErr, response, body) => {
if (innerErr) {
return res.status(404).send({ message: 'Asset does not exist' });
}
return res.send(body);
});
});
}
@ -199,7 +201,6 @@ export function getProjectsForUser(req, res) {
}
function bundleExternalLibs(project, zip, callback) {
const rootFile = project.files.find(file => file.name === 'root');
const indexHtml = project.files.find(file => file.name === 'index.html');
let numScriptsResolved = 0;
let numScriptTags = 0;

View file

@ -17,7 +17,7 @@ router.route('/signup').get((req, res) => {
if (req.user) {
return res.redirect('/');
}
res.send(renderIndex());
return res.send(renderIndex());
});
router.route('/projects/:project_id').get((req, res) => {
@ -40,7 +40,7 @@ router.route('/login').get((req, res) => {
if (req.user) {
return res.redirect('/');
}
res.send(renderIndex());
return res.send(renderIndex());
});
router.route('/reset-password').get((req, res) => {