Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The primary reason for choosing dprint was performance - check out the video at https://dprint.dev/overview/ to see just how fast format on save can be.
This PR adds a new
rush fmt
command that will rundprint fmt
against the entire monorepo, but that's probably the slowest way to run dprint, since rush and node add a lot of unnecessary startup overhead. In fact, on my machine runningrush fmt
is at least 10x slower than just running./tools/build/node_modules/dprint/dprint fmt
from the root of the repo. In fact,dprint fmt
was able format every file in the repo in under a second!Either way, I recommend just setting up your editor of choice to run
dprint fmt
on save and never worry about formatting again. I've added dprint as a recommended VSCode extension and setup format-on-save in the VSCode workspace settings, although you'll want to make sureeditor.defaultFormatter
is not set differently in your user settings as that will override the workspace.As for the actual formatting, I've tried to configure dprint to match our existing formatting as much as possible - we can always choose more opinionated settings if folks are OK with more initial churn. Let's get all the arguing about style rules out of our system now and not look back.
Still to do/open questions:
dprint check
in CIdprint check
pre-commit hook?.git-blame-ignore-revs
file to hide the formatting from git blame.