Skip to content

Commit

Permalink
Add Prettier shared config package
Browse files Browse the repository at this point in the history
  • Loading branch information
ntwb committed Feb 4, 2020
1 parent 83762b8 commit 20e7321
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/prettier-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Prettier Config

WordPress Prettier shareable config for [Prettier](https://prettier.io).

## Installation

Install the module

```shell
$ npm install @wordpress/Prettier-config --save-dev
```

## Usage

Add this to your `package.json` file:

```json
prettier": "@wordpress/prettier-config"
]
```

Alternatively, add this to `.prettierrc` file:

```
extends @wordpress/prettier-config
```

<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
15 changes: 15 additions & 0 deletions packages/prettier-config/__tests__/prettier-config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* External dependencies
*/
import { isPlainObject } from 'lodash';

/**
* Internal dependencies
*/
import config from '../lib/prettier-config.js';

describe( 'prettier config tests', () => {
it( 'should be an object', () => {
expect( isPlainObject( config ) ).toBeTruthy();
} );
} );
12 changes: 12 additions & 0 deletions packages/prettier-config/lib/prettier-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
useTabs: true,
tabWidth: 4,
printWidth: 80,
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
parenSpacing: true,
jsxBracketSameLine: false,
semi: true,
arrowParens: 'always',
};
31 changes: 31 additions & 0 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@wordpress/prettier-config",
"version": "0.0.1",
"description": "WordPress Prettier shared configuration.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"prettier",
"prettier-config"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/prettier-config/README.md",
"repository": {
"type": "git",
"url": "https://github.com/WordPress/gutenberg.git",
"directory": "packages/prettier-config"
},
"bugs": {
"url": "https://github.com/WordPress/gutenberg/issues"
},
"engines": {
"node": ">=10"
},
"files": [
"lib/prettier-config.js"
],
"main": "lib/prettier-config.js",
"publishConfig": {
"access": "public"
}
}

0 comments on commit 20e7321

Please sign in to comment.