dprint
1 min readSep 2, 2022
The following are steps to install dprint on a project
What does this print do?
dprint is a formatter that runs significantly faster than prettier.
Performance is optimized with "incremental": true
. dprint will only format files that have changed since the last time you formatted the code in order to drastically improve performance if that setting is implemented.
To install dprint
Use the following to install dprint on your project.
- Install dprint:
brew install dprint
- Setup dprint:
dprint init
- Add dprint plugins:
dprint config add typescript
dprint config add markdown
dprint config add json
dprint config add prettier
To upgrade dprint
- Upgrade dprint plugins:
dprint config update
To run dprint
- Run dprint:
dprint fmt
- Run dprint and output the time it takes:
dprint output-format-times
To configure the incremental write
- Configure incremental to false:
dprint fmt --incremental=false
Notes
You can view the dprint rules at dprint.json
. They use all the same rules as prettier.
The following are dprint’s ignore rules in case you want to add it for specific lines of code.
"ignoreDirective": "dprint-ignore",
"ignoreFileDirective": "dprint-ignore-file",
"ignoreStartDirective": "dprint-ignore-start",
"ignoreEndDirective": "dprint-ignore-end"
dprint rules playground
View the rule’s playground for additional rules here.