-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): more helpful output for format:check --verbose #23503
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit a832a14. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 6 targets
Sent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
(cherry picked from commit 383be1f)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Nx format is currently exclusively built on top of prettier. We leverage the
--list-different
feature of prettier to show the user which files failed the formatting check. The simple common case solution is to runnx format:write
(powered byprettier --write
) and commit the result.Right now a user might want to try and learn more about their
format:check
failure by passing--verbose
but it will not change the output in any way.Based on the feedback in #4159 some users are expecting to see the diff output of what correct vs incorrect formatting would look like.
However, because nx format is currently exclusively built on top of prettier, it is therefore subject to its limitations. prettier/prettier#6885 remains unresolved and so there is no native way for users to see a diff.
It is important to note that only showing the names of the files in the default
nx format:check
output is an important feature - it allows easy piping into custom scripts to perform further handling. Therefore we do not want to change the default output here.This PR updates the case where
--verbose
is passed in order to provide more information/context about the overall problem and how to fix it.Before
After