-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Prettier shared config package (#20026)
* Add Prettier shared config package * Update packages/prettier-config/README.md Co-Authored-By: Grzegorz (Greg) Ziółkowski <grzegorz@gziolo.pl> * Update README.md * Use @wordpres/prettier-config with @wordpress/scripts Co-authored-by: Grzegorz (Greg) Ziółkowski <grzegorz@gziolo.pl>
- Loading branch information
Showing
12 changed files
with
111 additions
and
14 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
package-lock=false |
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,5 @@ | ||
## Master | ||
|
||
### Initial Release | ||
|
||
- The config was extracted from `@wordpress/scripts` package ([#20026](https://github.com/WordPress/gutenberg/pull/20026)). |
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,27 @@ | ||
# 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> |
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,12 @@ | ||
module.exports = { | ||
useTabs: true, | ||
tabWidth: 4, | ||
printWidth: 80, | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
bracketSpacing: true, | ||
parenSpacing: true, | ||
jsxBracketSameLine: false, | ||
semi: true, | ||
arrowParens: '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,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/index.js" | ||
], | ||
"main": "lib/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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,15 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isPlainObject } from 'lodash'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import config from '../lib/'; | ||
|
||
describe( 'prettier config tests', () => { | ||
it( 'should be an object', () => { | ||
expect( isPlainObject( config ) ).toBeTruthy(); | ||
} ); | ||
} ); |
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
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 |
---|---|---|
@@ -1,12 +1 @@ | ||
module.exports = { | ||
useTabs: true, | ||
tabWidth: 4, | ||
printWidth: 80, | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
bracketSpacing: true, | ||
parenSpacing: true, | ||
jsxBracketSameLine: false, | ||
semi: true, | ||
arrowParens: 'always', | ||
}; | ||
module.exports = require( '@wordpress/prettier-config' ); |
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