Posts

Showing posts from March, 2022

Install Prettier

  First, install Prettier locally: npm yarn npm install --save-dev --save-exact prettier Then, create an empty config file to let editors and other tools know you are using Prettier: echo {}> .prettierrc.json Next, create a  .prettierignore  file to let the Prettier CLI and editors know which files to  not  format. Here’s an example: # Ignore artifacts: build coverage Tip! Base your .prettierignore on .gitignore and .eslintignore (if you have one). Another tip! If your project isn’t ready to format, say, HTML files yet, add  *.html . Now, format all files with Prettier: npm yarn npx prettier --write . What is that  npx  thing?  npx  ships with  npm  and lets you run locally installed tools. We’ll leave off the  npx  part for brevity throughout the rest of this file! Note: If you forget to install Prettier first,  npx  will temporarily download the latest version. That’s not a good idea when using Pretti...