Forrest logo
back to the prettier tool

prettier:tldr:50bfb

prettier: Format JavaScript and TypeScript files recursively, replacing the original.
$ prettier --write "**/*.{js,jsx,ts,tsx}"
try on your machine

This command is using the Prettier code formatter to automatically format and modify code files in the specified patterns.

Here is a breakdown of the command:

  • prettier: This is the command to execute the Prettier code formatter.
  • --write: This flag tells Prettier to write the formatted code back to the files instead of just displaying it in the console.
  • "**/*.{js,jsx,ts,tsx}": This is a glob pattern that specifies the files to be formatted. The double asterisk (**) means any directory, and the curly braces specify the file extensions. In this case, it will match any JavaScript, TypeScript, or JSX files in any directory.

By running this command, Prettier will scan all the files that match the specified patterns and automatically format them with the configured rules. The changes will be written back to the original files.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the prettier tool