How to automatically run Prettier on all files in a project
By Flavio Copes
Learn how to run Prettier across every file in your project by adding a .prettierrc config and running npx prettier -w . to format them all at once.
~~~
Create a .prettierrc file in your project, for example
{
"tabWidth": 2,
"useTabs": false,
"semi": false
}
Then run
npx prettier -w .
If you just need to tidy one snippet before committing, I built a free code beautifier that formats HTML, CSS, and JavaScript in the browser.
~~~
Related posts about tools: