Add/build tooling - #1
Closed
troychaplin wants to merge 11 commits into
Closed
Conversation
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.
What?
Adds a first pass at build tooling for the plugin: linting, static analysis, continuous integration, a pre-commit hook, and contributor documentation — plus the code fixes those tools surfaced.
Why?
The plugin had no automated quality checks. Coding standards, static analysis and CI were all missing, so nothing enforced consistency and nothing verified a branch before review. This establishes the basics so future work has a baseline to build on.
Standing the tooling up also surfaced a set of real defects in the existing code that no one had a way to catch. Those are fixed here rather than deferred, since several of them are one-line changes and leaving them would mean merging a red build.
How?
Tooling added
npm run lintandnpm run format.lint-stagedon staged files, followed by a project-wide PHPStan (it can't be scoped to staged files, as it needs whole-codebase context to resolve types)..nvmrcpinning Node,.editorconfigfor shared editor settings, andwp-envscripts (env:start,env:stop,env:clean).CONTRIBUTING.md, a pull request template, andCHANGELOG.md.Fixes surfaced by the tooling
$_POST['value']throughwp_unslash()without sanitizing. Every branch already validated against an allowlist or cast to int before storing, so nothing was exploitable — this closes the gap ahead of that point.uninstall.phpassigned to$plugin, which collides with a WordPress global.Registryit never read (the React app fetches over REST instead).Known follow-ups, deliberately not in this PR
Heading_OrderandBlock_Validation_Frameworklive underModules/Experiments/and are documented as Experiments, but both returnBucket::FEATURE/Track::PRACTICAL. All six modules currently report Feature/Practical, so the Experiment and Core-track badges never render in the settings UI. Left for a separate fix, since it changes behaviour rather than tooling.github.com/WordPress/accessibility-labto match the plugin header's Plugin URI. Those will 404 until the repository moves to the WordPress organisation.Testing Instructions
Check out the branch and install from the lock files:
Confirm all four linters pass:
Expect no output from ESLint or Stylelint,
12 / 12 (100%)from PHPCS, and[OK] No errorsfrom PHPStan.Confirm the build succeeds and produces all five bundles:
Confirm the pre-commit hook blocks a bad commit — introduce a deliberate lint error in any file under
src/, stage it, and attempt to commit. The commit should abort. Revert afterwards.Confirm CI is green on this PR. The JS job reaching the "Build" step is the meaningful signal, since it previously failed at "Install dependencies".
Smoke-test the plugin itself, since this PR reformats source files. No behavioural or visual change is intended:
upload.phpand the modal) — the view-options button opens its popover; density, items-per-page and filename toggles apply and persist across reloads.Changelog Entry
Full entries for this PR are in
CHANGELOG.mdunder[Unreleased], split across Added, Changed and Fixed.