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 3 commits into
base: main
Choose a base branch
from

Conversation

bupd
Copy link
Contributor

@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.81%. Comparing base (c8c11b4) to head (4321856).
Report is 329 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #20998       +/-   ##
===========================================
+ Coverage   45.36%   68.81%   +23.44%     
===========================================
  Files         244      802      +558     
  Lines       13333   100791    +87458     
  Branches     2719        0     -2719     
===========================================
+ Hits         6049    69362    +63313     
- Misses       6983    27623    +20640     
- Partials      301     3806     +3505     
Flag Coverage Δ
unittests 68.81% <ø> (+23.44%) ⬆️

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

see 1041 files with indirect coverage changes

@bupd bupd force-pushed the update-formatting branch 3 times, most recently from fd4a4b9 to 00c3718 Compare October 10, 2024 19:17
@wy65701436 wy65701436 assigned xuelichao and unassigned zyyw Oct 12, 2024
* 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 <[email protected]>
* Updated 'ui_ut_run.sh' script to enforce formatting

Signed-off-by: bupd <[email protected]>
@bupd
Copy link
Contributor Author

bupd commented Oct 14, 2024

ready for review

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