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

integration with NX affected #1481

Open
hmidmrii opened this issue Nov 13, 2024 · 2 comments
Open

integration with NX affected #1481

hmidmrii opened this issue Nov 13, 2024 · 2 comments

Comments

@hmidmrii
Copy link

Description

When using lint-staged with nx affected to lint fix a module, some files won't be staged because lint-staged only adds the files that were matched by the micromatch,

the command that I'm using is nx affected -t lint --files=${files} --fix, which means that all modules that those files affected will be linted and fixed, which might cause more files to be linted and fixed

Steps to reproduce

  • initialize NX workspace
  • use @nx/dependency-checks (which means when you use a new package in a module it would automatically add it to pakcage.json)
  • use a new package in a js file in the module
  • commit with lint staged

Debug Logs

No need

Environment

  • OS: Windows 11
  • Node.js: v20.14.0
  • lint-staged: ^15.2.10
@hmidmrii
Copy link
Author

a workaround for now is to add git add . as a step after the affected lint command

@hmidmrii
Copy link
Author

a fix would be add a new cli option (like --stage-all) which will stash all unstaged changes, then when the lint-staged tasks finish it will stage all new changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant