add lint-fix task, fix linting errors in fetching examples code

This commit is contained in:
Cassie Tarakajian 2017-01-11 15:17:10 -05:00
parent 8120fdd7db
commit 1d6e59ada3
3 changed files with 25 additions and 25 deletions

View file

@ -6,6 +6,7 @@
"start": "BABEL_DISABLE_CACHE=1 NODE_ENV=development nodemon index.js",
"start:prod": "NODE_ENV=production node index.js",
"lint": "eslint client server",
"lint-fix": "eslint client server --fix",
"build": "NODE_ENV=production webpack --config webpack.config.prod.js --progress",
"test": "echo \"Error: no test specified\" && exit 1",
"fetch-examples": "node fetch-examples.js",

View file

@ -1,7 +1,7 @@
import rp from 'request-promise';
import Q from 'q';
import mongoose from 'mongoose';
import objectID from 'bson-objectid'
import objectID from 'bson-objectid';
import shortid from 'shortid';
import User from './models/user';
import Project from './models/project';
@ -88,7 +88,7 @@ function getCategories() {
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/en?client_id=' +
client_id + '&client_secret=' + client_secret,
method: 'GET',
headers: headers
headers
};
return rp(options).then(res => {
const json = JSON.parse(res);
@ -112,7 +112,7 @@ function getSketchesInCategories(categories) {
const options = {
url: category.url.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
method: 'GET',
headers: headers
headers
};
return rp(options).then(res => {
@ -131,14 +131,13 @@ function getSketchesInCategories(categories) {
} else {
projectName = category.name + ': ' + example.name.replace('.js', '');
}
projectsInOneCategory.push({sketchUrl: example.download_url, projectName: projectName});
projectsInOneCategory.push({ sketchUrl: example.download_url, projectName });
}
});
return projectsInOneCategory;
}).catch(err => {
throw err;
});
}));
}
@ -148,7 +147,7 @@ function getSketchContent(projectsInAllCategories) {
const options = {
url: project.sketchUrl.replace('?ref=master', '') + '?client_id=' + client_id + '&client_secret=' + client_secret,
method: 'GET',
headers: headers
headers
};
return rp(options).then(res => {
@ -175,7 +174,7 @@ function createProjectsInP5user(projectsInAllCategories) {
url: 'https://api.github.com/repos/processing/p5.js-website/contents/dist/assets/examples/assets?client_id=' +
client_id + '&client_secret=' + client_secret,
method: 'GET',
headers: headers
headers
};
rp(options).then(res => {
@ -322,7 +321,6 @@ function createProjectsInP5user(projectsInAllCategories) {
process.exit();
});
});
}).catch(err => {
throw err;
});

View file

@ -1,3 +1,4 @@
/* eslint-disable */
import mongoose from 'mongoose';
import path from 'path';
import { uniqWith, isEqual } from 'lodash';