format_directory.ts view source
(log: Logger, dir: string, check?: boolean, filter?: PathFilter | PathFilter[] | undefined, patterns?: string[] | undefined): Promise<FormatDirectoryResult> import {format_directory} from '@fuzdev/gro/format_directory.js'; Formats files on the filesystem in-process via format_file.
When patterns is provided, formats those specific files/globs.
Otherwise formats dir (recursively, respecting filter) plus the root
files when dir is paths.source. In both modes, files matched by the
project root's .formatignore or .prettierignore are skipped.
Files the formatter rejects (e.g. a syntax error) are reported and fail the run in both modes rather than being silently skipped.
This is separated from ./format_file so modules that only need directory
traversal don't pull in the formatter (which loads the tsv native addon).
log
Loggerdir
stringcheck
when true, reports unformatted files instead of writing them
booleanfalsefilter?
directory filters (e.g. config.search_filters) to skip;
also prunes patterns results so an explicit glob can't reach node_modules
(PathFilter) | (PathFilter)[]patterns?
string[]returns
Promise<FormatDirectoryResult>