Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prettier to 3.0.0 #3509

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .woodpecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pipeline:
- git submodule update

prettier_check:
image: tmknom/prettier:2.8.8
image: tmknom/prettier:3.0.0
commands:
- prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'

Expand Down
2 changes: 1 addition & 1 deletion api_tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"lemmy-js-client": "0.17.2-rc.13",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
Expand Down
62 changes: 31 additions & 31 deletions api_tests/src/comment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ afterAll(async () => {

function assertCommentFederation(
commentOne?: CommentView,
commentTwo?: CommentView
commentTwo?: CommentView,
) {
expect(commentOne?.comment.ap_id).toBe(commentTwo?.comment.ap_id);
expect(commentOne?.comment.content).toBe(commentTwo?.comment.content);
Expand Down Expand Up @@ -96,10 +96,10 @@ test("Update a comment", async () => {

let updateCommentRes = await editComment(
alpha,
commentRes.comment_view.comment.id
commentRes.comment_view.comment.id,
);
expect(updateCommentRes.comment_view.comment.content).toBe(
"A jest test federated comment update"
"A jest test federated comment update",
);
expect(updateCommentRes.comment_view.community.local).toBe(false);
expect(updateCommentRes.comment_view.creator.local).toBe(true);
Expand All @@ -117,21 +117,21 @@ test("Delete a comment", async () => {
let deleteCommentRes = await deleteComment(
alpha,
true,
commentRes.comment_view.comment.id
commentRes.comment_view.comment.id,
);
expect(deleteCommentRes.comment_view.comment.deleted).toBe(true);

// Make sure that comment is undefined on beta
let betaCommentRes = (await resolveComment(
beta,
commentRes.comment_view.comment
commentRes.comment_view.comment,
)) as any;
expect(betaCommentRes.error).toBe("couldnt_find_object");

let undeleteCommentRes = await deleteComment(
alpha,
false,
commentRes.comment_view.comment.id
commentRes.comment_view.comment.id,
);
expect(undeleteCommentRes.comment_view.comment.deleted).toBe(false);

Expand Down Expand Up @@ -162,7 +162,7 @@ test("Remove a comment from admin and community on the same instance", async ()
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
let refetchedPostComments = await getComments(
alpha,
postRes.post_view.post.id
postRes.post_view.post.id,
);
expect(refetchedPostComments.comments[0].comment.removed).toBe(true);

Expand All @@ -172,12 +172,12 @@ test("Remove a comment from admin and community on the same instance", async ()
// Make sure that comment is unremoved on beta
let refetchedPostComments2 = await getComments(
alpha,
postRes.post_view.post.id
postRes.post_view.post.id,
);
expect(refetchedPostComments2.comments[0].comment.removed).toBe(false);
assertCommentFederation(
refetchedPostComments2.comments[0],
unremoveCommentRes.comment_view
unremoveCommentRes.comment_view,
);
});

Expand All @@ -192,7 +192,7 @@ test("Remove a comment from admin and community on different instance", async ()
let newCommunity = await createCommunity(newAlphaApi);
let newPost = await createPost(
newAlphaApi,
newCommunity.community_view.community.id
newCommunity.community_view.community.id,
);
let commentRes = await createComment(newAlphaApi, newPost.post_view.post.id);
expect(commentRes.comment_view.comment.content).toBeDefined();
Expand All @@ -209,19 +209,19 @@ test("Remove a comment from admin and community on different instance", async ()
let removeCommentRes = await removeComment(
beta,
true,
betaComment.comment.id
betaComment.comment.id,
);
expect(removeCommentRes.comment_view.comment.removed).toBe(true);

// Make sure its not removed on alpha
let refetchedPostComments = await getComments(
alpha,
newPost.post_view.post.id
newPost.post_view.post.id,
);
expect(refetchedPostComments.comments[0].comment.removed).toBe(false);
assertCommentFederation(
refetchedPostComments.comments[0],
commentRes.comment_view
commentRes.comment_view,
);
});

Expand Down Expand Up @@ -277,13 +277,13 @@ test("Reply to a comment", async () => {
let replyRes = await createComment(
beta,
betaComment.post.id,
betaComment.comment.id
betaComment.comment.id,
);
expect(replyRes.comment_view.comment.content).toBeDefined();
expect(replyRes.comment_view.community.local).toBe(true);
expect(replyRes.comment_view.creator.local).toBe(true);
expect(getCommentParentId(replyRes.comment_view.comment)).toBe(
betaComment.comment.id
betaComment.comment.id,
);
expect(replyRes.comment_view.counts.score).toBe(1);

Expand All @@ -295,7 +295,7 @@ test("Reply to a comment", async () => {
let alphaComment = postComments.comments[0];
expect(alphaComment.comment.content).toBeDefined();
expect(getCommentParentId(alphaComment.comment)).toBe(
postComments.comments[1].comment.id
postComments.comments[1].comment.id,
);
expect(alphaComment.community.local).toBe(false);
expect(alphaComment.creator.local).toBe(false);
Expand All @@ -311,7 +311,7 @@ test("Mention beta", async () => {
alpha,
postRes.post_view.post.id,
commentRes.comment_view.comment.id,
mentionContent
mentionContent,
);
expect(mentionRes.comment_view.comment.content).toBeDefined();
expect(mentionRes.comment_view.community.local).toBe(false);
Expand Down Expand Up @@ -358,7 +358,7 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t
gamma,
gammaPost.post.id,
undefined,
commentContent
commentContent,
);
expect(commentRes.comment_view.comment.content).toBe(commentContent);
expect(commentRes.comment_view.community.local).toBe(false);
Expand All @@ -368,15 +368,15 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t
// Make sure alpha sees it
let alphaPostComments2 = await getComments(
alpha,
alphaPost.post_view.post.id
alphaPost.post_view.post.id,
);
expect(alphaPostComments2.comments[0].comment.content).toBe(commentContent);
expect(alphaPostComments2.comments[0].community.local).toBe(true);
expect(alphaPostComments2.comments[0].creator.local).toBe(false);
expect(alphaPostComments2.comments[0].counts.score).toBe(1);
assertCommentFederation(
alphaPostComments2.comments[0],
commentRes.comment_view
commentRes.comment_view,
);

// Make sure beta has mentions
Expand Down Expand Up @@ -421,7 +421,7 @@ test("Check that activity from another instance is sent to third instance", asyn
gamma,
gammaPost.post.id,
undefined,
commentContent
commentContent,
);
expect(commentRes.comment_view.comment.content).toBe(commentContent);
expect(commentRes.comment_view.community.local).toBe(false);
Expand All @@ -436,7 +436,7 @@ test("Check that activity from another instance is sent to third instance", asyn
expect(alphaPostComments2.comments[0].counts.score).toBe(1);
assertCommentFederation(
alphaPostComments2.comments[0],
commentRes.comment_view
commentRes.comment_view,
);

await unfollowRemotes(alpha);
Expand All @@ -447,7 +447,7 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
// Unfollow all remote communities
let site = await unfollowRemotes(alpha);
expect(
site.my_user?.follows.filter(c => c.community.local == false).length
site.my_user?.follows.filter(c => c.community.local == false).length,
).toBe(0);

// B creates a post, and two comments, should be invisible to A
Expand All @@ -459,10 +459,10 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
beta,
postRes.post_view.post.id,
undefined,
parentCommentContent
parentCommentContent,
);
expect(parentCommentRes.comment_view.comment.content).toBe(
parentCommentContent
parentCommentContent,
);

// B creates a comment, then a child one of that.
Expand All @@ -471,10 +471,10 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
beta,
postRes.post_view.post.id,
parentCommentRes.comment_view.comment.id,
childCommentContent
childCommentContent,
);
expect(childCommentRes.comment_view.comment.content).toBe(
childCommentContent
childCommentContent,
);

// Follow beta again
Expand All @@ -487,7 +487,7 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
let updateRes = await editComment(
beta,
childCommentRes.comment_view.comment.id,
updatedCommentContent
updatedCommentContent,
);
expect(updateRes.comment_view.comment.content).toBe(updatedCommentContent);

Expand All @@ -502,11 +502,11 @@ test("Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
expect(alphaPost.post_view.post.name).toBeDefined();
assertCommentFederation(
alphaPostComments.comments[1],
parentCommentRes.comment_view
parentCommentRes.comment_view,
);
assertCommentFederation(
alphaPostComments.comments[0],
updateRes.comment_view
updateRes.comment_view,
);
expect(alphaPost.post_view.community.local).toBe(false);
expect(alphaPost.post_view.creator.local).toBe(false);
Expand Down Expand Up @@ -539,7 +539,7 @@ test("Report a comment", async () => {
expect(betaReport).toBeDefined();
expect(betaReport.resolved).toBe(false);
expect(betaReport.original_comment_text).toBe(
alphaReport.original_comment_text
alphaReport.original_comment_text,
);
expect(betaReport.reason).toBe(alphaReport.reason);
});
34 changes: 17 additions & 17 deletions api_tests/src/community.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ beforeAll(async () => {

function assertCommunityFederation(
communityOne?: CommunityView,
communityTwo?: CommunityView
communityTwo?: CommunityView,
) {
expect(communityOne?.community.actor_id).toBe(
communityTwo?.community.actor_id
communityTwo?.community.actor_id,
);
expect(communityOne?.community.name).toBe(communityTwo?.community.name);
expect(communityOne?.community.title).toBe(communityTwo?.community.title);
expect(communityOne?.community.description).toBe(
communityTwo?.community.description
communityTwo?.community.description,
);
expect(communityOne?.community.icon).toBe(communityTwo?.community.icon);
expect(communityOne?.community.banner).toBe(communityTwo?.community.banner);
expect(communityOne?.community.published).toBe(
communityTwo?.community.published
communityTwo?.community.published,
);
expect(communityOne?.community.nsfw).toBe(communityTwo?.community.nsfw);
expect(communityOne?.community.removed).toBe(communityTwo?.community.removed);
Expand Down Expand Up @@ -81,35 +81,35 @@ test("Delete community", async () => {
let deleteCommunityRes = await deleteCommunity(
beta,
true,
communityRes.community_view.community.id
communityRes.community_view.community.id,
);
expect(deleteCommunityRes.community_view.community.deleted).toBe(true);
expect(deleteCommunityRes.community_view.community.title).toBe(
communityRes.community_view.community.title
communityRes.community_view.community.title,
);

// Make sure it got deleted on A
let communityOnAlphaDeleted = await getCommunity(
alpha,
alphaCommunity.community.id
alphaCommunity.community.id,
);
expect(communityOnAlphaDeleted.community_view.community.deleted).toBe(true);

// Undelete
let undeleteCommunityRes = await deleteCommunity(
beta,
false,
communityRes.community_view.community.id
communityRes.community_view.community.id,
);
expect(undeleteCommunityRes.community_view.community.deleted).toBe(false);

// Make sure it got undeleted on A
let communityOnAlphaUnDeleted = await getCommunity(
alpha,
alphaCommunity.community.id
alphaCommunity.community.id,
);
expect(communityOnAlphaUnDeleted.community_view.community.deleted).toBe(
false
false,
);
});

Expand All @@ -133,35 +133,35 @@ test("Remove community", async () => {
let removeCommunityRes = await removeCommunity(
beta,
true,
communityRes.community_view.community.id
communityRes.community_view.community.id,
);
expect(removeCommunityRes.community_view.community.removed).toBe(true);
expect(removeCommunityRes.community_view.community.title).toBe(
communityRes.community_view.community.title
communityRes.community_view.community.title,
);

// Make sure it got Removed on A
let communityOnAlphaRemoved = await getCommunity(
alpha,
alphaCommunity.community.id
alphaCommunity.community.id,
);
expect(communityOnAlphaRemoved.community_view.community.removed).toBe(true);

// unremove
let unremoveCommunityRes = await removeCommunity(
beta,
false,
communityRes.community_view.community.id
communityRes.community_view.community.id,
);
expect(unremoveCommunityRes.community_view.community.removed).toBe(false);

// Make sure it got undeleted on A
let communityOnAlphaUnRemoved = await getCommunity(
alpha,
alphaCommunity.community.id
alphaCommunity.community.id,
);
expect(communityOnAlphaUnRemoved.community_view.community.removed).toBe(
false
false,
);
});

Expand Down Expand Up @@ -220,7 +220,7 @@ test("Admin actions in remote community are not federated to origin", async () =
bannedUserInfo2.person.id,
betaCommunity.community.id,
true,
true
true,
);
expect(banRes.banned).toBe(true);

Expand Down
2 changes: 1 addition & 1 deletion api_tests/src/follow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test("Follow federated community", async () => {
// Check it from local
let site = await getSite(alpha);
let remoteCommunityId = site.my_user?.follows.find(
c => c.community.local == false
c => c.community.local == false,
)?.community.id;
expect(remoteCommunityId).toBeDefined();
expect(site.my_user?.follows.length).toBe(2);
Expand Down
Loading