Skip to content

Fix the PHPCS and theme validation errors - #42

Merged
MaggieCabrera merged 15 commits into
WordPress:trunkfrom
troychaplin:fix/phpcs-concerns
Sep 21, 2026
Merged

MaggieCabrera merged 15 commits into
WordPress:trunkfrom
troychaplin:fix/phpcs-concerns

Conversation

@troychaplin

@troychaplin troychaplin commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Note

Part 3 of 3 in the lint stack. Please merge in this order:

  1. Add linting for PHP, patterns, and theme.json #33 Add linting for PHP, patterns, and theme.json
  2. Add husky pre-commit to lint staged files #40 Add husky pre-commit to lint staged files
  3. Fix the PHPCS and theme validation errors #42 Fix the PHPCS and theme validation errors (this PR)

Until #33 and #40 merge, this PR also shows their commits. Changes in this PR only

Fixes everything the linters from #33 report. With this merged, both Lint jobs pass, npm run lint is clean, and the pre-commit hook from #40 stops blocking commits to these files.

What changed

PHPCS (all 30 patterns)

  • Spacing inside PHP tags, fixed with composer format. For example, esc_html_e('Page not found.', 'ipsum');?> is now esc_html_e( 'Page not found.', 'ipsum' ); ?>.
  • Each pattern's header comment now has @package Ipsum and @since Ipsum 1.0, followed by a blank line.
  • In footer.php, footer-wide.php and hero-epigraph.php, echo sprintf() is now printf(), and the PHP sits on its own lines.

Theme validator

  • queryId: removed from the Query Loop in 14 patterns. These IDs came from editor exports and were never used: no query turns on enhanced pagination, and each one either follows the main query or has no pagination. The editor assigns a fresh ID when the block loads.
  • Untranslatable text: the "Tags: " prefix in single.php and single-sidebar.php now goes through esc_attr_e(), like the other translated block attributes.
  • $schema: pinned to 7.1 in theme.json and the 13 style variations. These are the same lines Point the theme.json schema at trunk #27 changes, so whichever PR merges second won't conflict.
  • Null border values: removed color, style and width from the core/accordion-heading and core/details borders in theme.json. WordPress skips empty values when it builds CSS, so the dotted top border renders as before.

The JSON files keep trunk's tab indentation. Apart from $schema and the removed nulls, their data is unchanged.

Testing

With PHP, Composer, and Node 24.18+ (nvm use):

composer install
npm install
npm run lint

Both checks should pass, and so should the Lint jobs on this PR. Then compare the front end and the Site Editor with trunk, especially the footer, the hero epigraph pattern, single posts with tags, and the accordion and details blocks.

Follow-up to #10.

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: troychaplin <areziaal@git.wordpress.org>
Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added documentation Improvements or additions to documentation [Type] Tooling Issues or PRs related to tooling GitHub Actions Pull requests that update GitHub Actions code [Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet. [Area] Patterns Issues or PRs that touch the theme's block patterns. labels Sep 18, 2026
@carolinan

Copy link
Copy Markdown
Contributor

The json schema still needs to be reverted back to trunk.

@troychaplin

Copy link
Copy Markdown
Member Author

The json schema still needs to be reverted back to trunk.

The theme validator enforced an exact match against Requires at least, so it rejected trunk. I updated it to accept either, while still validating properties against the Requires at least schema.

@carolinan carolinan mentioned this pull request Sep 20, 2026
1 task done
MaggieCabrera and others added 2 commits September 21, 2026 16:46
The trunk merge dropped @wordpress/env from package.json and the lock file, which left the env:* scripts without a binary, and removed the allowScripts entry from WordPress#40.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts:
#	README.md
#	bin/validate-theme.mjs
#	package-lock.json
#	phpcs.xml.dist
@github-actions github-actions Bot removed documentation Improvements or additions to documentation [Type] Tooling Issues or PRs related to tooling GitHub Actions Pull requests that update GitHub Actions code labels Sep 21, 2026
@MaggieCabrera
MaggieCabrera merged commit edb9464 into WordPress:trunk Sep 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet. [Area] Patterns Issues or PRs that touch the theme's block patterns.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants