framework/js-packages/prettier-config/README.md

39 lines
906 B
Markdown
Raw Normal View History

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
Add the `prettier` key to your `package.json`:
```jsonc
// package.json
{
"name": "my-cool-package",
"version": "1.0.0",
"prettier": "@flarum/prettier-config"
// ...
}
```
## 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.
Make sure your `package.json` doesn't have the `prettier` key, and that it has `@flarum/prettier-config` as a dev dependency.
```
npm i -D @flarum/prettier-config
yarn add -D @flarum/prettier-config
```
2021-07-19 04:31:11 +08:00
```js
// .prettierrc.js
module.exports = {
...require("@flarum/prettier-config"),
semi: false,
};
```