-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init: create the
@mediamonks/prettier-config
repository
* add `main.json` containing the prettier configuration * add a `README.md` describing how to install, use and extend the configuration
- Loading branch information
Paulius Simkevicius
committed
Jan 17, 2022
0 parents
commit eedbd0b
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# MediaMonks - Prettier Configuration | ||
|
||
The official Media.Monks prettier configuration, based on the [Frontend Coding Standards](https://github.com/mediamonks/frontend-coding-standards). | ||
|
||
## Installation | ||
|
||
The configuration can be installed via `npm`. | ||
|
||
```bash | ||
npm install --dev @mediamonks/prettier-config | ||
``` | ||
|
||
To inform prettier of this configuration, you have to add the `prettier` property to your `package.json` file: | ||
|
||
```json | ||
"prettier": "@mediamonks/prettier-config" | ||
``` | ||
|
||
Instead of manually editing your `package.json`, you can also utilize the `npm pkg` subcommand: | ||
|
||
```bash | ||
npm pkg set prettier=@mediamonks/prettier-config | ||
``` | ||
|
||
## Extending | ||
|
||
[Prettier does not ship with a built-in way of extending configurations](https://prettier.io/docs/en/configuration.html#sharing-configurations). | ||
|
||
To extend the configuration, you will have to create a `.prettierrc.js` file (or `.prettierrc.cjs` if your package is a `"type": "module"`) and import the Media.Monks configuration using `require`: | ||
|
||
```js | ||
module.exports = { | ||
...require("@mediamonks/prettier-config"), | ||
semi: false, | ||
}; | ||
``` | ||
|
||
If you have previously added the configuration to your `package.json`, via the `prettier` property, you can now remove it. | ||
You can also utilize the `npm pkg`: | ||
|
||
```bash | ||
npm pkg delete prettier | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/prettierrc", | ||
"printWidth": 100, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"proseWrap": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "@mediamonks/prettier-config", | ||
"version": "1.0.0", | ||
"description": "Default Media.Monks Prettier Configuration", | ||
"keywords": [ | ||
"Media.Monks", | ||
"prettier" | ||
], | ||
"homepage": "https://github.com/mediamonks/prettier-config#readme", | ||
"bugs": { | ||
"url": "https://github.com/mediamonks/prettier-config/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/mediamonks/prettier-config.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Media.Monks", | ||
"main": "main.json" | ||
} |