fix linting

This commit is contained in:
Matteo Pagliazzi
2018-02-17 18:41:49 +01:00
parent 80fe58bc6f
commit b619496f8e
6 changed files with 14 additions and 14 deletions

View File

@@ -74,8 +74,8 @@ module.exports = async function achievementRestore () {
const userIds = [
];
for (let index in userIds) {
/* eslint-disable no-await-in-loop */
for (let index in userIds) {
const userId = userIds[index];
const oldUser = await UsersOld.findOne({_id: userId}, 'achievements');
const newUser = await Users.findOne({_id: userId}, 'achievements');

View File

@@ -478,8 +478,8 @@ describe('POST /chat', () => {
context('Spam prevention', () => {
it('Returns an error when the user has been posting too many messages', async () => {
// Post as many messages are needed to reach the spam limit
for (let i = 0; i < SPAM_MESSAGE_LIMIT; i++) {
let result = await additionalMember.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage }); // eslint-disable-line no-await-in-loop
for (let i = 0; i < SPAM_MESSAGE_LIMIT; i++) { // eslint-disable-line no-await-in-loop
let result = await additionalMember.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage });
expect(result.message.id).to.exist;
}
@@ -494,8 +494,8 @@ describe('POST /chat', () => {
let userSocialite = await member.update({'contributor.level': SPAM_MIN_EXEMPT_CONTRIB_LEVEL, 'flags.chatRevoked': false});
// Post 1 more message than the spam limit to ensure they do not reach the limit
for (let i = 0; i < SPAM_MESSAGE_LIMIT + 1; i++) {
let result = await userSocialite.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage }); // eslint-disable-line no-await-in-loop
for (let i = 0; i < SPAM_MESSAGE_LIMIT + 1; i++) { // eslint-disable-line no-await-in-loop
let result = await userSocialite.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage });
expect(result.message.id).to.exist;
}
});

View File

@@ -113,10 +113,10 @@ describe('GET /tasks/user', () => {
await user.sync();
let initialTodoCount = user.tasksOrder.todos.length;
for (let i = 0; i < numberOfTodos; i++) {
for (let i = 0; i < numberOfTodos; i++) { // eslint-disable-line no-await-in-loop
let id = todos[i]._id;
await user.post(`/tasks/${id}/score/up`); // eslint-disable-line no-await-in-loop
await user.post(`/tasks/${id}/score/up`);
}
await user.sync();

View File

@@ -33,9 +33,9 @@ describe('POST /tasks/clearCompletedTodos', () => {
let tasks = await user.get('/tasks/user?type=todos');
expect(tasks.length).to.equal(initialTodoCount + 7);
for (let task of tasks) {
for (let task of tasks) { // eslint-disable-line no-await-in-loop
if (['todo 2', 'todo 3', 'todo 6'].indexOf(task.text) !== -1) {
await user.post(`/tasks/${task._id}/score/up`); // eslint-disable-line no-await-in-loop
await user.post(`/tasks/${task._id}/score/up`);
}
}

View File

@@ -21,7 +21,7 @@ export function fetch (store, options = {}) { // eslint-disable-line no-shadow
export async function set (store, changes) {
const user = store.state.user.data;
for (let key in changes) {
for (let key in changes) { // eslint-disable-line no-await-in-loop
if (key === 'tags') {
// Keep challenge and group tags
const oldTags = user.tags.filter(t => {
@@ -31,7 +31,7 @@ export async function set (store, changes) {
user.tags = changes[key].concat(oldTags);
// Remove deleted tags from tasks
const userTasksByType = (await store.dispatch('tasks:fetchUserTasks')).data; // eslint-disable-line no-await-in-loop
const userTasksByType = (await store.dispatch('tasks:fetchUserTasks')).data;
Object.keys(userTasksByType).forEach(taskType => {
userTasksByType[taskType].forEach(task => {

View File

@@ -33,16 +33,16 @@ api.verifyGemPurchase = async function verifyGemPurchase (user, receipt, headers
let correctReceipt = false;
// Purchasing one item at a time (processing of await(s) below is sequential not parallel)
for (let index in purchaseDataList) {
for (let index in purchaseDataList) { // eslint-disable-line no-await-in-loop
let purchaseData = purchaseDataList[index];
let token = purchaseData.transactionId;
let existingReceipt = await IapPurchaseReceipt.findOne({ // eslint-disable-line no-await-in-loop
let existingReceipt = await IapPurchaseReceipt.findOne({
_id: token,
}).exec();
if (!existingReceipt) {
await IapPurchaseReceipt.create({ // eslint-disable-line no-await-in-loop
await IapPurchaseReceipt.create({
_id: token,
consumed: true,
userId: user._id,