2021-07-19 04:26:28 +08:00
# Flarum Prettier Config
2021-07-19 04:31:11 +08:00
Flarum's official configuration for the Prettier code formatter.
2021-07-19 04:26:28 +08:00
2021-07-19 04:31:11 +08:00
For more info about shared Prettier configurations, [check out the Prettier documentation ](https://prettier.io/docs/en/configuration.html#sharing-configurations ).
## Usage
2021-07-19 05:25:28 +08:00
1. Install `@flarum/prettier-config` as a dev dependency:
```
npm i -D @flarum/prettier -config
yarn add -D @flarum/prettier -config
```
2. Add the `prettier` key to your `package.json` :
2021-07-19 04:31:11 +08:00
```jsonc
// package.json
{
"name": "my-cool-package",
"version": "1.0.0",
2024-09-28 22:47:45 +08:00
"prettier": "@flarum/prettier-config"
2021-07-19 04:31:11 +08:00
// ...
}
```
## Extending
2021-07-19 04:32:48 +08:00
You can extend our config with your own custom options, too. Import our config, then spread its require in a `.prettierrc.js` file.
2021-07-19 05:25:28 +08:00
> :warning: Make sure your `package.json` doesn't have the `prettier` key.
2021-07-19 04:31:11 +08:00
```js
// .prettierrc.js
module.exports = {
...require("@flarum/prettier-config"),
semi: false,
};
```