format_directory.ts view source
(log: Logger, dir: string, check?: boolean, extensions?: string, root_paths?: string, prettier_cli?: string | Cli, pm_cli?: string, additional_args?: Args | undefined, patterns?: string[] | undefined): Promise<...> Formats files on the filesystem.
When patterns is provided, formats those specific files/patterns.
Otherwise formats dir with default extensions, plus root files if dir is paths.source.
This is separated from ./format_file to avoid importing all of the prettier code
inside modules that import this one. (which has a nontrivial cost)
log
type
Loggerdir
type
stringcheck
type
boolean default
falseextensions
type
string default
EXTENSIONS_DEFAULTroot_paths
type
string default
ROOT_PATHS_DEFAULTprettier_cli
type
string | Cli default
PRETTIER_CLI_DEFAULTpm_cli
type
string default
PM_CLI_DEFAULTadditional_args?
type
Args | undefinedoptional
patterns?
type
string[] | undefinedoptional
returns
Promise<SpawnResult>