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

Closed
1 of 4 tasks
terrymun opened this issue May 22, 2024 · 1 comment · Fixed by #27082
Closed
1 of 4 tasks

nx repair generates diff due to incorrect formatting #25122

terrymun opened this issue May 22, 2024 · 1 comment · Fixed by #27082
Assignees
Labels

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
FrozenPandaz pushed a commit that referenced this issue Jul 24, 2024
…27082)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #25122

(cherry picked from commit 8afd3ea)
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants