start upgrading eslint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 16:57:10 +02:00
parent 90c917f69e
commit 621787915c
304 changed files with 5992 additions and 6394 deletions

View File

@@ -1,23 +1,21 @@
import get from 'lodash/get';
import findIndex from 'lodash/findIndex';
import i18n from '../i18n';
import preenTodos from '../libs/preenTodos';
import {
NotFound,
BadRequest,
} from '../libs/errors';
import get from 'lodash/get';
import findIndex from 'lodash/findIndex';
// TODO used only in client, move there?
export default function sortTask (user, req = {}) {
let id = get(req, 'params.id');
const id = get(req, 'params.id');
let to = get(req, 'query.to');
let fromParam = get(req, 'query.from');
let taskType = get(req, 'params.taskType');
const taskType = get(req, 'params.taskType');
let index = findIndex(user[`${taskType}s`], function findById (task) {
return task._id === id;
});
const index = findIndex(user[`${taskType}s`], task => task._id === id);
if (index === -1) {
throw new NotFound(i18n.t('messageTaskNotFound', req.language));
@@ -26,10 +24,10 @@ export default function sortTask (user, req = {}) {
throw new BadRequest('?to=__&from=__ are required');
}
let tasks = user[`${taskType}s`];
const tasks = user[`${taskType}s`];
if (taskType === 'todo') {
let preenedTasks = preenTodos(tasks);
const preenedTasks = preenTodos(tasks);
if (to !== -1) {
to = tasks.indexOf(preenedTasks[to]);
@@ -38,7 +36,7 @@ export default function sortTask (user, req = {}) {
fromParam = tasks.indexOf(preenedTasks[fromParam]);
}
let movedTask = tasks.splice(fromParam, 1)[0];
const movedTask = tasks.splice(fromParam, 1)[0];
if (to === -1) {
tasks.push(movedTask);