Skip to main content

prettier

API BackendFrontendTooling

This documentation provides instructions for installing and using the Prettier configuration in your project, along with a sample configuration file and explanations of the formatting rules it defines.

Installation

yarn add @octopop/prettier

You can create a .prettierrc file in the root directory of your project and paste the following configuration:

{
  "$schema": "http://json.schemastore.org/prettierrc",
  "printWidth": 80,
  "semi": true,
  "singleQuote": true
}

Adjust the configuration options as needed based on your project's requirements.

Configure

Reference the configuration in your package.json file:

{
  "prettier": "@prettier/prettier-config"
}

Run

Add a script in your package.json file to run Prettier:

{
  "scripts": {
    "lint": "prettier -c --cache ."
  }
}