Repository navigation
Add Prettier and format the People Portal - #99
Merged
Merged
Conversation
Prettier defaults with a 4-space tab width. The ignore file skips the Handlebars email templates that use partials (which Prettier cannot parse), the generated tsoa routes.ts, and landing-v3.
Formatting only, no behaviour changes. Run with the .prettierrc added in the previous commit over peopleportal/webui/src and peopleportal/server/src.
Run prettier --check on the People Portal source for pull requests that touch it, with Prettier pinned to 3.9.10 so a new release cannot change the result.
Replace pr_build.yml and pr_format.yml with a single pr_checks.yml that has a Prettier format job and an Nx build job, so both show up under one workflow on the pull request.
Limit the workflow to the People Portal (drop landing-v3) and add the server unit tests and UI tests next to the build, so there is one workflow per pull request.
Make build-and-test depend on the Prettier job so a formatting failure stops the PR checks early instead of running the slow build first.
Drop the dependency of the build on the format job and split build and test into separate jobs, so a pull request gets all three results at once.
The server test script passes a glob to node --test, which Node 20 does not expand (the CI run failed with 'Could not find test/unit/**/*.test.js'), and express-handlebars requires Node >=22.15.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Prettier to the People Portal and formats
peopleportal/webui/srcandpeopleportal/server/srcwith it. Commits are split so the config, the mechanical reformat and the CI changes can be reviewed separately:Config:
.prettierrcis Prettier's defaults with a 4-space tab width ({ "tabWidth": 4 })..prettierignoreskips:{{> header}}), which Prettier cannot parse (header.hbsandfooter.hbsstay checked),peopleportal/server/src/routes.ts, whichtsoa spec-and-routesregenerates on every build,landing-v3/, which is intentionally not formatted.Formatting: the result of running
prettier --writeover the two source folders. Formatting only, no behaviour changes.CI check:
.github/workflows/pr_checks.yml(renamed frompr_build.yml) is now the one workflow that runs on People Portal pull requests, "People Portal PR Checks", with three jobs that run in parallel: Format (Prettier) runsprettier --checkonpeopleportal/webui/srcandpeopleportal/server/src, pinned to Prettier 3.9.10 so a new release cannot change the result; Build (Nx) runs./nx run-many -t build -p pplserver pplui; and Test (Nx) runspplserver:test-unitandpplui:test. It no longer buildslanding-v3, and it triggers onpeopleportal/**, the Nx files and the Prettier config. On merge, the existingdeploy_peopleportal.ymlis the only workflow that runs. To fix a format failure:npx prettier@3.9.10 --write peopleportal/webui/src peopleportal/server/src. The check names change fromPR Build Check / build, so update any branch protection rule that requires the old name.Verification
prettier --checkpasses onpeopleportal/webui/srcandpeopleportal/server/src../nx run-many -t build -p pplserver ppluisucceeds.pplserver:test-unit: 115 of 115 pass.pplui:test: 29 of 29 pass.peopleportal/is modified besides the two config files.Things to know
git diff -wor "Hide whitespace".git blamewill show the formatting commit for the lines it touched. There is no.git-blame-ignore-revsin this PR.npx prettier --writeon their branch after rebasing.;between interface and type members, with no option for commas.People Portal PR Checksrun validates the formatting, the build and the tests.🤖 Generated with Claude Code