Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx repair generates diff due to incorrect formatting #25122

Open
1 of 4 tasks
terrymun opened this issue May 22, 2024 · 0 comments
Open
1 of 4 tasks

nx repair generates diff due to incorrect formatting #25122

terrymun opened this issue May 22, 2024 · 0 comments
Assignees
Labels
scope: core core nx functionality type: bug

Comments

@terrymun
Copy link

terrymun commented May 22, 2024

Current Behavior

When running nx repair on a repo, the nx.json file is updated in a way that is different from the format specified by .prettierrc. When running nx format:write after, the generated diff is gone.

This means that nx repair generates nx.json that is unstable.

Expected Behavior

The updated nx.json created by running nx repair should be properly formatted by prettier.

GitHub Repo

https://github.com/terrymun/nx-repair-prettier

Steps to Reproduce

  1. Run nx repair
  2. Notice that nx.json is updated: the diff is coming solely from formatting

Screenshot 2024-05-22 at 21 17 59

  1. Run nx format:write: notice that diff disappears

This suggests that the output of nx repair is not property formatted. I would expect the files generated by nx repair is already properly formatted, because we run nx format:check in our CI pipeline to ensure that PRs are properly formatted. A team member who just ran nx repair may commit the changes without knowing it is not correctly violated. Of course this can be fixed with a pre-push hook, but I would expect formatting to be part of the job done by nx repair.

Nx Report

Node   : 20.12.2
OS     : darwin-arm64
yarn   : 4.1.0

nx                 : 19.0.0-beta.5
@nx/js             : 19.0.0-beta.5
@nx/jest           : 19.0.0-beta.5
@nx/linter         : 19.0.0-beta.5
@nx/eslint         : 19.0.0-beta.5
@nx/workspace      : 19.0.0-beta.5
@nx/angular        : 19.0.0-beta.5
@nx/cypress        : 19.0.0-beta.5
@nx/devkit         : 19.0.0-beta.5
@nx/eslint-plugin  : 19.0.0-beta.5
@nx/react          : 19.0.0-beta.5
@nrwl/tao          : 19.0.0-beta.5
@nx/web            : 19.0.0-beta.5
@nx/webpack        : 19.0.0-beta.5
typescript         : 5.4.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@ngrx/component-store : 17.0.1
@ngrx/effects         : 17.0.1
@ngrx/entity          : 17.0.1
@ngrx/router-store    : 17.0.1
@ngrx/store           : 17.0.1
@ngrx/store-devtools  : 17.0.1

Failure Logs

No response

Package Manager Version

4.1.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core core nx functionality type: bug
Projects
None yet
Development

No branches or pull requests

3 participants