After installing, the main part of getting setup is to create a .dprintrc.json file in your project.
This file will outline:
- The plugins to use.
- The configuration to use for formatting files.
- Which files to include and exclude from formatting.
dprint init command is a quick way to get setup formatting your project.
Open a terminal in the root directory of your project and run the following command:
This will create a .dprintrc.json file in the current working directory. If you are connected to the internet, it will initialize the file according to the latest plugins.
Create a .dprintrc.json file in the root directory of the project and read the configuration documentation.
Custom config file location
It is recommended to use either .dprintrc.json or config/.dprintrc.json as the location of your configuration file because it will be automatically picked up by the CLI and editor plugins. If you place it in another other location then it will need to be manually specified using the
--config <path> or
-c <path> flag whenever you run a command.
dprint init with custom config file location
You may specify a custom path for the creation of a configuration file via
dprint init by specifying it with the
dprint init --config path/to/.dprintrc.json
Next step: Configuration