Skip to content

format

Format the source code.

Explicit FormatOptions.paths get --allow-no-files: a list dprint.json excludes entirely (a pre-commit hook staging only a demo-vault/ file) is nothing to format, not an error, while dprint would exit 14 with No files found to format. The whole-project run keeps the check, since finding nothing there is a broken configuration.

Every run also excludes every .claude/settings.local.json, passed as --excludes=<pattern>, which dprint adds to the configuration’s own excludes, and which applies to an explicit path too. The = form is load-bearing: --excludes takes several values, so --excludes <pattern> would swallow the file list that follows it.

Import:

import { format } from '@mnaoumov/typescript-dev-toolkit/formatters/dprint';

Signature:

function format(options: FormatOptions | undefined): Promise<void>

Parameters:

Parameter Type Description
options FormatOptions | undefined The FormatOptions.

Returns: Promise<void> — A Promise that resolves when the source code has been formatted.


Links to this page: