fix(lint): add PHP linting to main lint command#2711
Open
faisalahammad wants to merge 1 commit into
Open
Conversation
Adds `npm run lint:php` to the `lint` script chain so PHP linting runs alongside SCSS and JS. PHPCS was already configured with WordPress-Extra, WordPress-Docs, WordPressVIPMinimum, and PHPCompatibilityWP but had to be invoked separately. Fixes Automattic#1882
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds PHP linting to the main
npm run lintcommand. The project already has PHPCS configured withWordPress-Extra,WordPress-Docs,WordPressVIPMinimum, andPHPCompatibilityWP(PHP 7.2+), but thelintscript only ran SCSS and JS — PHP had to be invoked separately vianpm run lint:php.Fixes #1882
Changes
package.json
Before:
After:
Why: Matches the existing
&&chain pattern. No new dependencies. PHP linting is now discoverable through the main lint command, consistent with how JS and SCSS linting already work.Testing
Test 1: PHP linting passes clean
npm run lint:php→ exit 0Test 2: SCSS + PHP chain works
npm run lint:scss && npm run lint:php→ exit 0Test 3: PHPCS catches violations
npm run fix:php→ auto-fixed 2/4 errorsTest 4: Full chain behavior
npm run lint→ runs SCSS, JS, then PHP sequentially via&&All tests pass. Single file, single line change.