feat: integrate prettier and enforce code formatting#192
feat: integrate prettier and enforce code formatting#192Rahul-R79 wants to merge 6 commits intoaccordproject:mainfrom
Conversation
|
As we discussed in today's call, I've implemented Prettier for consistent formatting and added a CI check to enforce it. I’ve also run the tests, linting, and Prettier locally, and everything passed successfully with no issues. Note: To keep |
Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
dc1c6a9 to
a11a36e
Compare
|
@ekarademir @mttrbrts @dselman please take a look at this when you have some time. Thank you.! |
Signed-off-by: Rahul R <158848606+Rahul-R79@users.noreply.github.com>
Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
There was a problem hiding this comment.
Pull request overview
Integrates Prettier-based formatting into the repo, aiming to separate formatting concerns from ESLint and (per PR description) enforce formatting in CI.
Changes:
- Add Prettier + eslint-config-prettier, and introduce
format/format:checknpm scripts. - Add Prettier configuration and ignore rules.
- Update ESLint config to extend
prettierand remove formatting-related rules; add VS Code workspace settings to default to Prettier.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds Prettier scripts and devDependencies; reformats JSON. |
| package-lock.json | Locks new Prettier and eslint-config-prettier dependencies. |
| .vscode/settings.json | Configures VS Code to format on save with Prettier and run ESLint fixes. |
| .prettierrc | Introduces Prettier configuration (tab width, quotes, etc.). |
| .prettierignore | Excludes build/artifact directories from Prettier runs. |
| .eslintrc.yml | Extends prettier and removes ESLint formatting rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "format": "prettier --write .", | ||
| "format:check": "prettier --check .", | ||
| "pretest": "npm run lint", | ||
| "lint": "eslint .", | ||
| "postlint": "npm run licchk", | ||
| "licchk": "license-check-and-add", |
There was a problem hiding this comment.
The PR description says CI enforces formatting via npm run format:check, but the current workflow(s) don't appear to run that command. To make formatting mandatory (and avoid style regressions now that ESLint formatting rules were removed), add a CI step that runs npm run format:check (typically right after npm ci).
There was a problem hiding this comment.
My intention is not to add npm run format:check to the CI pipeline right now. Copilot is suggesting adding it to the pipeline, but if I do that, I need to format the entire codebase, which would result in a large diff that's hard to review — that's the feedback I received from the weekly call's. So I changed the plan accordingly.
Instead, I implemented a VS Code extension setting so that contributors' files are automatically formatted on save. My intention in adding "format:check": "prettier --check ." is to help contributors manually run the format check locally if they don't have the Prettier extension installed. This way, we can gradually improve the codebase over time.
so can i ignore the suggestion @mttrbrts @sanketshevkar
mttrbrts
left a comment
There was a problem hiding this comment.
Let's keep the 4 space indenting to remain consistent with other projects in this org, e.g. https://github.com/accordproject/concerto/blob/main/.eslintrc.yml
9ea416e to
0091cc1
Compare
…t tabWidth to 4 Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
0091cc1 to
9f325c9
Compare
Closes #191
This PR integrates Prettier into the project to handle code formatting, separating stylistic concerns from code quality checks (ESLint). It also adds a mandatory formatting check in the CI pipeline.
Changes
prettierandeslint-config-prettier.npm run format(write) andnpm run format:check(verify) to package.json.prettier, disabling conflicting formatting rules.npm run format:checkstep to .github/workflows/build.yml to fail builds on formatting errors.Flags
.git-blame-ignore-revs(in a follow-up PR) to preservegit blameusability.Screenshots or Video
N/A (Formatting changes only)
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:feat/add-prettier