# @digitalroute/prettier-config

Prettier shareable configuration for Digitalroute projects.

## Usage

Install this config as a `devDependency`:

```bash
npm install @digitalroute/prettier-config --save-dev
```

Add the following to your `package.json`:

```jsonc
{
  "prettier": "@digitalroute/prettier-config"
}
```

## Usage with husky and lint-staged

[Husky](https://www.npmjs.com/package/husky) is a tool that triggers npm-scripts based on git actions. [Lint-staged](https://www.npmjs.com/package/lint-staged) let's you run linting and formatting on files that are staged. You can use these two tools to ensure that all commited files are prettified before they are commited.

Install husky and lint-staged as a `devDependency`:

```bash
npm install husky lint-staged --save-dev
```

Add the following to your `package.json`:

```jsonc
{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,tsx,js,jsx,json,md,mdx,yml}": "prettier --write"
  }
}
```
