Forrest logo
back to the prettier tool

prettier:tldr:cb01d

prettier: Check if a specific file has been formatted.
$ prettier --check ${filename}
try on your machine

The command prettier --check ${filename} is used to run the Prettier code formatter tool with the --check option on a specific file.

Here is a breakdown of the components:

  • prettier: This is the command to run the Prettier code formatter. Prettier is a widely used tool for automatically formatting code and maintaining a consistent coding style across projects.

  • --check: This is an option for the prettier command. When used, it instructs Prettier to only check for formatting issues in the given file(s) without making any changes. If any issues are found, Prettier will print them to the console.

  • ${filename}: This is a placeholder representing the name of the file you want to check with Prettier. You would replace ${filename} with the actual name of the file when running the command.

By executing the command prettier --check ${filename}, you are essentially asking Prettier to analyze the specified file and determine if it adheres to the desired code style. If any formatting issues are detected, Prettier will display them in the console output.

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