fmt
The rs fmt command is built on Prettier. It processes files in parallel by default and uses the high-performance Yuku parser for JavaScript and TypeScript, providing better performance than using Prettier directly.
Usage
Pass files, directories, or glob patterns to select what to format. When no inputs are provided, rs fmt formats the current directory. rs format is an alias for rs fmt.
Options
--write, --check, and --list-different are mutually exclusive.
Examples:
File discovery
Directory and glob discovery follows .gitignore files, skips binary files, and does not traverse version-control directories or node_modules. Files for which Prettier cannot infer a parser are skipped.
Use ignorePatterns for additional project-specific exclusions. Both positive and negative input globs are resolved from the current working directory.
Configuration
Configure formatting through define.fmt() in the Rstack configuration file:
define.fmt() accepts standard Prettier options and the overrides field, plus these Rstack options:
ignorePatterns: Gitignore-compatible patterns relative to the directory containingrstack.config.ts.sortPackageJson: Sortpackage.jsonfields before formatting. The default value isfalse.
rs fmt does not load Prettier configuration files, .prettierignore, or .editorconfig. Move those settings and ignore rules into define.fmt().
When using Prettier plugins, pass each plugin as a package name, file path, or URL. Imported plugin objects are not supported because formatting runs in workers. Package names and relative paths are resolved from the Rstack configuration directory.