LinuxCommandLibrary

prettier

TLDR

Format a file

$ prettier --write [file.js]
copy
Format multiple files
$ prettier --write "[**/*.js]"
copy
Check formatting
$ prettier --check [file.js]
copy
Format with specific parser
$ prettier --parser [typescript] [file]
copy
Show diff
$ prettier --write --list-different [file.js]
copy

SYNOPSIS

prettier [options] [files]

DESCRIPTION

prettier is an opinionated code formatter. Supports many languages.
The tool formats JS, CSS, HTML, and more. Enforces consistent style.
prettier formats code.

PARAMETERS

FILES

Files to format.
--write
Edit files in place.
--check
Check if formatted.
--parser NAME
Force parser.
--config FILE
Config file path.
--single-quote
Use single quotes.
--tab-width N
Tab width.

CAVEATS

Node.js required. Opinionated defaults.

HISTORY

Prettier was created for consistent code formatting across projects.

SEE ALSO

eslint(1), biome(1)

Copied to clipboard