npm package: @interaktiv/prettier-config-dia
Description: Prettier shareable configuration for projects at DIA
Author: DIA die.interaktiven
Latest version: 2.1.1

# prettier-config-dia

> [Prettier][prettier] shareable configuration for projects at
> [DIA][dia-website]

[![Commitizen friendly][commitizen-badge]][commitizen]
[![Conventional Commits][conventional-commits-badge]][conventional-commits]
[![Code of Conduct][coc-badge]][coc]
[![Semantic Release][semantic-release-badge]][semantic-release]
[![MIT License][license-badge]][license]

[![npm latest version][latest-version-badge]][package]
[![npm next version][next-version-badge]][package]

## Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Installation](#markdown-header-installation)
- [Usage](#markdown-header-usage)
- [Optional Configurations](#markdown-header-optional-configurations)
- [Used Plugins](#markdown-header-used-plugins)
- [Recommendations](#markdown-header-recommendations)
  - [Pre-Commit Hook Installation](#markdown-header-pre-commit-hook-installation)
  - [Pre-Commit Hook Usage](#markdown-header-pre-commit-hook-usage)
- [License](#markdown-header-license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

```shell
npm install --save-dev @interaktiv/prettier-config-dia
```

## Usage

**.prettierrc.js**

```javascript
module.exports = require('@interaktiv/prettier-config-dia');
```

**.prettierignore**

Do something like this:

```shell
cat ./node_modules/@interaktiv/prettier-config-dia/.prettierignore >> .prettierignore
```

or use the `prettier-cli`:

```shell
prettier --ignore "./node_modules/@interaktiv/prettier-config-dia/.prettierignore" --write .
```

**package.json**

e.g.

```json
...
"scripts": {
  "format": "prettier --write \"src/**/*.+(js|ts|vue|json)\""
}
...
```

## Optional Configurations

- [aura](./aura.js) - [Lightning Aura Components][aura], extends but also
  replaces options in a more es5 based fashion for files in `**/aura/**` dirs.

- [lwc](./lwc.js) - [Lightning Web Components][], literally just extends the
  default config and sets the parser for `html` files in `**/lwc/**` dirs to
  `lwc`.

  If you are in a [Lightning Web Components][] project just set your prettier
  config to `@interaktiv/prettier-config-dia/lwc`.

- [salesforce](./salesforce.js) - A merge of the `lwc` and `aura` configs to
  support Code Formatting for Development on the [Salesforce][] Platform.

## Used Plugins

- [prettier-plugin-apex][] - Used to format our Apex code in Salesforce DX
  projects.
- [prettier-plugin-packagejson][] - Used to make the keys of package.json well
  sorted order

If you wanna opt-out of these plugin see the [Prettier
Docs][prettier-plugins-doc].

## Recommendations

We recommend to use [Prettier][prettier] together with [husky][husky] and
[lint-staged][lint-staged] as a `pre-commit` git hook.

### Pre-Commit Hook Installation

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

### Pre-Commit Hook Usage

**package.json**

e.g.

```json
...
"husky": {
  "hooks": {
    "pre-commit": "lint-staged"
  }
},
"lint-staged": {
  "**/*.+(js|ts|vue|json|css|sass|less|graphql|yml|yaml|scss|md)": [
    "prettier --write",
    "git add",
  ]
}
...
```

## License

[MIT][license] Copyright © 2019-present [die.interaktiven GmbH & Co.
KG][dia-website]

[aura]:
  https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/intro_framework.htm/
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg
[coc]: ./other/CODE_OF_CONDUCT.md
[commitizen]: http://commitizen.github.io/cz-cli
[commitizen-badge]:
  https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
[conventional-commits]: https://conventionalcommits.org
[conventional-commits-badge]:
  https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
[dia-website]: https://die-interaktiven.de
[downloads-badge]:
  https://img.shields.io/npm/dw/@interaktiv/prettier-config-dia.svg
[downloads-total-badge]:
  https://img.shields.io/npm/dt/@interaktiv/prettier-config-dia.svg
[husky]: https://www.npmjs.com/package/husky
[issues]: https://bitbucket.org/dieinteraktiven/prettier-config-dia/issues
[issues-badge]:
  https://img.shields.io/bitbucket/issues-raw/dieinteraktiven/prettier-config-dia.svg
[latest-version-badge]:
  https://img.shields.io/npm/v/@interaktiv/prettier-config-dia/latest.svg
[license]: https://opensource.org/licenses/MIT
[license-badge]:
  https://img.shields.io/npm/l/@interaktiv/prettier-config-dia.svg
[lightning web components]:
  https://developer.salesforce.com/docs/component-library/documentation/lwc/
[lint-staged]: https://www.npmjs.com/package/lint-staged
[lwc]:
  https://developer.salesforce.com/docs/component-library/documentation/lwc/
[next-version-badge]:
  https://img.shields.io/npm/v/@interaktiv/prettier-config-dia/next.svg
[package]: https://npmjs.com/package/@interaktiv/prettier-config-dia
[pull-requests]:
  https://bitbucket.org/dieinteraktiven/prettier-config-dia/pull-requests
[pull-requests-badge]:
  https://img.shields.io/bitbucket/pr-raw/dieinteraktiven/prettier-config-dia.svg
[prettier]: https://prettier.io
[prettier-plugin-apex]: https://npmjs.com/package/prettier-plugin-apex
[prettier-plugins-doc]: https://prettier.io/docs/en/plugins.html#using-plugins
[prettier-plugin-packagejson]:
  https://www.npmjs.com/package/prettier-plugin-packagejson/
[salesforce]: https://www.salesforce.com/
[semantic-release]: https://github.com/semantic-release/semantic-release
[semantic-release-badge]:
  https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[version-badge]:
  https://img.shields.io/npm/v/@interaktiv/prettier-config-dia.svg