diff --git a/docs/manifest.json b/docs/manifest.json index 50fdc3673e7d71..e97610daf02c40 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1445,6 +1445,12 @@ "markdown_source": "../packages/postcss-themes/README.md", "parent": "packages" }, + { + "title": "@wordpress/prettier-config", + "slug": "packages-prettier-config", + "markdown_source": "../packages/prettier-config/README.md", + "parent": "packages" + }, { "title": "@wordpress/primitives", "slug": "packages-primitives", diff --git a/package-lock.json b/package-lock.json index b906c9019f78eb..3f9e70df1bfff7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10953,6 +10953,10 @@ "postcss-color-function": "^4.0.1" } }, + "@wordpress/prettier-config": { + "version": "file:packages/prettier-config", + "dev": true + }, "@wordpress/primitives": { "version": "file:packages/primitives", "requires": { @@ -11003,6 +11007,7 @@ "@wordpress/eslint-plugin": "file:packages/eslint-plugin", "@wordpress/jest-preset-default": "file:packages/jest-preset-default", "@wordpress/npm-package-json-lint-config": "file:packages/npm-package-json-lint-config", + "@wordpress/prettier-config": "file:packages/prettier-config", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", "chalk": "^2.4.2", @@ -19770,7 +19775,7 @@ }, "node-pre-gyp": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", + "resolved": false, "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", "dev": true, "optional": true, @@ -19789,7 +19794,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "resolved": false, "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, diff --git a/package.json b/package.json index 96271ef7f816be..1e08e1aa9c03ea 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "@wordpress/library-export-default-webpack-plugin": "file:packages/library-export-default-webpack-plugin", "@wordpress/npm-package-json-lint-config": "file:packages/npm-package-json-lint-config", "@wordpress/postcss-themes": "file:packages/postcss-themes", + "@wordpress/prettier-config": "file:packages/prettier-config", "@wordpress/scripts": "file:packages/scripts", "babel-loader": "8.0.6", "babel-plugin-emotion": "10.0.27", diff --git a/packages/prettier-config/.npmrc b/packages/prettier-config/.npmrc new file mode 100644 index 00000000000000..43c97e719a5a82 --- /dev/null +++ b/packages/prettier-config/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/packages/prettier-config/CHANGELOG.md b/packages/prettier-config/CHANGELOG.md new file mode 100644 index 00000000000000..6d73529eee2190 --- /dev/null +++ b/packages/prettier-config/CHANGELOG.md @@ -0,0 +1,5 @@ +## Master + +### Initial Release + +- The config was extracted from `@wordpress/scripts` package ([#20026](https://github.com/WordPress/gutenberg/pull/20026)). diff --git a/packages/prettier-config/lib/prettier-config.js b/packages/prettier-config/lib/index.js similarity index 100% rename from packages/prettier-config/lib/prettier-config.js rename to packages/prettier-config/lib/index.js diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json index 371d0f5d02beda..681c28ea6110c9 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -22,9 +22,9 @@ "node": ">=10" }, "files": [ - "lib/prettier-config.js" + "lib/index.js" ], - "main": "lib/prettier-config.js", + "main": "lib/index.js", "publishConfig": { "access": "public" } diff --git a/packages/prettier-config/__tests__/prettier-config.test.js b/packages/prettier-config/test/index.js similarity index 83% rename from packages/prettier-config/__tests__/prettier-config.test.js rename to packages/prettier-config/test/index.js index 49ef7fe31c8ada..bebedab8802d88 100644 --- a/packages/prettier-config/__tests__/prettier-config.test.js +++ b/packages/prettier-config/test/index.js @@ -6,7 +6,7 @@ import { isPlainObject } from 'lodash'; /** * Internal dependencies */ -import config from '../lib/prettier-config.js'; +import config from '../lib/'; describe( 'prettier config tests', () => { it( 'should be an object', () => { diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 2d15b6edd34555..9a68b9aad9e329 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -1,5 +1,9 @@ ## Master +## Internal + +- Package depends now on the shared Prettier config exposed in `@wordpress/prettier-config` dependency ([#20026](https://github.com/WordPress/gutenberg/pull/20026)). + ## 7.1.2 (2020-02-25) ### Bug Fixes diff --git a/packages/scripts/config/.prettierrc.js b/packages/scripts/config/.prettierrc.js index 17308856dce9d9..ca2665d67f1b2d 100644 --- a/packages/scripts/config/.prettierrc.js +++ b/packages/scripts/config/.prettierrc.js @@ -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' ); diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 753ba80ed431a7..74e202412d5084 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -39,6 +39,7 @@ "@wordpress/eslint-plugin": "file:../eslint-plugin", "@wordpress/jest-preset-default": "file:../jest-preset-default", "@wordpress/npm-package-json-lint-config": "file:../npm-package-json-lint-config", + "@wordpress/prettier-config": "file:../prettier-config", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", "chalk": "^2.4.2",