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

Format the files #382

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Format the files #382

merged 1 commit into from
Jan 18, 2024

Conversation

cnnrbrn
Copy link
Contributor

@cnnrbrn cnnrbrn commented Dec 28, 2023

All files opened and formatted with default Prettier extension settings

Summary by CodeRabbit

  • Style: Implemented consistent code formatting across the entire project. This includes proper indentation, addition of semicolons at the end of statements, and adjustments to string literal quotes.
  • Refactor: Improved error handling for failed API requests in the deletePost function.
  • Chore: Adjusted the initialization of the url variable using the URL constructor in apiBase.

These changes enhance the readability and maintainability of the code but do not introduce any new features or directly impact the user experience.

All files opened and formatted with default Prettier extension settings
@cnnrbrn cnnrbrn requested a review from Fermain December 28, 2023 23:45
Copy link

github-actions bot commented Dec 28, 2023

Image description CodeRabbit

Walkthrough

The changes primarily focus on code formatting and consistency across multiple JavaScript files. Semicolons have been added at the end of statements, indentation has been adjusted for readability, and error handling has been improved in certain functions. The logic and functionality of the code remain unaffected.

Changes

Files Summary
index.js, src/js/api/*, src/js/data/*, src/js/listeners/*, src/js/router/*, src/js/storage/*, src/js/templates/*, src/js/tools/* Code formatting has been standardized with semicolons added at the end of statements and consistent indentation. Error handling was improved in some API functions.
src/js/ui/*, src/js/views/* Formatting changes include addition of semicolons, adjustments to indentation, and changes to string literal quotes. No alterations to function signatures or behavior.

🐇💻

In the land of code, where the semicolons lie,

A rabbit hopped through, with a discerning eye.

With each line it read, it twitched its nose,

"Aha!" it exclaimed, "Here's what I propose!"

Indentations here, and semicolons there,

Now the code is clean, as fresh as morning air!

So let's hop along, with no despair,

For in our code, now, no bugs dare! 🎉🥕


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 5cdcf16 and 4c023d6 commits.
Files selected (82)
  • index.html (1)
  • index.js (1)
  • src/js/api/apiBase.js (1)
  • src/js/api/auth/index.js (1)
  • src/js/api/auth/login.js (1)
  • src/js/api/auth/logout.js (1)
  • src/js/api/auth/register.js (1)
  • src/js/api/auth/state.js (1)
  • src/js/api/constants.js (1)
  • src/js/api/headers.js (1)
  • src/js/api/index.js (1)
  • src/js/api/posts/comment.js (1)
  • src/js/api/posts/create.js (1)
  • src/js/api/posts/delete.js (1)
  • src/js/api/posts/index.js (1)
  • src/js/api/posts/react.js (1)
  • src/js/api/posts/read.js (1)
  • src/js/api/posts/update.js (1)
  • src/js/api/profiles/delete.js (1)
  • src/js/api/profiles/follow.js (1)
  • src/js/api/profiles/index.js (1)
  • src/js/api/profiles/read.js (1)
  • src/js/api/profiles/unfollow.js (1)
  • src/js/api/profiles/update.js (1)
  • src/js/data/blank/post.js (1)
  • src/js/index.js (1)
  • src/js/listeners/auth/index.js (1)
  • src/js/listeners/auth/login.js (1)
  • src/js/listeners/auth/logout.js (1)
  • src/js/listeners/auth/register.js (1)
  • src/js/listeners/index.js (1)
  • src/js/listeners/post/comment.js (1)
  • src/js/listeners/post/index.js (1)
  • src/js/listeners/post/reaction.js (1)
  • src/js/listeners/profile/follow.js (1)
  • src/js/listeners/profile/index.js (1)
  • src/js/listeners/profile/unfollow.js (1)
  • src/js/router/index.js (1)
  • src/js/router/searchParams.js (1)
  • src/js/storage/index.js (1)
  • src/js/storage/load.js (1)
  • src/js/storage/save.js (1)
  • src/js/templates/comment/badge.js (1)
  • src/js/templates/comment/comment.js (1)
  • src/js/templates/comment/form.js (1)
  • src/js/templates/comment/index.js (1)
  • src/js/templates/index.js (1)
  • src/js/templates/instance.js (1)
  • src/js/templates/post/actions.js (1)
  • src/js/templates/post/comments.js (1)
  • src/js/templates/post/footer.js (1)
  • src/js/templates/post/form.js (1)
  • src/js/templates/post/header.js (1)
  • src/js/templates/post/index.js (1)
  • src/js/templates/post/loader.js (1)
  • src/js/templates/post/media.js (1)
  • src/js/templates/post/page.js (1)
  • src/js/templates/post/reactions.js (1)
  • src/js/templates/post/tabs.js (1)
  • src/js/templates/post/tags.js (1)
  • src/js/templates/post/thumbnail.js (1)
  • src/js/templates/profile/button.js (1)
  • src/js/templates/profile/followers.js (1)
  • src/js/templates/profile/following.js (1)
  • src/js/templates/profile/follows.js (1)
  • src/js/templates/profile/index.js (1)
  • src/js/templates/profile/page.js (1)
  • src/js/templates/profile/thumbnail.js (1)
  • src/js/tools/clear.js (1)
  • src/js/tools/emojiSubset.js (1)
  • src/js/tools/index.js (1)
  • src/js/ui/auth.js (1)
  • src/js/ui/footer.js (1)
  • src/js/ui/header.js (1)
  • src/js/ui/index.js (1)
  • src/js/ui/modals.js (1)
  • src/js/ui/renderView.js (1)
  • src/js/views/index.js (1)
  • src/js/views/postList.js (1)
  • src/js/views/postPage.js (1)
  • src/js/views/profileList.js (1)
  • src/js/views/profilePage.js (1)
Files not summarized due to errors (1)
  • index.html (diff tokens exceeds limit)
Files skipped from review due to trivial changes (81)
  • index.js
  • src/js/api/apiBase.js
  • src/js/api/auth/index.js
  • src/js/api/auth/login.js
  • src/js/api/auth/logout.js
  • src/js/api/auth/register.js
  • src/js/api/auth/state.js
  • src/js/api/constants.js
  • src/js/api/headers.js
  • src/js/api/index.js
  • src/js/api/posts/comment.js
  • src/js/api/posts/create.js
  • src/js/api/posts/index.js
  • src/js/api/posts/react.js
  • src/js/api/posts/read.js
  • src/js/api/posts/update.js
  • src/js/api/profiles/delete.js
  • src/js/api/profiles/follow.js
  • src/js/api/profiles/index.js
  • src/js/api/profiles/read.js
  • src/js/api/profiles/unfollow.js
  • src/js/api/profiles/update.js
  • src/js/data/blank/post.js
  • src/js/index.js
  • src/js/listeners/auth/index.js
  • src/js/listeners/auth/login.js
  • src/js/listeners/auth/logout.js
  • src/js/listeners/auth/register.js
  • src/js/listeners/index.js
  • src/js/listeners/post/comment.js
  • src/js/listeners/post/index.js
  • src/js/listeners/post/reaction.js
  • src/js/listeners/profile/follow.js
  • src/js/listeners/profile/index.js
  • src/js/listeners/profile/unfollow.js
  • src/js/router/index.js
  • src/js/router/searchParams.js
  • src/js/storage/index.js
  • src/js/storage/load.js
  • src/js/storage/save.js
  • src/js/templates/comment/badge.js
  • src/js/templates/comment/comment.js
  • src/js/templates/comment/form.js
  • src/js/templates/comment/index.js
  • src/js/templates/index.js
  • src/js/templates/instance.js
  • src/js/templates/post/actions.js
  • src/js/templates/post/comments.js
  • src/js/templates/post/footer.js
  • src/js/templates/post/form.js
  • src/js/templates/post/header.js
  • src/js/templates/post/index.js
  • src/js/templates/post/loader.js
  • src/js/templates/post/media.js
  • src/js/templates/post/page.js
  • src/js/templates/post/reactions.js
  • src/js/templates/post/tabs.js
  • src/js/templates/post/tags.js
  • src/js/templates/post/thumbnail.js
  • src/js/templates/profile/button.js
  • src/js/templates/profile/followers.js
  • src/js/templates/profile/following.js
  • src/js/templates/profile/follows.js
  • src/js/templates/profile/index.js
  • src/js/templates/profile/page.js
  • src/js/templates/profile/thumbnail.js
  • src/js/tools/clear.js
  • src/js/tools/emojiSubset.js
  • src/js/tools/index.js
  • src/js/ui/auth.js
  • src/js/ui/footer.js
  • src/js/ui/header.js
  • src/js/ui/index.js
  • src/js/ui/modals.js
  • src/js/ui/renderView.js
  • src/js/views/index.js
  • src/js/views/postList.js
  • src/js/views/postPage.js
  • src/js/views/profileList.js
  • src/js/views/profilePage.js
  • index.html (diff too large)
Review comments generated (2)
  • Review: 1
  • LGTM: 1

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines 1 to 15
import { headers } from "../headers.js";

export async function deletePost(id) {
const response = await fetch(`${apiPath}/social/posts/${id}`, {
method: "delete",
headers: headers()
})
const response = await fetch(`${apiPath}/social/posts/${id}`, {
method: "delete",
headers: headers(),
});

if (response.ok) {
return await response.json()
}
if (response.ok) {
return await response.json();
}

throw new Error(response.statusText)
} No newline at end of file
throw new Error(response.statusText);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [15-16]

There's a potential issue with the error handling. The throw new Error(response.statusText) statement is outside of the async function scope, which means it will not be executed if the response is not ok. It should be moved inside the function to correctly handle errors.

  if (response.ok) {
    return await response.json();
  }
  
+ throw new Error(response.statusText);
}
- throw new Error(response.statusText);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STFU

@Fermain Fermain merged commit fc52c7c into master Jan 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants