Skip to main content

An opinionated code formatter for JavaScript, JSON, CSS, YAML, and more.

# To format a file and print the result to stdout:
prettier <path/to/file>

# To check if a specific file has been formatted:
prettier --check <path/to/file>

# To run with a specific configuration file:
prettier --config <path/to/config_file> <path/to/file>

# To format a file or directory, replacing the original:
prettier --write <path/to/file_or_directory>

# To format files or directories recursively using single quotes and no trailing commas:
prettier --single-quote --trailing-comma none --write <path/to/file_or_directory>