Skip to content

feat: integrate prettier and enforce code formatting#192

Open
Rahul-R79 wants to merge 6 commits intoaccordproject:mainfrom
Rahul-R79:feat/add-prettier
Open

feat: integrate prettier and enforce code formatting#192
Rahul-R79 wants to merge 6 commits intoaccordproject:mainfrom
Rahul-R79:feat/add-prettier

Conversation

@Rahul-R79
Copy link

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

  • Added Dependencies: prettier and eslint-config-prettier.
  • Added Configuration: Created .prettierrc with modern defaults (2-space indentation, single quotes, no trailing whitespace).
  • Updated Scripts: Added npm run format (write) and npm run format:check (verify) to package.json.
  • Updated ESLint: Modified .eslintrc.yml to extend prettier, disabling conflicting formatting rules.
  • Updated CI: Added npm run format:check step to .github/workflows/build.yml to fail builds on formatting errors.
  • Reformatted Codebase: Applied Prettier formatting to all source files (~133 files changed).

Flags

  • Large Diff: This PR touches ~130 files due to whitespace/indentation changes (moving from 4 spaces to 2 spaces).
  • History Mitigation: After merging, we should add the commit hash to .git-blame-ignore-revs (in a follow-up PR) to preserve git blame usability.

Screenshots or Video

N/A (Formatting changes only)

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:feat/add-prettier

@Rahul-R79
Copy link
Author

Rahul-R79 commented Jan 14, 2026

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 git blame clean, I will open a follow-up PR to add this commit hash to .git-blame-ignore-revs after merging, effectively hiding this massive reformatting from history.

Please review when you get some time @mttrbrts @dselman !

Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
@coveralls
Copy link

Coverage Status

coverage: 98.363%. remained the same
when pulling a11a36e on Rahul-R79:feat/add-prettier
into 461d268 on accordproject:main.

@Rahul-R79
Copy link
Author

Rahul-R79 commented Jan 30, 2026

@ekarademir @mttrbrts @dselman please take a look at this when you have some time. Thank you.!

Rahul-R79 and others added 3 commits February 17, 2026 00:07
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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:check npm scripts.
  • Add Prettier configuration and ignore rules.
  • Update ESLint config to extend prettier and 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.

Comment on lines +16 to +21
"format": "prettier --write .",
"format:check": "prettier --check .",
"pretest": "npm run lint",
"lint": "eslint .",
"postlint": "npm run licchk",
"licchk": "license-check-and-add",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@mttrbrts mttrbrts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

…t tabWidth to 4

Signed-off-by: Rahul-R79 <rahul.devworks@gmail.com>
@Rahul-R79 Rahul-R79 requested a review from mttrbrts March 10, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Integrate Prettier for Code Formatting and CI Check

4 participants