Adds liniting into the workflow (#3082)

* initial linting of src

* fix indent to 2 spaces

* Removes unnecessary rules

* ignore spec folder for now

* Spec linting

* Fix spec indent

* nits

* nits

* no no-empty rule
This commit is contained in:
Florent Vilmart
2016-11-24 15:47:41 -05:00
committed by GitHub
parent 6e2fba4ae4
commit 8c2c76dd26
149 changed files with 3478 additions and 3507 deletions

View File

@@ -5,7 +5,7 @@ const PUSH_STATUS_COLLECTION = '_PushStatus';
const JOB_STATUS_COLLECTION = '_JobStatus';
export function flatten(array) {
return array.reduce((memo, element) => {
return array.reduce((memo, element) => {
if (Array.isArray(element)) {
memo = memo.concat(flatten(element));
} else {
@@ -19,8 +19,8 @@ function statusHandler(className, database) {
let lastPromise = Promise.resolve();
function create(object) {
lastPromise = lastPromise.then(() => {
return database.create(className, object).then(() => {
lastPromise = lastPromise.then(() => {
return database.create(className, object).then(() => {
return Promise.resolve(object);
});
});
@@ -28,7 +28,7 @@ function statusHandler(className, database) {
}
function update(where, object) {
lastPromise = lastPromise.then(() => {
lastPromise = lastPromise.then(() => {
return database.update(className, where, object);
});
return lastPromise;
@@ -44,7 +44,6 @@ export function jobStatusHandler(config) {
let jobStatus;
let objectId = newObjectId();
let database = config.database;
let lastPromise = Promise.resolve();
let handler = statusHandler(JOB_STATUS_COLLECTION, database);
let setRunning = function(jobName, params) {
let now = new Date();
@@ -138,7 +137,7 @@ export function pushStatusHandler(config) {
let setRunning = function(installations) {
logger.verbose('sending push to %d installations', installations.length);
return handler.update({status:"pending", objectId: objectId},
return handler.update({status:"pending", objectId: objectId},
{status: "running", updatedAt: new Date() });
}
@@ -151,7 +150,7 @@ export function pushStatusHandler(config) {
};
if (Array.isArray(results)) {
results = flatten(results);
results.reduce((memo, result) => {
results.reduce((memo, result) => {
// Cannot handle that
if (!result || !result.device || !result.device.deviceType) {
return memo;