Upgrade tests tools and lint migrations and scripts (part 2) (#9998)

* upgrade gulp-babel

* upgrade babel-eslint

* upgrade eslint-friendly-formatter

* start upgrading chai

* start to upgrade eslint

* restore skipped tests

* start to upgrqde monk

* fix linting and remove unused file

* fix mocha notifications, and common tests

* fix unit tests

* start to fix initrgration tests

* more integration tests fixes

* upgrade monk to latest version

* lint /scripts

* migrations: start moving to /archive unused migrations and run eslint with --fix

* lint migrations

* fix more integration tests

* fix test
This commit is contained in:
Matteo Pagliazzi
2018-02-17 18:11:24 +01:00
committed by GitHub
parent b0ae0ef4da
commit 74ba55c20b
362 changed files with 8041 additions and 7813 deletions

View File

@@ -1,83 +0,0 @@
import {
shouldDo,
} from '../cron';
import moment from 'moment';
/*
Task classes given everything about the class
*/
// TODO move to the client
module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCron = Number(new Date()), showCompleted = false, main = false, processingYesterdailies = false) {
if (!task) {
return '';
}
let type = task.type;
let completed = task.completed;
let value = task.value;
let priority = task.priority;
if (main && !task._editing) {
for (let filter in filters) {
let enabled = filters[filter];
if (!task.tags) task.tags = [];
if (enabled && task.tags.indexOf(filter) === -1) {
return 'hidden';
}
}
}
let classes = task.type;
if (task._editing) {
classes += ' beingEdited';
}
if (type === 'todo' || type === 'daily') {
let dayShouldDo = moment();
if (processingYesterdailies) dayShouldDo.subtract(1, 'days');
let notDue = !shouldDo(Number(dayShouldDo), task, { dayStart });
let isNotDueDaily = type === 'daily' && notDue;
if (completed || isNotDueDaily) {
classes += ' completed';
} else {
classes += ' uncompleted';
}
} else if (type === 'habit') {
if (task.down && task.up) {
classes += ' habit-wide';
}
if (!task.down && !task.up) {
classes += ' habit-narrow';
}
}
if (priority === 0.1) {
classes += ' difficulty-trivial';
} else if (priority === 1) {
classes += ' difficulty-easy';
} else if (priority === 1.5) {
classes += ' difficulty-medium';
} else if (priority === 2) {
classes += ' difficulty-hard';
}
if (value < -20) {
classes += ' color-worst';
} else if (value < -10) {
classes += ' color-worse';
} else if (value < -1) {
classes += ' color-bad';
} else if (value < 1) {
classes += ' color-neutral';
} else if (value < 5) {
classes += ' color-good';
} else if (value < 10) {
classes += ' color-better';
} else {
classes += ' color-best';
}
return classes;
};