format_directory.ts

Declarations
#

view source

format_directory
#

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 Logger

dir

type string

check

type boolean
default false

extensions

type string
default EXTENSIONS_DEFAULT

root_paths

type string
default ROOT_PATHS_DEFAULT

prettier_cli

type string | Cli
default PRETTIER_CLI_DEFAULT

pm_cli

type string
default PM_CLI_DEFAULT

additional_args?

type Args | undefined
optional

patterns?

type string[] | undefined
optional

returns

Promise<SpawnResult>

Depends on
#

Imported by
#