diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000000000..0605f83bf90782 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,3 @@ +// Import the default config file and expose it in the project root. +// Useful for editor integrations. +module.exports = require( '@wordpress/scripts/config/.prettierrc.js' ); diff --git a/package.json b/package.json index f4f3ac73ae5bb5..c3676ef905b1c4 100644 --- a/package.json +++ b/package.json @@ -146,6 +146,7 @@ "node-watch": "0.6.0", "postcss": "7.0.13", "postcss-loader": "3.0.0", + "prettier": "npm:wp-prettier@1.19.1", "progress": "2.0.3", "react": "16.9.0", "react-dom": "16.9.0", @@ -186,6 +187,7 @@ "fixtures:server-registered": "packages/env/bin/wp-env run wordpress ./wp-content/plugins/gutenberg/bin/get-server-blocks.php > test/integration/full-content/server-registered.json", "fixtures:generate": "npm run fixtures:server-registered && cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit", "fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate", + "format-js": "wp-scripts format-js", "lint": "concurrently \"npm run lint-js\" \"npm run lint-pkg-json\" \"npm run lint-css\" \"npm run lint-types\"", "lint-js": "wp-scripts lint-js", "lint-js:fix": "npm run lint-js -- --fix", diff --git a/packages/scripts/config/.prettierrc.js b/packages/scripts/config/.prettierrc.js new file mode 100644 index 00000000000000..61b185ac2c203f --- /dev/null +++ b/packages/scripts/config/.prettierrc.js @@ -0,0 +1,12 @@ +module.exports = { + useTabs: true, + tabWidth: 2, + printWidth: 100, + singleQuote: true, + trailingComma: 'es5', + bracketSpacing: true, + parenSpacing: true, + jsxBracketSameLine: false, + semi: true, + arrowParens: 'always', +}; diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 5009eb80d2ef9b..b361ebbd85e845 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -45,6 +45,7 @@ "command-exists": "^1.2.8", "cross-spawn": "^5.1.0", "decompress-zip": "^0.2.2", + "dir-glob": "^3.0.1", "eslint": "^6.1.0", "eslint-plugin-markdown": "1.0.1", "jest": "^24.9.0",