feat: add Prettier and format the codebase (Closes #82) - #254
Closed
ZuLu0890 wants to merge 8 commits into
Closed
Conversation
- Install prettier ^3.9.5 and eslint-config-prettier ^10.1.8 - Add .prettierrc config matching existing .editorconfig conventions - Add .prettierignore for build artifacts and generated files - Integrate Prettier with ESLint via eslint-config-prettier - Add format and format:check npm scripts - Add format:check step to CI workflow (lighthouse.yml) - Format entire codebase (~150 files) - Update README with Prettier documentation
- SendMoney: pass locale prop to QuoteCard so currency formatting respects the user's locale preference - Transfers: add status filter, search input, URL param sync, pagination (PAGE_SIZE=5), SelectionToolbar integration, useSelection hook, and PullToRefresh wrapper - TransferRow: add optional selected/onToggleSelect props for checkbox column with selection support - Add filter bar CSS to Transfers.css and checkbox column CSS to TransferRow.css
npm ci was failing in CI because the lockfile was out of sync with package.json. Regenerated via npm install.
Regenerated package-lock.json from the original main-branch lockfile by only adding prettier and eslint-config-prettier, preserving the existing lockfile format (v2) for npm ci compatibility.
npm 10 and npm 11 handle optional platform-specific dependencies differently. The lockfile generated by npm 11 causes npm ci to fail in the CI environment (node 20, npm ~10.x) with missing esbuild@0.28.1 errors. Regenerating with npm 10 ensures compatibility across both environments.
Contributor
|
Solid work, exactly what the issue asked for. Merging! ✨ |
Contributor
|
Thanks for this, @ZuLu0890! 🙏 #253 landed just ahead of you and now conflicts with this branch across |
Contributor
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.
Description
This PR adds Prettier as the opinionated code formatter for the RemitFlow frontend, formats the entire codebase, integrates Prettier with the existing ESLint configuration, and adds automated format checking to CI.
Why Prettier?
npm run formathandles it.npm run format:checkruns on every PR, preventing unformatted code from merging.Changes Made
1. New Dependencies
prettier^3.9.5eslint-config-prettier^10.1.82. New Configuration Files
.prettierrc— Prettier configuration matching the existing.editorconfigconventions:all).prettierignore— Excludes build artifacts and generated files:node_modules/,dist/,coverage/storybook-static/,.lighthouseci/package-lock.json3. ESLint Integration
Updated
.eslintrc.jsonto addprettieras the last entry in theextendsarray. This ensureseslint-config-prettierdisables all ESLint rules that would conflict with Prettier's formatting choices.4. New npm Scripts
npm run formatprettier --write .npm run format:checkprettier --check .5. CI Integration
Updated
.github/workflows/lighthouse.ymlto include a "Check formatting (Prettier)" step that runsnpm run format:checkafter dependency installation and before the build step. Every PR is now automatically validated for formatting consistency.6. Codebase Formatting
All ~150 source files across the project were formatted with Prettier:
src/— Components, pages, hooks, context, services, toolkit, utils, lib, constantstest/— Integration tests, unit tests, component tests, library tests.storybook/,vite.config.js,lighthouserc.json,index.html7. Documentation
Updated
README.mdto document the newformatandformat:checkscripts in the Scripts section.Verification
npm run format:checknpx vite buildnpm test(non-pre-existing failures)Files Changed
Closes #82