Prettier is an opinionated code formatter that enforces a consistent code style across the entire project. This repository is configured to use Prettier in two ways: automatically via a GitHub workflow and manually for local development.
This repository includes a GitHub Actions workflow that automatically formats all code.
main branch and on every pull request. It runs prettier --write . to format all files and commits any changes with the message “style: Format code with Prettier”.This ensures that all code merged into the main branch is consistently formatted.
While the automated workflow handles formatting on the server, it’s a good practice to run Prettier locally as you work.
This repository includes Prettier as a development dependency in package.json. To install it, run:
npm install
The repository also includes a .prettierrc configuration file, so you don’t need to create one.
You can run Prettier from the command line to format your files.
npx prettier . --write
npx prettier . --check
The CI workflow uses this command to validate formatting on pull requests.
For more detailed information on using Prettier, refer to the official Prettier documentation.