fix: Remediate PHPCS lints#147
Conversation
There was a problem hiding this comment.
Pull request overview
Remediates PHPCS lint issues across the repo and modernizes tooling/configuration for PHP, JS/TS, testing, CI, and releases.
Changes:
- Refactors PHPCS/PHPStan/PHPUnit configs and adds new test harness/files (Jest, Playwright, PHPUnit base TestCase).
- Updates build/tooling configs (webpack, tsconfig, eslint/stylelint/prettier) and repo automation (CI workflows, release-please, dependabot).
- Applies formatting/standards fixes across PHP and JS/TS sources and documentation.
Reviewed changes
Copilot reviewed 81 out of 90 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.js | Aligns webpack config with updated wp-scripts defaults and plugin behavior. |
| uninstall.php | Refactors uninstall flow and consolidates option/transient deletion. |
| tsconfig.json | Simplifies TS project config and points to a shared base. |
| tsconfig.base.json | Introduces a shared TS ruleset for reuse across projects/tests. |
| tests/php/TestCase.php | Adds a PHPUnit base class to improve PHPUnit 11.5 compatibility. |
| tests/js/tsconfig.json | Adds a dedicated TS config for JS unit tests. |
| tests/js/setup.ts | Adds Jest setup (jest-dom + mock clearing). |
| tests/e2e/settings/activation.spec.ts | Adds a basic Playwright activation/deactivation E2E test. |
| tests/bootstrap.php | Updates PHPUnit bootstrap logic/paths and strict types. |
| release-please-config.json | Adds Release Please configuration for automated releases. |
| playwright.config.ts | Adds Playwright config and sets artifacts/storage state paths. |
| phpunit.xml.dist | Upgrades PHPUnit schema/config and changes bootstrap/source/coverage settings. |
| phpstan.neon.dist | Reformats and updates PHPStan rules and version constraints. |
| phpcs.xml.dist | Removes legacy PHPCS ruleset config file. |
| package.json | Updates scripts/deps for linting, formatting, tests (Jest/E2E), and wp-env usage. |
| onesearch.php | Updates plugin header metadata and strict types/constant definitions. |
| languages/onesearch-features.pot | Removes an unused/outdated POT file. |
| jest.config.js | Adds a custom Jest configuration extending wp-scripts defaults. |
| inc/Utils.php | Removes stray whitespace-only line for PHPCS compliance. |
| inc/Modules/Settings/Settings.php | Adds hook-callback annotations and PHPCS suppressions where needed. |
| inc/Modules/Search/Watcher.php | Adds hook-callback annotations and PHPCS suppressions where needed. |
| inc/Modules/Search/Settings.php | Adds hook-callback annotations and PHPCS suppressions where needed. |
| inc/Modules/Search/Search.php | Adjusts filter signatures/accepted args and minor cleanups. |
| inc/Modules/Search/Post_Record.php | Updates PHPCS ignore code for hook-name sniff. |
| inc/Modules/Search/Algolia.php | Removes stray whitespace-only line for PHPCS compliance. |
| inc/Modules/Rest/Search_Controller.php | Adds strict types and docblock cleanups. |
| inc/Modules/Rest/Governing_Data_Handler.php | Adds strict types and docblock cleanups. |
| inc/Modules/Rest/Governing_Data_Controller.php | Adds strict types and removes stray whitespace-only line. |
| inc/Modules/Rest/Basic_Options_Controller.php | Adds strict types and docblock cleanups. |
| inc/Modules/Core/Rest.php | Removes stray whitespace-only line for PHPCS compliance. |
| inc/Modules/Core/Assets.php | Changes enqueue signature (likely to satisfy lints) and cleans docblock. |
| inc/Contracts/Interfaces/Registrable.php | Removes stray whitespace-only line for PHPCS compliance. |
| docs/SECURITY.md | Normalizes punctuation/indentation and list formatting. |
| docs/DEVELOPMENT.md | Major docs refresh for tooling, workflows, tests, and release process. |
| docs/CONTRIBUTING.md | Updates PR target branch and wording consistency. |
| docs/CODE_OF_CONDUCT.md | Normalizes markdown list formatting/indentation. |
| composer.json | Updates dev tooling deps (coding standards, phpstan/phpunit tooling) and metadata. |
| blueprint.json | Adds WP Playground blueprint for demos/previews. |
| babel.config.js | Formatting update for lint/format consistency. |
| assets/src/js/utils.ts | Normalizes TS spacing and wraps long expressions for lint compliance. |
| assets/src/components/SiteTable.tsx | Formatting + prop typing cleanups to satisfy linting/formatting rules. |
| assets/src/components/SiteSettings.tsx | Formatting + minor JSX prop/style normalization. |
| assets/src/components/SiteSearchSettings.js | Formatting and promise chain cleanup for lint compliance. |
| assets/src/components/SiteModal.tsx | Formatting/typing cleanups and error message string normalization. |
| assets/src/components/SiteIndexableEntities.js | Formatting and long-line wrapping for lint compliance. |
| assets/src/components/MultiSelectChips.js | Formatting/JSX wrapping for lint compliance. |
| assets/src/components/AlgoliaSettings.tsx | Formatting/typing cleanups for lint compliance. |
| assets/src/admin/settings/page.tsx | Formatting, typing, and promise chain cleanup for lint compliance. |
| assets/src/admin/settings/index.tsx | Corrects dependency section header comment. |
| assets/src/admin/search/index.js | Formatting and error message wrapping for lint compliance. |
| assets/src/admin/onboarding/page.tsx | Reorders deps sections and formats generics/props. |
| assets/src/admin/onboarding/index.tsx | Corrects dependency section header comment. |
| LICENSE.md | Renames/adds license file as markdown. |
| LICENSE | Removes legacy plain-text license file. |
| .wp-env.json | Normalizes plugin list and adds debug logging config. |
| .stylelintrc.json | Removes old stylelint JSON config. |
| .stylelint.config.js | Adds JS-based stylelint config. |
| .release-please-manifest.json | Adds Release Please manifest. |
| .prettierrc.js | Adds Prettier config extending @wordpress/prettier-config. |
| .prettierignore | Adds Prettier ignore patterns. |
| .phpcs.xml.dist | Adds new dotfile PHPCS ruleset (rtCamp + project settings). |
| .lintstagedrc.mjs | Adds lint-staged config to run linters/formatters pre-commit. |
| .lefthook.yml | Adds lefthook config stub (currently commented out). |
| .gitignore | Expands ignore patterns for tooling, build output, tests, and configs. |
| .github/workflows/test.yml | Removes legacy monolithic GitHub Actions workflow. |
| .github/workflows/reusable-wp-playground-pr-preview.yml | Adds reusable workflow for WP Playground PR previews. |
| .github/workflows/reusable-phpunit.yml | Adds reusable PHPUnit workflow. |
| .github/workflows/reusable-phpstan.yml | Adds reusable PHPStan workflow. |
| .github/workflows/reusable-phpcs.yml | Adds reusable PHPCS workflow. |
| .github/workflows/reusable-lint-css-js.yml | Adds reusable JS/CSS lint workflow. |
| .github/workflows/reusable-jest.yml | Adds reusable Jest workflow. |
| .github/workflows/reusable-e2e.yml | Adds reusable Playwright E2E workflow. |
| .github/workflows/reusable-build.yml | Adds reusable build workflow for zip artifacts. |
| .github/workflows/release.yml | Reworks releases to use Release Please + build/upload steps. |
| .github/workflows/pr-title.yml | Adds semantic PR title validation workflow. |
| .github/workflows/copilot-setup-steps.yml | Updates Copilot setup workflow with clearer steps/pinning. |
| .github/workflows/ci.yml | Adds new modular CI workflow using reusable pipelines + change detection. |
| .github/workflows/README.md | Documents the modular workflows and local testing guidance. |
| .github/dependabot.yml | Reworks dependabot config with grouping/limits/strategies. |
| .github/.codecov.yml | Adds Codecov configuration and path fixes. |
| .gitattributes | Adds export-ignore rules for composer installs and marks docs. |
| .eslintrc.json | Removes JSON ESLint config (migrated to JS). |
| .eslintrc.js | Adds new JS ESLint config with TS/Jest/Playwright overrides. |
| .eslintignore | Normalizes eslint ignore paths. |
| .editorconfig | Simplifies editorconfig sections and aligns markdown/text handling. |
| .distignore | Adds composer distribution ignore list. |
Comments suppressed due to low confidence (5)
webpack.config.js:1
- This assumes
@wordpress/scripts/config/webpack.configexports an array. In many wp-scripts versions it exports a single config object, which would make this destructuring throw at runtime (not iterable). Consider requiring it as an object, or supporting both shapes (e.g.,const wpConfig = require(...); const defaultScriptConfig = Array.isArray(wpConfig) ? wpConfig[0] : wpConfig;).
webpack.config.js:1 - This assumes
@wordpress/scripts/config/webpack.configexports an array. In many wp-scripts versions it exports a single config object, which would make this destructuring throw at runtime (not iterable). Consider requiring it as an object, or supporting both shapes (e.g.,const wpConfig = require(...); const defaultScriptConfig = Array.isArray(wpConfig) ? wpConfig[0] : wpConfig;).
phpstan.neon.dist:1 - The
ignoreErrorskey is declared but has no value. This can break PHPStan config parsing (or at least results in an invalid/non-array setting). Either removeignoreErrors:entirely or set it to an explicit empty list (e.g.,ignoreErrors: []).
inc/Modules/Core/Assets.php:1 - In WordPress,
admin_enqueue_scriptspasses$hook_suffixby default, andadd_action()defaultsaccepted_argsto 1. If this method is registered without explicitly settingaccepted_argsto 0, WP will pass 1 argument and PHP 8+ will throw anArgumentCountErrorbecause the method now takes zero parameters. Either restore the$hook_suffixparameter or ensure the hook registration usesadd_action( ..., ..., 10, 0 ).
inc/Modules/Rest/Search_Controller.php:1 - The
declare(strict_types = 1);formatting is inconsistent with the rest of the codebase in this PR (e.g.,declare( strict_types = 1 );in other files). If PHPCS rules enforce spacing/formatting, this may reintroduce lint errors. Consider normalizing to the project’s chosendeclare( strict_types = 1 );style throughout.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| on: | ||
| pull_request_target: |
There was a problem hiding this comment.
This workflow is triggered via pull_request_target, but the job condition checks for github.event_name == 'pull_request', so the job will never run. Update the condition to match pull_request_target (or remove the event_name check and only gate on draft == false).
5938a56 to
5c762fe
Compare
5c762fe to
98965fd
Compare
Description
Fixes all the PHPCS issues in this repo
Important
This PR is based on #146 , which should be merged first
Technical Details
OpenCode Prompt:
Reviewed manually.
Checklist
Screenshots
To-do
Fixes/Covers issue
Fixes #