dprint

Patrick Rachford
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.

  1. Install dprint: brew install dprint
  2. Setup dprint: dprint init
  3. Add dprint plugins:
dprint config add typescript
dprint config add markdown
dprint config add json
dprint config add prettier

To upgrade dprint

  1. Upgrade dprint plugins: dprint config update

To run dprint

  1. Run dprint: dprint fmt
  2. Run dprint and output the time it takes: dprint output-format-times

To configure the incremental write

  1. 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.

--

--

No responses yet