Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jonathannorris
Copy link
Member

This PR adds prettier commands to the package.json and integrates formatting checks into the CI workflow to enforce consistent code formatting.

Changes:

  • Added format and format:check scripts to package.json
  • Updated CI workflow to run yarn format:check during the test pipeline
  • Enhanced posttest script to include prettier validation alongside existing linting

Impact:

  • CI builds will now fail if code doesn't meet prettier formatting standards
  • Developers can run yarn format to auto-format code locally
  • Ensures consistent code style across the entire codebase

The changes leverage existing prettier configuration (.prettierrc.json and .prettierignore) already present in the repository.

This comment was marked as outdated.

package.json Outdated
"lint": "eslint . --ext .ts --config .eslintrc",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "yarn lint",
"posttest": "yarn lint && yarn format:check",
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be pretest instead of post?

Copy link
Member Author

Choose a reason for hiding this comment

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

its probably fine to run the tests first as this won't change functionality.

Copy link
Contributor

Choose a reason for hiding this comment

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

mostly concerned that this will "fail" the build / task, and then require a full re-run... when this is the usually the fastest failure point

- DEVELOPMENT.md
- src/api/customProperties.ts
- src/commands/diff/index.ts
- src/flags/var-alias/index.ts
- src/utils/FileFilters.ts
- src/utils/diff/diff.ts
- Add name to CI formatting step for better readability
- Use specific glob patterns for prettier to improve performance
- Move prettier check to pretest to fail fast before running tests
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

This PR integrates Prettier formatting checks into the CI pipeline and developer workflows.

  • Adds format and format:check scripts to package.json
  • Hooks yarn format:check into the CI tests and pretest script
  • Ensures consistent code formatting across the codebase

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils/diff/diff.ts Reformatted executeDiff signature onto one line
src/utils/FileFilters.ts Switched to single quotes in type references and added comma
src/commands/diff/index.ts Broke long return expression into multiline for clarity
src/api/customProperties.ts Expanded function parameters onto separate lines
package.json Added Prettier scripts (format, format:check, pretest)
DEVELOPMENT.md Inserted blank lines for better section separation
.github/workflows/tests.yml Added “Check formatting” step before running tests in CI

@jonathannorris jonathannorris merged commit e20f321 into main Jul 14, 2025
5 checks passed
@jonathannorris jonathannorris deleted the cursor/update-package-json-for-prettier-ci-command-c78d branch July 14, 2025 15:04
jonathannorris added a commit that referenced this pull request Aug 11, 2025
* Add Prettier formatting checks to CI and package scripts

Co-authored-by: jonathan <[email protected]>

* Format code with prettier

- DEVELOPMENT.md
- src/api/customProperties.ts
- src/commands/diff/index.ts
- src/flags/var-alias/index.ts
- src/utils/FileFilters.ts
- src/utils/diff/diff.ts

* Address PR comments

- Add name to CI formatting step for better readability
- Use specific glob patterns for prettier to improve performance
- Move prettier check to pretest to fail fast before running tests

---------

Co-authored-by: Cursor Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants