Skip to content

Commit

Permalink
⏪Partial Revert of "Fix new eslint errors"
Browse files Browse the repository at this point in the history
  • Loading branch information
indeyets committed Mar 2, 2018
1 parent 7024b5b commit 355fcf1
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 84 deletions.
4 changes: 2 additions & 2 deletions app/models/attachment.js
Expand Up @@ -390,9 +390,9 @@ export function addModel(dbAdapter) {
if (originalImage === null) {
originalImage = promisifyAll(gm(originalFile));
}
for (const sizeId of thumbIds) { // eslint-disable-line no-await-in-loop
for (const sizeId of thumbIds) {
const { w, h } = this.imageSizes[sizeId];
await originalImage
await originalImage // eslint-disable-line no-await-in-loop
.resizeExact(w, h)
.profile(`${__dirname}/../../lib/assets/sRGB.icm`)
.autoOrient()
Expand Down
4 changes: 2 additions & 2 deletions app/support/DbAdapter/index.js
Expand Up @@ -59,9 +59,9 @@ class DbAdapterBase {
* @param transaction
*/
async executeSerizlizableTransaction(transaction) {
while (true) { // eslint-disable-line no-constant-condition, no-await-in-loop
while (true) { // eslint-disable-line no-constant-condition
try {
await this.database.transaction(async (trx) => {
await this.database.transaction(async (trx) => { // eslint-disable-line no-await-in-loop
await trx.raw('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE');
return transaction(trx);
});
Expand Down
6 changes: 3 additions & 3 deletions bin/count-daily-stats.js
Expand Up @@ -76,10 +76,10 @@ async function create_metric(metric, to_date, get_metric) {

dt = await get_next_metric_update_date(metric);

while (!dt.isAfter(to_date)) { // eslint-disable-line no-await-in-loop
while (!dt.isAfter(to_date)) {
const next_date = moment(dt).add(1, 'days');
const res = await get_metric(dt, next_date);
await postgres('stats').insert({ dt, metric, value: res });
const res = await get_metric(dt, next_date); // eslint-disable-line no-await-in-loop
await postgres('stats').insert({ dt, metric, value: res }); // eslint-disable-line no-await-in-loop

process.stdout.write(`Creating stats for ${metric} for ${dt.format(`YYYY-MM-DD`)}: ${res}\n`);

Expand Down
6 changes: 3 additions & 3 deletions bin/import_clikes.js
Expand Up @@ -23,10 +23,10 @@ async function main() {
const clikesData = JSON.parse(file);
const clikesCount = clikesData.length;

for (const i in clikesData) { // eslint-disable-line no-await-in-loop
for (const i in clikesData) {
const clike = clikesData[i];
process.stdout.write(`Processing clikes: ${parseInt(i) + 1} of ${clikesCount}\r`);
const [commentId, userId] = await dbAdapter._getCommentAndUserIntId(clike.comment_id, clike.user_id);
const [commentId, userId] = await dbAdapter._getCommentAndUserIntId(clike.comment_id, clike.user_id); // eslint-disable-line no-await-in-loop

if (!commentId) {
process.stderr.write(`Can't find comment "${clike.comment_id}": SKIP\n`);
Expand All @@ -45,7 +45,7 @@ async function main() {
};

try {
await postgres('comment_likes').insert(payload);
await postgres('comment_likes').insert(payload); // eslint-disable-line no-await-in-loop
} catch (e) {
if (e.message.includes('duplicate key value')) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions test/functional/postsV2.js
Expand Up @@ -48,8 +48,8 @@ describe('TimelinesControllerV2', () => {

describe('Comments folding test', () => {
const expectFolding = async (nComments, expComments, expOmitted, allComments = false) => {
for (let n = 0; n < nComments; n++) { // eslint-disable-line no-await-in-loop
await createCommentAsync(luna, lunaPost.id, `Comment ${n + 1}`);
for (let n = 0; n < nComments; n++) {
await createCommentAsync(luna, lunaPost.id, `Comment ${n + 1}`); // eslint-disable-line no-await-in-loop
}
const post = await fetchPost(lunaPost.id, null, { allComments });
expect(post.posts.comments, 'to have length', expComments);
Expand Down
8 changes: 4 additions & 4 deletions test/functional/usersV2.js
Expand Up @@ -163,9 +163,9 @@ describe('UsersControllerV2', () => {

beforeEach(async () => {
[user, ...readers] = await createTestUsers(readersCount + 1);
for (const reader of readers) { // eslint-disable-line no-await-in-loop
for (const reader of readers) {
// Order is important
await subscribeToAsync(reader, user);
await subscribeToAsync(reader, user); // eslint-disable-line no-await-in-loop
}
});

Expand All @@ -188,9 +188,9 @@ describe('UsersControllerV2', () => {

beforeEach(async () => {
[user, ...friends] = await createTestUsers(friendsCount + 1);
for (const friend of friends) { // eslint-disable-line no-await-in-loop
for (const friend of friends) {
// Order is important
await subscribeToAsync(user, friend);
await subscribeToAsync(user, friend); // eslint-disable-line no-await-in-loop
}
});

Expand Down
16 changes: 8 additions & 8 deletions test/unit/post.js
Expand Up @@ -397,8 +397,8 @@ describe('Post', () => {
})

it('should be possible to get all likes', async () => {
for (let i = 0; i < 10; i++) { // eslint-disable-line no-await-in-loop
await post.addLike(users[i]);
for (let i = 0; i < 10; i++) {
await post.addLike(users[i]); // eslint-disable-line no-await-in-loop
}

post.maxLikes = 'all'
Expand All @@ -415,8 +415,8 @@ describe('Post', () => {
})

it('should be possible to get some likes (properly sorted)', async () => {
for (let i = 0; i < 10; i++) { // eslint-disable-line no-await-in-loop
await post.addLike(users[i]);
for (let i = 0; i < 10; i++) {
await post.addLike(users[i]); // eslint-disable-line no-await-in-loop
}

post.maxLikes = 3
Expand All @@ -438,8 +438,8 @@ describe('Post', () => {
post.currentUser = users[0].id

// 2 likes -> 2 open
for (i = 0; i < 2; i++) { // eslint-disable-line no-await-in-loop
await post.addLike(users[i]);
for (i = 0; i < 2; i++) {
await post.addLike(users[i]); // eslint-disable-line no-await-in-loop
}

{
Expand Down Expand Up @@ -635,13 +635,13 @@ describe('Post', () => {
post = await userA.newPost(postAttrs)
await post.create()

for (let i = 0; i < 10; i++) { // eslint-disable-line no-await-in-loop
for (let i = 0; i < 10; i++) {
const commentAttrs = {
body: 'Comment body',
postId: post.id
}
comments[i] = userA.newComment(commentAttrs)
await comments[i].create();
await comments[i].create() // eslint-disable-line no-await-in-loop
}
})

Expand Down
96 changes: 48 additions & 48 deletions test/unit/post_bubbling.js
Expand Up @@ -55,15 +55,15 @@ describe('PostBubbling', () => {
await Promise.all([luna.create(), mars.create(), jupiter.create()]);

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -388,21 +388,21 @@ describe('PostBubbling', () => {
await Promise.all([luna.create(), mars.create(), pluto.create(), jupiter.create()]);

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

plutoPosts = []
for (const body of plutoPostsContent) { // eslint-disable-line no-await-in-loop
const post = await pluto.newPost({ body });
plutoPosts.push(await post.create());
for (const body of plutoPostsContent) {
const post = await pluto.newPost({ body }); // eslint-disable-line no-await-in-loop
plutoPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -472,9 +472,9 @@ describe('PostBubbling', () => {
await mars.subscribeTo(jupiterTimelineId)
await jupiter.subscribeTo(marsTimelineId)
const jupiterPosts = []
for (const body of jupiterPostsContent) { // eslint-disable-line no-await-in-loop
const post = await jupiter.newPost({ body });
jupiterPosts.push(await post.create());
for (const body of jupiterPostsContent) {
const post = await jupiter.newPost({ body }); // eslint-disable-line no-await-in-loop
jupiterPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -781,21 +781,21 @@ describe('PostBubbling', () => {
await luna.update({ isPrivate: '1' })

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

plutoPosts = []
for (const body of plutoPostsContent) { // eslint-disable-line no-await-in-loop
const post = await pluto.newPost({ body });
plutoPosts.push(await post.create());
for (const body of plutoPostsContent) {
const post = await pluto.newPost({ body }); // eslint-disable-line no-await-in-loop
plutoPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -848,27 +848,27 @@ describe('PostBubbling', () => {
easyfoxTimelineId = await easyfox.getPostsTimelineId()

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

plutoPosts = []
for (const body of plutoPostsContent) { // eslint-disable-line no-await-in-loop
const post = await pluto.newPost({ body });
plutoPosts.push(await post.create());
for (const body of plutoPostsContent) {
const post = await pluto.newPost({ body }); // eslint-disable-line no-await-in-loop
plutoPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

easyfoxPosts = []
for (const body of easyfoxPostsContent) { // eslint-disable-line no-await-in-loop
const post = await easyfox.newPost({ body, timelineIds: [easyfoxTimelineId] });
easyfoxPosts.push(await post.create());
for (const body of easyfoxPostsContent) {
const post = await easyfox.newPost({ body, timelineIds: [easyfoxTimelineId] }); // eslint-disable-line no-await-in-loop
easyfoxPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -964,21 +964,21 @@ describe('PostBubbling', () => {
await Promise.all([luna.create(), mars.create(), pluto.create()]);

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

plutoPosts = []
for (const body of plutoPostsContent) { // eslint-disable-line no-await-in-loop
const post = await pluto.newPost({ body });
plutoPosts.push(await post.create());
for (const body of plutoPostsContent) {
const post = await pluto.newPost({ body }); // eslint-disable-line no-await-in-loop
plutoPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}

const [marsTimelineId, lunaTimelineId, plutoTimelineId] = await Promise.all([
Expand Down
24 changes: 12 additions & 12 deletions test/unit/search.js
Expand Up @@ -26,9 +26,9 @@ describe('FullTextSearch', () => {
bannedByMarsUserIds = await mars.getBanIds()

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down Expand Up @@ -166,19 +166,19 @@ describe('FullTextSearch', () => {
bannedByMarsUserIds = await mars.getBanIds()

lunaPosts = []
for (const body of lunaPostsContent) { // eslint-disable-line no-await-in-loop
const post = await luna.newPost({ body });
lunaPosts.push(await post.create());
for (const body of lunaPostsContent) {
const post = await luna.newPost({ body }); // eslint-disable-line no-await-in-loop
lunaPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
saturnPosts = []
for (const body of saturnPostsContent) { // eslint-disable-line no-await-in-loop
const post = await saturn.newPost({ body });
saturnPosts.push(await post.create());
for (const body of saturnPostsContent) {
const post = await saturn.newPost({ body }); // eslint-disable-line no-await-in-loop
saturnPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
marsPosts = []
for (const body of marsPostsContent) { // eslint-disable-line no-await-in-loop
const post = await mars.newPost({ body });
marsPosts.push(await post.create());
for (const body of marsPostsContent) {
const post = await mars.newPost({ body }); // eslint-disable-line no-await-in-loop
marsPosts.push(await post.create()); // eslint-disable-line no-await-in-loop
}
})

Expand Down

0 comments on commit 355fcf1

Please sign in to comment.