Add Prettier support for WP coding style

MAILPOET-6215
This commit is contained in:
Oluwaseun Olorunsola
2024-11-06 12:08:45 +01:00
committed by Oluwaseun Olorunsola
parent 8c8bd728a7
commit 3402ae74da
3 changed files with 31 additions and 17 deletions

View File

@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/prettier-config' );

View File

@ -13,14 +13,17 @@
"lint:css-fix": "wp-scripts lint-style --fix",
"lint:js": "wp-scripts lint-js ./src/**",
"lint:js-fix": "wp-scripts lint-js ./src/** --fix",
"check-types": "NODE_OPTIONS=--max_old_space_size=2048 tsc --noEmit"
},
"check-types": "NODE_OPTIONS=--max_old_space_size=2048 tsc --noEmit",
"format": "./node_modules/.bin/prettier --config .prettierrc.js --write 'src/**/*.{js,jsx,json,ts,tsx,yml,yaml}'"
},
"lint-staged": {
"*.{scss,css}": "wp-scripts lint-style",
"*.{js,jsx,ts,tsx}": "wp-scripts lint-js ./src/**"
"*.{js,jsx,json,ts,tsx,yml,yaml}": "npm run format",
"*.{scss,css}": "npm run lint:css",
"*.{js,jsx,ts,tsx}": "npm run lint:js"
},
"dependencies": {
"@wordpress/api-fetch": "^7.0.0",
"@wordpress/base-styles": "^5.0.0",
"@wordpress/block-editor": "^13.0.0",
"@wordpress/block-library": "^9.0.0",
"@wordpress/blocks": "^13.0.0",
@ -38,6 +41,7 @@
"@wordpress/i18n": "^5.0.0",
"@wordpress/icons": "^10.0.0",
"@wordpress/interface": "^6.0.0",
"@wordpress/is-shallow-equal": "^5.0.0",
"@wordpress/keyboard-shortcuts": "^5.0.0",
"@wordpress/keycodes": "^4.0.0",
"@wordpress/media-utils": "^5.0.0",
@ -46,17 +50,13 @@
"@wordpress/private-apis": "^1.0.0",
"@wordpress/rich-text": "^7.0.0",
"@wordpress/url": "^4.0.0",
"@wordpress/is-shallow-equal": "^5.0.0",
"@wordpress/base-styles": "^5.0.0",
"classnames": "^2.5.1",
"deepmerge": "^4.3.1",
"lodash": "^4.17.21",
"react": "18.3.1",
"react-dom": "18.3.1",
"lodash": "^4.17.21"
"react-dom": "18.3.1"
},
"devDependencies": {
"@mailpoet/eslint-config": "workspace:^",
"@wordpress/scripts": "27.9.0",
"@types/history": "^4.7.11",
"@types/js-cookie": "^3.0.2",
"@types/lodash": "^4.14.180",
@ -69,8 +69,10 @@
"@types/wordpress__edit-post": "^7.5.7",
"@types/wordpress__editor": "^13.6.8",
"@types/wordpress__media-utils": "^4.14.4",
"@wordpress/prettier-config": "^4.11.0",
"@wordpress/scripts": "27.9.0",
"core-js": "^3.37.1",
"eslint-plugin-check-file": "^2.8.0",
"prettier": "npm:wp-prettier@^3.0.3",
"wp-types": "^3.65.0"
},
"volta": {

21
pnpm-lock.yaml generated
View File

@ -658,9 +658,6 @@ importers:
specifier: 18.3.1
version: 18.3.1(react@18.3.1)
devDependencies:
'@mailpoet/eslint-config':
specifier: workspace:^
version: link:../eslint-config
'@types/history':
specifier: ^4.7.11
version: 4.7.11
@ -697,15 +694,18 @@ importers:
'@types/wordpress__media-utils':
specifier: ^4.14.4
version: 4.14.4(react-dom@18.3.1)(react@18.3.1)
'@wordpress/prettier-config':
specifier: ^4.11.0
version: 4.11.0(wp-prettier@3.0.3)
'@wordpress/scripts':
specifier: 27.9.0
version: 27.9.0(@types/node@18.6.1)(react-dom@18.3.1)(react@18.3.1)(typescript@5.0.2)
core-js:
specifier: ^3.37.1
version: 3.37.1
eslint-plugin-check-file:
specifier: ^2.8.0
version: 2.8.0
prettier:
specifier: npm:wp-prettier@^3.0.3
version: /wp-prettier@3.0.3
wp-types:
specifier: ^3.65.0
version: 3.65.0
@ -6842,6 +6842,15 @@ packages:
prettier: /wp-prettier@3.0.3
dev: true
/@wordpress/prettier-config@4.11.0(wp-prettier@3.0.3):
resolution: {integrity: sha512-Aoc8+xWOyiXekodjaEjS44z85XK877LzHZqsQuhC0kNgneDLrKkwI5qNgzwzAMbJ9jI58MPqVISCOX0bDLUPbw==}
engines: {node: '>=18.12.0', npm: '>=8.19.2'}
peerDependencies:
prettier: '>=3'
dependencies:
prettier: /wp-prettier@3.0.3
dev: true
/@wordpress/primitives@3.56.0:
resolution: {integrity: sha512-NXBq1ODjl6inMWx/l7KCbATcjdoeIOqYeL9i9alqdAfWeKx1EH9PIvKWylIkqZk7erXxCxldiRkuyjTtwjNBxw==}
engines: {node: '>=12'}