1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-22 18:44:07 +02:00
tldr/pages/common/prettier.md
Managor fc3a8d07a1
*: use a more specific more info link, io domain (#17676)
Co-authored-by: Dylan <145150333+dmmqz@users.noreply.github.com>
2025-08-16 10:32:10 +03:00

28 lines
814 B
Markdown

# prettier
> An opinionated code formatter for JavaScript, JSON, CSS, YAML, and more.
> More information: <https://prettier.io/docs/cli>.
- Format a file and print the result to `stdout`:
`prettier {{path/to/file}}`
- Check if a specific file has been formatted:
`prettier --check {{path/to/file}}`
- Run with a specific configuration file:
`prettier --config {{path/to/config_file}} {{path/to/file}}`
- Format a file or directory, replacing the original:
`prettier --write {{path/to/file_or_directory}}`
- Format files or directories recursively using single quotes and no trailing commas:
`prettier --single-quote --trailing-comma {{none}} --write {{path/to/file_or_directory}}`
- Format JavaScript and TypeScript files recursively, replacing the original:
`prettier --write "**/*.{js,jsx,ts,tsx}"`