### Install Exec Plugin Source: https://dprint.dev/plugins/exec Install the exec plugin using the dprint CLI. Alternatively, install it from npm. ```bash dprint add exec # or install from npm dprint add npm:@dprint/exec ``` -------------------------------- ### Install dprint CLI using curl Source: https://dprint.dev/ Install the dprint CLI by piping the installation script to sh. This is a quick way to get the tool on your system. Ensure you review scripts from the internet before execution. ```bash curl -fsSL https://dprint.dev/install.sh | sh ``` -------------------------------- ### Install Prettier Plugin Source: https://dprint.dev/plugins/prettier Install the Prettier plugin using the dprint CLI. Alternatively, install from npm. ```bash dprint add prettier # or install from npm dprint add npm:@dprint/prettier ``` -------------------------------- ### Install and Run dprint Check (curl) Source: https://dprint.dev/ci Install dprint using a curl script, specifying a version, and then run the check command from the installation directory. This method is useful for environments where npm is not readily available or preferred. ```bash # replace X.X.X with the version of dprint to use curl -fsSL https://dprint.dev/install.sh | sh -s X.X.X > /dev/null 2>&1 $HOME/.dprint/bin/dprint check ``` -------------------------------- ### Install dprint via npm (Project and Global) Source: https://dprint.dev/install Install dprint for your project or globally using npm. Includes commands to check help after installation. ```bash # for your project npm install dprint npx dprint help # or install globally npm install -g dprint dprint help ``` -------------------------------- ### Install Oxc Plugin Source: https://dprint.dev/plugins/oxc Install the Oxc plugin using the dprint CLI. Alternatively, install from npm. ```bash dprint add oxc ``` ```bash # or install from npm dprint add npm:@dprint/oxc ``` -------------------------------- ### Example File Paths Output Source: https://dprint.dev/cli An example of the output from the `dprint file-paths` command, listing resolved file paths. ```text C:\dev\my-project\scripts\build-homepage.js C:\dev\my-project\scripts\build-schemas.js C:\dev\my-project\website\playground\config-overrides.js C:\dev\my-project\website\playground\src\components\ExternalLink.tsx C:\dev\my-project\website\playground\src\components\index.ts C:\dev\my-project\website\playground\src\components\Spinner.tsx ...etc... ``` -------------------------------- ### Install dprint via asdf-vm Source: https://dprint.dev/install Add the dprint plugin to asdf-vm and install the latest version. ```bash asdf plugin-add dprint https://github.com/asdf-community/asdf-dprint asdf install dprint latest ``` -------------------------------- ### Install dprint via Scoop Source: https://dprint.dev/install Install dprint using the Scoop package manager on Windows. ```shell scoop install dprint ``` -------------------------------- ### Example dprint Configuration Source: https://dprint.dev/config This is a comprehensive example of a dprint configuration file. It demonstrates setting line width, specific formatting rules for TypeScript and JSON, excluding files, and listing Wasm plugins. ```json { "lineWidth": 80, "typescript": { // This applies to both JavaScript & TypeScript "quoteStyle": "preferSingle", "binaryExpression.operatorPosition": "sameLine" }, "json": { "indentWidth": 2 }, "excludes": [ "**/*-lock.json" ], "plugins": [ // You may specify any urls or file paths here that you wish. "https://plugins.dprint.dev/typescript-0.96.1.wasm", "https://plugins.dprint.dev/json-0.22.0.wasm", "https://plugins.dprint.dev/markdown-0.22.1.wasm" ] } ``` -------------------------------- ### Example Format Times Output Source: https://dprint.dev/cli An example of the output from the `dprint format-times` command, showing the time taken to format each file. ```text 0ms - C:\dev\my-project\dprint.json 0ms - C:\dev\my-project\README.md 1ms - C:\dev\my-project\other-file.md 2ms - C:\dev\my-project\package.json 2ms - C:\dev\my-project\my-markdown-file.md 4ms - C:\dev\my-project\test.ts 5ms - C:\dev\my-project\docs\info.md 16ms - C:\dev\my-project\my-file.ts 46ms - C:\dev\my-project\docs\overview.md 54ms - C:\dev\my-project\build.js ``` -------------------------------- ### Install TOML Plugin Source: https://dprint.dev/plugins/toml Install the TOML plugin using the dprint CLI. This command adds the plugin to your dprint configuration. ```bash dprint add toml # or install from npm dprint add npm:@dprint/toml ``` -------------------------------- ### Add JSON Plugin Source: https://dprint.dev/plugins/json Install the JSON plugin by running this command in your project directory. Alternatively, install from npm. ```bash dprint add json ``` ```bash # or install from npm dprint add npm:@dprint/json ``` -------------------------------- ### Install dprint via AUR Helper (Arch Linux) Source: https://dprint.dev/install Install dprint on Arch Linux using an AUR helper, with options for binary or source packages. ```bash paru -S dprint ``` ```bash paru -S dprint-bin ``` -------------------------------- ### Install dprint via Powershell Source: https://dprint.dev/install Use this command to install dprint on Windows using Powershell. ```powershell iwr https://dprint.dev/install.ps1 -useb | iex ``` -------------------------------- ### Example Resolved Configuration Output Source: https://dprint.dev/cli An example of the JSON output from the `dprint resolved-config` command, showing configuration details for different file types. ```json { "typescript": { "arguments.preferHanging": true, "arguments.preferSingleLine": false, "arguments.trailingCommas": "onlyMultiLine", "arrayExpression.preferHanging": true, "arrayExpression.preferSingleLine": false, "arrayExpression.trailingCommas": "onlyMultiLine", "arrayPattern.preferHanging": true, // ...etc... "whileStatement.singleBodyPosition": "nextLine", "whileStatement.spaceAfterWhileKeyword": true, "whileStatement.useBraces": "preferNone" }, "json": { "commentLine.forceSpaceAfterSlashes": true, "indentWidth": 2, "lineWidth": 160, "newLineKind": "lf", "useTabs": false } } ``` -------------------------------- ### Install dprint via Cargo Source: https://dprint.dev/install Build and install dprint from source using Cargo. This method is slower as it involves compilation. ```rust # this will be slower since it builds from the source cargo install --locked dprint ``` -------------------------------- ### Install and Run dprint Check (npm) Source: https://dprint.dev/ci Install dprint globally using npm and then execute the check command. This is a straightforward method for CI environments that support npm. ```bash npm install -g dprint dprint check ``` -------------------------------- ### Install dprint via Homebrew Source: https://dprint.dev/install Install dprint using the Homebrew package manager on macOS. ```shell brew install dprint ``` -------------------------------- ### Install Mago Plugin Source: https://dprint.dev/plugins/mago Install the Mago plugin using the dprint CLI. This command updates your dprint.json configuration file. ```bash dprint add mago # or install from npm dprint add npm:@dprint/mago ``` -------------------------------- ### Install Markdown Plugin Source: https://dprint.dev/plugins/markdown Install the markdown plugin using the dprint CLI or from npm. This command updates your dprint.json configuration. ```bash dprint add markdown # or install from npm dprint add npm:@dprint/markdown ``` -------------------------------- ### Install dprint via uv (Python/uv) Source: https://dprint.dev/install Add and run dprint using the uv package manager for Python projects. ```shell uv add dprint-py uv run dprint help ``` -------------------------------- ### Install Biome Plugin Source: https://dprint.dev/plugins/biome Install the Biome plugin using the dprint CLI or from npm. This command updates the dprint.json configuration file. ```bash dprint add biome ``` ```bash # or install from npm dprint add npm:@dprint/biome ``` -------------------------------- ### Install Jupyter Plugin Source: https://dprint.dev/plugins/jupyter Install the Jupyter plugin for dprint. You can also install it from npm. This command updates your dprint.json configuration. ```bash dprint add jupyter # or install from npm dprint add npm:@dprint/jupyter ``` -------------------------------- ### Get Help for dprint CLI Source: https://dprint.dev/cli Use `dprint help` or `dprint help ` to get information on how to use the CLI and its flags. This information is for the latest version. ```bash dprint help ``` ```bash dprint help fmt ``` -------------------------------- ### Debug Logging Example Output Source: https://dprint.dev/cli Example of detailed debug output from dprint, showing file operations, cache interactions, and plugin loading. ```text [DEBUG] Getting cache directory. [DEBUG] Reading file: C:\Users\user\AppData\Local\Dprint\Dprint\cache\cache-manifest.json [DEBUG] Checking path exists: ./dprint.json [DEBUG] Reading file: V:\dev\my-project\dprint.json [DEBUG] Globbing: ["**/*.{ts,tsx,js,jsx,json}", "!website/playground/dist", "!scripts/build-website", "!**/dist", "!**/target", "!**/wasm", "!**/*-lock.json", "!**/node_modules"] [DEBUG] Finished globbing in 12ms [DEBUG] Reading file: C:\Users\user\AppData\Local\Dprint\Dprint\cache\typescript-0.19.2.compiled_wasm [DEBUG] Reading file: C:\Users\user\AppData\Local\Dprint\Dprint\cache\json-0.4.1.compiled_wasm [DEBUG] Creating instance of dprint-plugin-typescript [DEBUG] Creating instance of dprint-plugin-jsonc [DEBUG] Created instance of dprint-plugin-jsonc in 9ms [DEBUG] Reading file: V:\dev\my-project\website\playground\tsconfig.json [DEBUG] Reading file: V:\dev\my-project\website\assets\schemas\v0.json [DEBUG] Reading file: V:\dev\my-project\dprint.json [DEBUG] Formatted file: V:\dev\my-project\website\assets\schemas\v0.json in 2ms [DEBUG] Formatted file: V:\dev\my-project\dprint.json in 0ms [DEBUG] Formatted file: V:\dev\my-project\website\playground\tsconfig.json in 0ms [DEBUG] Created instance of dprint-plugin-typescript in 35ms [DEBUG] Reading file: V:\dev\my-project\website\playground\public\formatter.worker.js [DEBUG] Reading file: V:\dev\my-project\website\assets\formatter\v1.js [DEBUG] Reading file: V:\dev\my-project\website\playground\src\plugins\getPluginInfo.ts [DEBUG] Formatted file: V:\dev\my-project\website\playground\public\formatter.worker.js in 22ms [DEBUG] Formatted file: V:\dev\my-project\website\assets\formatter\v1.js in 6ms [DEBUG] Formatted file: V:\dev\my-project\website\playground\src\plugins\getPluginInfo.ts in 4ms ...etc.... ``` -------------------------------- ### Add Markup_fmt Plugin Source: https://dprint.dev/plugins/markup_fmt Installs the markup_fmt plugin by adding it to your project's dprint configuration. ```bash dprint add g-plane/markup_fmt ``` -------------------------------- ### Install dprint via Shell Script Source: https://dprint.dev/install Use this command to install dprint on macOS, Linux, and Windows Subsystem for Linux (WSL). ```shell curl -fsSL https://dprint.dev/install.sh | sh ``` -------------------------------- ### Add Roslyn Plugin Source: https://dprint.dev/plugins/roslyn Install the Roslyn plugin using the dprint CLI. This command updates the dprint.json configuration file. ```bash dprint add roslyn ``` ```bash # or install from npm dprint add npm:@dprint/roslyn ``` -------------------------------- ### Incremental State Example Output Source: https://dprint.dev/cli Example JSON output from `dprint incremental-state`. The 'hash' field is critical for cache invalidation. ```json { "configs": [ { "path": "/home/david/dev/my-project/dprint.json", "hash": "3f9c2a7b1e4d8f60", "plugins": [ { "name": "dprint-plugin-typescript", "version": "0.95.15" }, { "name": "dprint-plugin-json", "version": "0.21.1" } ] } ] } ``` -------------------------------- ### Add Dockerfile Plugin Source: https://dprint.dev/plugins/dockerfile Install the Dockerfile plugin for dprint. This command adds the plugin to your project's dprint configuration. ```bash dprint add dockerfile ``` ```bash # or install from npm dprint add npm:@dprint/dockerfile ``` -------------------------------- ### Add Additional Formatting Plugins Source: https://dprint.dev/plugins/jupyter Add other dprint plugins to format the code blocks within Jupyter Notebooks. Examples include TypeScript, Markdown, and Ruff. ```bash dprint add typescript dprint add markdown dprint add ruff ``` -------------------------------- ### Single Override Configuration Source: https://dprint.dev/config Use the 'overrides' property to set specific configurations for files like package.json. This example shows a single override for JSON files. ```json { "json": { "overrides": { "files": ["**/package.json", "**/composer.json"], "indentWidth": 4, "useTabs": false } }, "plugins": [ "https://plugins.dprint.dev/json-0.22.0.wasm" ] } ``` -------------------------------- ### Add TypeScript Plugin Source: https://dprint.dev/plugins/typescript Install the TypeScript plugin for dprint using the CLI or npm. This command updates your dprint.json configuration. ```bash dprint add typescript # or install from npm dprint add npm:@dprint/typescript ``` -------------------------------- ### Initialize dprint Source: https://dprint.dev/setup Run this command in your project's root directory to create a `_dprint.json` file and automatically select plugins based on your project's files. ```bash dprint init ``` -------------------------------- ### Configure space before get accessor parentheses Source: https://dprint.dev/plugins/typescript/config Controls whether a space is added before the parentheses of a get accessor. Use `true` for `get myProp ()` and `false` for `get myProp()`. ```typescript get myProp () ``` -------------------------------- ### Initialize dprint Configuration Source: https://dprint.dev/overview Run this command to add a basic dprint configuration file to your project. ```bash dprint init ``` -------------------------------- ### Initialize Global Configuration Source: https://dprint.dev/global-config Run this command to create a `dprint.jsonc` file in your system's default configuration directory. You can customize this directory using the `DPRINT_CONFIG_DIR` environment variable. ```bash dprint init --global ``` -------------------------------- ### Add Plugin from URL via CLI Source: https://dprint.dev/config Add a plugin directly from its WebAssembly URL using the `dprint add` command. ```bash dprint add https://plugins.dprint.dev/json-x.x.x.wasm ``` -------------------------------- ### Add Multiple Plugins via CLI Source: https://dprint.dev/config Add several plugins simultaneously by listing their names after the `dprint add` command. ```bash dprint add typescript json markdown ``` -------------------------------- ### Initialize dprint with a custom config file location Source: https://dprint.dev/setup Specify a custom path for the configuration file when initializing dprint using the `-c` or `--config` flag. ```bash dprint init --config .dprint.jsonc ``` ```bash dprint init --config path/to/dprint.json ``` -------------------------------- ### Add Gofumpt Plugin Source: https://dprint.dev/plugins/gofumpt Run this command in your project directory to add the gofumpt plugin to your dprint configuration. ```bash dprint add jakebailey/gofumpt ``` -------------------------------- ### Non-interactive dprint initialization Source: https://dprint.dev/setup Use the `--yes` or `-y` flag to skip the interactive prompt and accept the default plugin selection. This is useful for scripting. ```bash dprint init --yes ``` -------------------------------- ### Add Ruff Plugin to dprint Source: https://dprint.dev/plugins/ruff Install the Ruff plugin for dprint using the dprint CLI or npm. This command updates the dprint.json configuration file. ```bash dprint add ruff # or install from npm dprint add npm:@dprint/ruff ``` -------------------------------- ### Format Using Only Global Configuration Source: https://dprint.dev/global-config Use this command to format files strictly with the global configuration, ignoring any local configuration files that might exist. ```bash dprint fmt --config-discovery=global ``` -------------------------------- ### Configure dprint.json for Jupyter Plugin Source: https://dprint.dev/plugins/jupyter Add the Jupyter plugin to your dprint.json configuration file. Ensure you have other formatting plugins installed to format the code blocks. ```json { "plugins": [ "https://plugins.dprint.dev/jupyter-0.2.3.wasm" ] } ``` -------------------------------- ### Check for Unformatted Files Source: https://dprint.dev/cli Run this command to get a report of files that are not formatted according to dprint's rules. This is useful for CI/CD pipelines or pre-commit hooks. ```bash dprint check ``` -------------------------------- ### Configure Gofumpt Plugin Source: https://dprint.dev/plugins/gofumpt Update your dprint.json configuration file to include the gofumpt plugin and its optional configuration. ```json { "gofumpt": { // gofumpt config goes here }, "plugins": [ "https://plugins.dprint.dev/jakebailey/gofumpt-vx.x.x.wasm" ] } ``` -------------------------------- ### Add Pretty GraphQL Plugin Source: https://dprint.dev/plugins/pretty_graphql Run this command in your project directory to add the Pretty GraphQL plugin to your dprint configuration. ```bash dprint add g-plane/pretty_graphql ``` -------------------------------- ### Output Incremental State Source: https://dprint.dev/cli Use this command to get the exact signal dprint uses for incremental cache decisions. Compare output between revisions to predict cache reuse or invalidation. ```bash dprint incremental-state ``` -------------------------------- ### Format Git Staged Files Source: https://dprint.dev/cli Requires dprint >= 0.47.0. Use the `--staged` flag to format only files that are currently staged in git. This requires git to be installed and used for source control. ```bash dprint fmt --staged ``` -------------------------------- ### Basic dprint CLI Usage Source: https://dprint.dev/cli The general syntax for using the dprint CLI involves specifying a subcommand, options, and optionally, files to operate on. ```bash dprint [OPTIONS] [--] [files]... ``` -------------------------------- ### Format Git Working Directory Files Source: https://dprint.dev/cli Requires dprint >= 0.55.0. Use the `--dirty` flag to format files with uncommitted changes in the git working directory (staged, unstaged, and untracked but not gitignored). This requires git to be installed. ```bash dprint fmt --dirty ``` -------------------------------- ### Multiple Override Configurations Source: https://dprint.dev/config For multiple overrides, provide an array of override objects. Each object can specify different file patterns and configurations. ```json { "json": { "overrides": [ { "files": ["**/package.json", "**/composer.json"], "indentWidth": 4, "useTabs": false }, { "files": "**/special-package.json", "lineWidth": 80 } ] }, "plugins": [ "https://plugins.dprint.dev/json-0.22.0.wasm" ] } ``` -------------------------------- ### Add a Specific Plugin by GitHub Repo via CLI Source: https://dprint.dev/config Specify the plugin to add using its GitHub repository path with the `dprint add` command. ```bash dprint add dprint/dprint-plugin-typescript ``` -------------------------------- ### Add Malva Plugin Source: https://dprint.dev/plugins/malva Run this command in your project directory to add the Malva plugin to your dprint configuration. ```bash dprint add g-plane/malva ``` -------------------------------- ### Extend Multiple Configuration Files Source: https://dprint.dev/config Reference multiple configuration files in an array for the 'extends' property. Configurations are applied in the order they appear, with later ones taking precedence. ```json { "extends": [ "https://dprint.dev/path/to/config/file.v1.json", "https://dprint.dev/path/to/config/other.v1.json" ] } ``` -------------------------------- ### Add a Standard Plugin by Name via CLI Source: https://dprint.dev/config Add a standard plugin directly by its common name using the `dprint add` command. ```bash dprint add typescript ``` -------------------------------- ### Format Code with dprint Source: https://dprint.dev/overview Execute this command to automatically format all supported code files in your project according to the dprint configuration. ```bash dprint fmt ``` -------------------------------- ### Specify Custom Configuration File URL Source: https://dprint.dev/cli You can also provide a URL to a dprint configuration file using the `--config` flag. This allows for remote configuration management. ```bash dprint fmt --config https://dprint.dev/path/to/some/config.json ``` -------------------------------- ### Add a Standard Plugin via CLI Source: https://dprint.dev/config Use the `dprint add` command to add a standard plugin by its name. This command will prompt for confirmation if no specific plugin is named. ```bash dprint add ``` -------------------------------- ### Extend Single Configuration File Source: https://dprint.dev/config Extend an existing configuration file by specifying its path or URL in the 'extends' property. This allows for inheriting settings. ```json { "extends": "https://dprint.dev/path/to/config/file.v1.json", "// ...omitted...": "" } ``` -------------------------------- ### Add Plugin with Checksum via CLI Source: https://dprint.dev/config Pin a specific plugin version by adding a checksum using the `--checksum` flag with the `dprint add` command. ```bash dprint add --checksum typescript ``` -------------------------------- ### Using Configuration Variables in JSON Source: https://dprint.dev/config Demonstrates how to use configuration variables within a JSON configuration value. This is useful for specifying paths relative to the configuration directory. ```json "rustfmt --config-path ${configDir}/rustfmt.toml" ``` -------------------------------- ### Add Plugin from npm via CLI Source: https://dprint.dev/config Add a plugin distributed via npm by specifying its npm package name with the `dprint add` command. ```bash dprint add npm:@dprint/json ``` -------------------------------- ### Format Directory with Confirmation Prompt Source: https://dprint.dev/global-config When running `dprint fmt` in a directory without a local dprint configuration, a prompt will appear asking for confirmation before formatting. This prevents accidental formatting of directories not intended to be part of a dprint project. ```bash > dprint fmt Warning You're not in a dprint project. Format '/home/david/dev/scratch' anyway? (Y/n) █ Hint: Specify the directory to bypass this prompt in the future (ex. `dprint fmt .`) ``` -------------------------------- ### Add Pretty YAML Plugin Source: https://dprint.dev/plugins/pretty_yaml Run this command in your project directory to add the Pretty YAML plugin to your dprint configuration. ```bash dprint add g-plane/pretty_yaml ``` -------------------------------- ### Check Code Formatting with dprint Source: https://dprint.dev/overview Run this command to verify that all code files in your project are correctly formatted without making any changes. ```bash dprint check ``` -------------------------------- ### Update All Plugins via CLI Source: https://dprint.dev/config Update all plugins listed in the configuration file to their latest versions using the `dprint config update` command. ```bash dprint config update ``` -------------------------------- ### Configure Markup_fmt Plugin Source: https://dprint.dev/plugins/markup_fmt Updates the dprint.json configuration file to include the markup_fmt plugin and its optional configuration. ```json { "markup": { // not "markup_fmt" // markup_fmt config goes here }, "plugins": [ "https://plugins.dprint.dev/g-plane/markup_fmt-v0.27.3.wasm" ] } ``` -------------------------------- ### Configuring Plugins in dprint.json Source: https://dprint.dev/config This snippet shows how to specify plugins within the dprint configuration file. The order of plugins determines precedence for formatting. ```json { // ...omitted... "plugins": [ // You may specify any urls or file paths here that you wish. "https://plugins.dprint.dev/typescript-0.96.1.wasm", "https://plugins.dprint.dev/json-0.22.0.wasm", "https://plugins.dprint.dev/markdown-0.22.1.wasm" ] } ``` -------------------------------- ### Global and Plugin-Specific Configuration Source: https://dprint.dev/config Configure global settings like 'lineWidth' and 'useTabs', which can be overridden by plugin-specific configurations (e.g., 'typescript.lineWidth', 'json.indentWidth'). ```json { "lineWidth": 160, "useTabs": true, "typescript": { "lineWidth": 80 }, "json": { "indentWidth": 2, "useTabs": false }, "plugins": [ // etc... ] } ``` -------------------------------- ### Change Configuration Discovery Method Source: https://dprint.dev/cli Control how dprint discovers configuration files using the `--config-discovery` flag. Options include `default`, `ignore-descendants`, `global`, and `false`. ```bash dprint --config-discovery=default ``` ```bash dprint --config-discovery=ignore-descendants ``` ```bash dprint --config-discovery=global ``` ```bash dprint --config-discovery=false ``` -------------------------------- ### Configure Dockerfile Plugin Source: https://dprint.dev/plugins/dockerfile Update your dprint.json configuration file to include the Dockerfile plugin and its settings. The 'dockerfile' property allows for custom configuration. ```json { "dockerfile": { // dockerfile config goes here }, "plugins": [ "https://plugins.dprint.dev/dockerfile-0.4.1.wasm" ] } ``` -------------------------------- ### Configure Pretty GraphQL Plugin Source: https://dprint.dev/plugins/pretty_graphql Update your dprint.json to include the plugin and optionally configure Pretty GraphQL settings. ```json { "graphql": { // Pretty GraphQL config goes here }, "plugins": [ "https://plugins.dprint.dev/g-plane/pretty_graphql-v0.2.3.wasm" ] } ``` -------------------------------- ### Configure Pretty YAML Plugin Source: https://dprint.dev/plugins/pretty_yaml Update your dprint.json file to include the Pretty YAML plugin and its configuration. Note that the configuration key is `yaml`, not `pretty_yaml`. ```json { "yaml": { // not "pretty_yaml" // Pretty YAML config goes here }, "plugins": [ "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.6.0.wasm" ] } ``` -------------------------------- ### Configure Roslyn Plugin Source: https://dprint.dev/plugins/roslyn Optionally configure the Roslyn plugin in your dprint.json file. C# specific formatting options can be set using the 'csharp.' syntax. ```json { "roslyn": { // roslyn's config goes here } // etc... } ``` ```json { "csharp.": } ``` -------------------------------- ### Upgrade dprint CLI Source: https://dprint.dev/cli To upgrade to the latest version of dprint (versions >= 0.30), run the `upgrade` command. ```bash dprint upgrade ``` -------------------------------- ### Display Format Times Source: https://dprint.dev/cli Use the `format-times` command to see how long dprint takes to format each file. This helps identify performance bottlenecks. ```shell dprint format-times ``` -------------------------------- ### Add Plugins to dprint Configuration Source: https://dprint.dev/overview Use this command to add support for specific file types like TypeScript, Markdown, and JSON to your dprint configuration. ```bash dprint add typescript markdown json ``` -------------------------------- ### Add Plugin to Global Configuration Source: https://dprint.dev/global-config Add plugins to your global configuration file using this command. The `-g` flag is an alias for `--global`. ```bash dprint add --global typescript ``` -------------------------------- ### Edit Global Configuration File Source: https://dprint.dev/global-config Open your global dprint configuration file in your default editor. You can specify a different editor by setting the `DPRINT_EDITOR` environment variable. ```bash dprint config edit --global ``` -------------------------------- ### Associate files with plugins Source: https://dprint.dev/config Map file patterns to specific plugins using the associations configuration, useful for files with non-standard extensions or no extension. ```json { "json": { "associations": [ // format any file named ".myconfigrc" matched by the // includes/excludes patterns in any directory with // the json plugin ".myconfigrc", // format this specific file using the json plugin "./my-relative-path/to-file", // format files that match this pattern "**/*.myconfig" ] }, "plugins": [ "https://plugins.dprint.dev/json-0.22.0.wasm" ] } ``` -------------------------------- ### Format Standard Input Source: https://dprint.dev/cli Use `dprint fmt --stdin ` to format code provided via standard input. The output is directed to standard output. ```bash dprint fmt --stdin ```