Linting: Add pnpm commands and update contributing guidelines (#38727)

Adds pnpm commands for utilizing the new phpcs-changed Composer scripts, and updates documentation to make these commands more discoverable.
This commit is contained in:
Corey McKrill 2023-06-20 12:33:41 -07:00 committed by GitHub
commit 79b52d2a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 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

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Add pnpm commands for easier PHP linting

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",