Linting: Add pnpm commands and update contributing guidelines

Adds the following pnpm commands for utilizing the new phpcs-changed
composer scripts (see #37465 and #38085):

- `pnpm --filter=woocommerce run lint:php:changes`
- `pnpm --filter=woocommerce run lint:php:changes:staged`
- `pnpm --filter=woocommerce run lint:php:changes:branch`

Also updates the contributing guidelines to make these commands more
discoverable.
This commit is contained in:
Corey McKrill 2023-06-14 14:52:09 -07:00
parent 9404a7dff3
commit 446c8c1b0b
No known key found for this signature in database
GPG Key ID: 84BBFE669C4D97B8
2 changed files with 5 additions and 1 deletions

View File

@ -35,7 +35,8 @@ Please take a moment to review the [project readme](https://github.com/woocommer
- Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/).
- Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more.
- Whenever possible please fix pre-existing code standards errors in the files that you change. It is ok to skip that for larger files or complex fixes.
- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=woocommerce run lint:php:changes:branch`.
- Whenever possible, please fix pre-existing code standards errors in code that you change.
- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured.
- When committing, reference your issue number (#1234) and include a note about the fix.
- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file.

View File

@ -26,6 +26,9 @@
"lint:fix": "pnpm lint:js:fix && pnpm lint:php:fix",
"lint:php": "composer run-script phpcs",
"lint:php:fix": "composer run-script phpcbf",
"lint:php:changes": "composer run-script lint",
"lint:php:changes:staged": "composer run-script lint-staged",
"lint:php:changes:branch": "composer run-script lint-branch",
"docker:down": "pnpm exec wc-e2e docker:down",
"docker:ssh": "pnpm exec wc-e2e docker:ssh",
"docker:up": "pnpm exec wc-e2e docker:up",