Skip to content

Using Prettier to Check Code Formatting

Rueben van der Westhuizen edited this page Jun 2, 2024 · 1 revision

Prettier

Prerequisites

Ensure you have Node.js and npm installed. If not, you can download and install them from

Checking Code Formatting

To check the formatting of all JavaScript and TypeScript files in your project, use the following command:

npx prettier --check "**/*.{js,ts}"

Automatically Formatting Code

To format all JavaScript and TypeScript files in your project, use the following command:

npx prettier --write "**/*.{js,ts}"

~ Additionally we can add husky to do this automatically if this is not already the case