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

Add Prettier format script for consistent code formatting in UI files #20998

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bupd
Copy link

@bupd bupd commented Oct 3, 2024

Thank you for contributing to Harbor!

Comprehensive Summary of your change

This PR uses Prettier to the frontend component of the Harbor project to enforce consistent code formatting across frontend files. Currently, the frontend codebase has inconsistent formatting, which makes contributions more error-prone and increases unnecessary diffs in PRs.

By adding npm format script, we can ensure uniform formatting, which will improve the overall readability and maintainability of the code. It also reduces potential formatting-related issues in future PRs, ensuring that the focus stays on functionality rather than style.

  • Added an npm script to easily format all files in the project (npm run prettier).
  • Applied Prettier formatting to the existing frontend codebase to showcase its effectiveness.

Issue being fixed

N/A (This is an enhancement to improve code quality and consistency).

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@bupd bupd requested a review from a team as a code owner October 3, 2024 20:18
@Vad1mo Vad1mo added the release-note/infra Infra related changes e.g. release, test, ship etc... label Oct 7, 2024
@Vad1mo
Copy link
Member

Vad1mo commented Oct 7, 2024

@bupd

Can you add the run to the Github Action checks and fail the checks if there are errors

image

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.90%. Comparing base (c8c11b4) to head (53846e7).
Report is 285 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #20998       +/-   ##
===========================================
+ Coverage   45.36%   68.90%   +23.53%     
===========================================
  Files         244      801      +557     
  Lines       13333   100650    +87317     
  Branches     2719        0     -2719     
===========================================
+ Hits         6049    69351    +63302     
- Misses       6983    27490    +20507     
- Partials      301     3809     +3508     
Flag Coverage Δ
unittests 68.90% <ø> (+23.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1040 files with indirect coverage changes

* Added npm script to format code using Prettier: `npm run format`.

* Apply Prettier formatting across the project to ensure consistent code style.
* Fix formatting inconsistencies in 123 files.
* Improve overall code readability and maintainability.

Signed-off-by: bupd <bupdprasanth@gmail.com>
@bupd bupd force-pushed the update-formatting branch 2 times, most recently from 838e28d to fd4a4b9 Compare October 10, 2024 19:10
* Updated 'ui_ut_run.sh' script to enforce formatting

Signed-off-by: bupd <bupdprasanth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui release-note/infra Infra related changes e.g. release, test, ship etc...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants