Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.14 KB

README.adoc

File metadata and controls

52 lines (40 loc) · 1.14 KB

prettier-config

Prettier code formatter configuration.

Usage

Setting up a project

  1. Install dependencies:

    npm install --save-dev github:boar-network/prettier-config prettier
  2. Configure prettier:

    The easiest way to configure prettier to use this configuration is to define prettier property in the project’s package.json:

    "prettier": "@boar-network/prettier-config"

    For more sophisticated configuration instead of adding this entry add a configuration file (see: Plugins section).

  3. Define scripts property in package.json, e.g.:

    "scripts": {
      "format": "prettier --check .",
      "format:fix": "prettier --write ."
    }
  4. Run npm run format or npm run format:fix

Plugins

To handle .sh or .toml files you need to install dedicated plugins:

  • for sh: npm install --save-dev prettier-plugin-sh

  • for toml: npm install --save-dev prettier-plugin-toml

And configure the plugins usage in .prettierrc.js, e.g.:

module.exports = {
  ...require("@boar-network/prettier-config"),
  plugins: ["prettier-plugin-sh", "prettier-plugin-toml"],
}