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,7 +1,7 @@
import content from '../content/index';
import i18n from '../i18n';
import get from 'lodash/get';
import pick from 'lodash/pick';
import content from '../content/index';
import i18n from '../i18n';
import splitWhitespace from '../libs/splitWhitespace';
import {
NotFound,
@@ -13,9 +13,9 @@ import {
const ACCEPTEDTYPES = ['eggs', 'hatchingPotions', 'food'];
export default function sell (user, req = {}) {
let key = get(req.params, 'key');
let type = get(req.params, 'type');
let amount = get(req.query, 'amount', 1);
const key = get(req.params, 'key');
const type = get(req.params, 'type');
const amount = get(req.query, 'amount', 1);
if (amount < 0) {
throw new BadRequest(i18n.t('positiveAmountRequired', req.language));
@@ -30,17 +30,17 @@ export default function sell (user, req = {}) {
}
if (ACCEPTEDTYPES.indexOf(type) === -1) {
throw new NotAuthorized(i18n.t('typeNotSellable', {acceptedTypes: ACCEPTEDTYPES.join(', ')}, req.language));
throw new NotAuthorized(i18n.t('typeNotSellable', { acceptedTypes: ACCEPTEDTYPES.join(', ') }, req.language));
}
if (!user.items[type][key]) {
throw new NotFound(i18n.t('userItemsKeyNotFound', {type}, req.language));
throw new NotFound(i18n.t('userItemsKeyNotFound', { type }, req.language));
}
let currentAmount = user.items[type][key];
const currentAmount = user.items[type][key];
if (amount > currentAmount) {
throw new NotFound(i18n.t('userItemsNotEnough', {type}, req.language));
throw new NotFound(i18n.t('userItemsNotEnough', { type }, req.language));
}
if (type === 'food' && key === 'Saddle') {