# @mediacurrent/prettier-config

> Make sure all of your code is run through Prettier when you commit it to git. We achieve this by configuring prettier to run on git hooks using husky and lint-staged.

Latest version **0.0.1** (published 2020-12-01) · 0 weekly downloads

## Install

```sh
npm install @mediacurrent/prettier-config
pnpm add @mediacurrent/prettier-config
yarn add @mediacurrent/prettier-config
bun add @mediacurrent/prettier-config
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-12-01 |
| First published | 2020-12-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | mediacurrent-it, joestewart, jrcallicott, graysonhicks, shrop, bfodeke, zhawkins |
| Keywords | mediacurrent, prettier, prettier-config |

## Links

- npm: https://www.npmjs.com/package/@mediacurrent/prettier-config
- Repository: https://github.com/mediacurrent/prettier-config
- Issues: https://github.com/mediacurrent/prettier-config/issues
- npm.io page: https://npm.io/package/@mediacurrent/prettier-config

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2020-12-01

## README

# prettier-config
Make sure all of your code is run through Prettier when you commit it to git. We achieve this by configuring prettier to run on git hooks using husky and lint-staged.

## Install

`npm install --save-dev prettier @mediacurrent/prettier-config`

## Extend
Can be extended two ways:

### package.json

Add the following to you `package.json`

`"prettier": "@mediacurrent/prettier-config"`

This method *does not* allow overrides.  If overrides are needed, use the next method.

### .prettierrc.js

```javascript
module.exports = {
  ...require("@mediacurrent/prettier-config"),
  // Override here
  semi: false,
};
```

## Ignore File
Unfortunately, Prettier does not have a way to extend a shared `.prettierignore` file so the one in this repo must be copied and pasted in to a new `.prettierignore` file at the root of your project.

## Pre-commit Hook
To have prettier format all files before commit (to prevent unformatted files from being committed), follow these steps.

### Install packages

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

### Add hooks to `package.json`
This will affect `.js`, `.md`, `.mdx`, `.json`, and `.scss` files.  For this to work properly, [eslint](https://github.com/mediacurrent/eslint-config) and [sass-lint](https://github.com/mediacurrent/sass-lint-config) need to have been configured properly.

Add the following `husky` and `lint-staged` commands to your `package.json`.

```json
{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,md,mdx,json}": "['prettier --write']",
    "*.scss": "npm run lint:sass",
  }
}
```

---
_Source: https://npm.io/package/@mediacurrent/prettier-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
