nx icon indicating copy to clipboard operation
nx copied to clipboard

format:check crashes due to the number of changed files

Open work933k opened this issue 9 months ago • 0 comments

Current Behavior

In our CI-pipeline we give the command npx nx format:check, just to ensure that all files are correctly formatted. This command normally works without a problem. For a PR with >3300 modified files (formatting changes) the process crashes and exits with exitcode "1". When i do the NODE_DEBUG=* npx nx format:check i see the following in the console:

CHILD_PROCESS 57502: spawnSync [Object: null prototype] {
  maxBuffer: 1048576,
  stdio: [ 0, 1, 2 ],
  shell: true,
  args: [
    '/bin/sh',
    '-c',
    'node "/root/DummyNx/node_modules/prettier/bin/prettier.cjs" --list-different ".prettierrc.json" ".storybook/global-parameters.ts" ".storybook/injectInjectorToProps.ts" ".storybook/language.decorators.ts" ".storybook/main.ts" ".storybook/modes.ts" ".storybook/viewports.ts" ".storybook/dummy-advisor.decorators.ts" ".storybook/duymmy.decorators.ts" "apps/advisor-dummy-app-e2e/cypress.config.ts", <many filepaths> ... 307637 more characters
  ],

Expected Behavior

I would expect this not to be an issue.

Maybe it would be a good idea to have "format:check" to split it in pairs of xxx files? Or maybe give a warning when above a certain number of files (1000).

GitHub Repo

No response

Steps to Reproduce

  1. Take a very big repo
  2. Modify a prettier/eslint setting (tab from 2 to 3 spaces)
  3. Run npx nx format:write --all or npx run-many --all --target=lint --fix
  4. Run npx nx format:check
  5. In my situation i get no console output, but do get the exit-code "1" (failed)

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.12.2
OS     : linux-x64
npm    : 10.5.0

nx                 : 18.2.4
@nx/js             : 18.2.4
@nx/jest           : 18.2.4
@nx/linter         : 18.2.4
@nx/eslint         : 18.2.4
@nx/workspace      : 18.2.4
@nx/angular        : 18.2.4
@nx/cypress        : 18.2.4
@nx/devkit         : 18.2.4
@nx/eslint-plugin  : 18.2.4
@nx/express        : 18.2.4
@nx/node           : 18.2.4
@nx/plugin         : 18.2.4
@nx/storybook      : 18.2.4
@nrwl/tao          : 18.2.4
@nx/web            : 18.2.4
@nx/webpack        : 18.2.4
typescript         : 5.4.3
---------------------------------------
Community plugins:
@compodoc/compodoc     : 1.1.24
@ngrx/component-store  : 17.0.1
@ngrx/effects          : 17.0.1
@ngrx/entity           : 17.0.1
@ngrx/eslint-plugin    : 17.0.1
@ngrx/router-store     : 17.0.1
@ngrx/schematics       : 17.0.1
@ngrx/store            : 17.0.1
@ngrx/store-devtools   : 17.0.1
@spaceribs/nx-betterer : 3.0.0
@storybook/angular     : 7.6.17
ng-mocks               : 14.12.2
nx-stylelint           : 17.1.4
---------------------------------------
Local workspace plugins:
         @athora-nx/storybook-test-runner
         @athora-nx/static-server
         @athora-nx/azuredevops
         @athora-nx/chromatic
         @athora-nx/workspace-plugin
         @athora-nx/coverage

npm ls prettier
[email protected] /root/dummy
├─┬ @betterer/[email protected]
│ └── [email protected]
├─┬ @storybook/[email protected]
│ ├─┬ @storybook/[email protected]
│ │ └── [email protected]
│ └── [email protected]
└── [email protected]

Failure Logs

No response

Package Manager Version

10.5.0

Operating System

  • [ ] macOS
  • [X] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

I love working with NX

work933k avatar May 17 '24 11:05 work933k