dev: update dev packages & format file#534
Conversation
There was a problem hiding this comment.
Pull request overview
Updates PPOM’s development tooling and applies broad formatting/docblock cleanup across JS/PHP, plus CI/workflow adjustments.
Changes:
- Bumps/adjusts dev tooling (Composer scripts/deps, PHPCS baseline support) and updates CI to use npm + newer Node versions.
- Reformats and documents multiple frontend/admin JS modules and many PHP files (docblocks, arrays, small refactors).
- Adds/revises repo tooling/config files (ESLint/Prettier ignores, wp-env config, distignore entries, Copilot workflow).
Reviewed changes
Copilot reviewed 88 out of 164 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| js/validate.js | Formatting and minor refactors in required-field validation logic |
| js/ppom-validation.js | AJAX add-to-cart validation formatting + small control flow update |
| js/ppom-tooltip.js | Tooltip script formatting + documentation header |
| js/ppom-simple-popup.js | Popup/tooltip bridge formatting + tooltip init guard |
| js/ppom-plusminus.js | Plus/minus widget formatting and minor refactors |
| js/ppom-conditions.js | Legacy conditions engine formatted + documented |
| js/popup.js | Admin popup documentation + typing annotations/cleanup |
| js/image-tooltip.js | Image tooltip formatting + documentation header |
| js/admin/serializejson.js | Reformat vendored serializeJSON plugin for readability |
| js/admin/pre-load.js | Preloader formatting + doc header |
| js/admin/ppom-meta-table.js | Admin meta table refactor + popup-based confirmations |
| js/admin/ppom-deactivate.js | Deactivation modal formatting + doc header |
| js/admin/ppom-bulkquantity.js | Bulk quantity admin editor refactor + doc/typedef additions |
| inc/woocommerce.php | Adds docblocks/sections and normalizes array syntax/formatting |
| inc/validation.php | Adds docblocks and refactors sanitization helper signature/logic |
| inc/rest.class.php | Adds docblocks/visibility updates and improves order meta formatting safety |
| inc/prices.php | Adds docblocks/sections and normalizes formatting/increments |
| inc/nmInput.class.php | Formatting tweaks; minor control-flow simplification |
| inc/hooks.php | Adds docblocks/sections and normalizes formatting/increments |
| inc/functions.php | Docblocks + small control-flow simplification |
| inc/files.php | Adds docblocks/sections and normalizes formatting/increments |
| inc/arrays.php | Formatting tweaks (alignment/trailing commas) |
| inc/admin.php | Adds docblocks; improves nonce handling/normalization and formatting |
| grunt/addtextdomain.js | Formatting cleanup |
| composer.json | Adds lint/format scripts, bumps phpstan config, updates platform PHP + dev deps |
| classes/survey.class.php | Formatting (comma/trailing comma) |
| classes/ppom.class.php | Adds docblocks/visibility; formatting and minor array normalizations |
| classes/plugin.class.php | Adds docblocks; formatting/increment tweaks |
| classes/legacy-meta.class.php | Braces/formatting cleanup |
| classes/integrations/elementor/shortcode-widget.php | Switches to long array syntax for compatibility/style |
| classes/integrations/elementor/elementor.class.php | Switches callbacks to long array syntax |
| classes/inputs/input.timezone.php | Minor formatting cleanup |
| classes/inputs/input.textarea.php | Minor formatting cleanup |
| classes/inputs/input.text.php | Minor formatting cleanup |
| classes/inputs/input.select.php | Minor formatting cleanup |
| classes/inputs/input.section.php | Minor formatting cleanup |
| classes/inputs/input.radio.php | Minor formatting cleanup |
| classes/inputs/input.quantities.php | Minor formatting cleanup |
| classes/inputs/input.pricematrix.php | Minor formatting cleanup |
| classes/inputs/input.palettes.php | Minor formatting cleanup |
| classes/inputs/input.number.php | Minor formatting cleanup |
| classes/inputs/input.image.php | Minor formatting cleanup |
| classes/inputs/input.hidden.php | Minor formatting cleanup |
| classes/inputs/input.file.php | Minor formatting cleanup |
| classes/inputs/input.email.php | Minor formatting cleanup |
| classes/inputs/input.divider.php | Minor formatting cleanup |
| classes/inputs/input.daterange.php | Minor formatting cleanup |
| classes/inputs/input.date.php | Minor formatting cleanup |
| classes/inputs/input.cropper.php | Minor formatting cleanup |
| classes/inputs/input.color.php | Minor formatting cleanup |
| classes/inputs/input.checkbox.php | Minor formatting cleanup |
| classes/inputs/input.audio.php | Minor formatting cleanup |
| classes/input.class.php | Adds docblocks and clarifies responsibilities |
| classes/input-meta.class.php | Switches short arrays to long arrays for consistency |
| classes/frontend-scripts.class.php | Adds docblocks/sections; formatting and increment tweaks |
| classes/freemium.class.php | Braces/arrays formatting improvements |
| classes/form.class.php | Docblocks + formatting and array syntax normalization |
| classes/fields.class.php | Docblocks + refactors around asset loading/localization and builder rendering |
| classes/attach-popup/select-component.class.php | Output formatting/escaping consistency improvements |
| classes/admin.class.php | Docblocks/visibility improvements and formatting across attach/settings flows |
| backend/templates/admin-settings.php | Uses printf with clearer formatting for upsell notices |
| backend/settings-panel.class.php | Docblocks + long array defaults and minor refactors |
| backend/options.php | Docblocks + long array syntax in option definitions |
| backend/changelog_handler.php | Normalizes return values/arrays and formatting |
| Gruntfile.js | Formatting cleanup and minor structure normalization |
| AGENTS.md | Updates docs for new tooling, security guidance, and PHP min info |
| .wp-env.json | Adds schema + autoPort; changes WooCommerce plugin download |
| .prettierignore | Adds ignore patterns for generated/vendor assets |
| .github/workflows/test-php.yml | Switches to npm + newer node; adds PHPCS job; adjusts action versions |
| .github/workflows/sync-wporg-assets.yml | Quote/style normalization |
| .github/workflows/sync-branches.yml | Quote/style normalization |
| .github/workflows/e2e.yml | Switches to npm + newer node; adjusts action versions |
| .github/workflows/deploy-svn.yml | Switches build steps from yarn to npm |
| .github/workflows/deploy-s3-store.yml | Switches build steps from yarn to npm; bumps node |
| .github/workflows/create-tag.yml | Switches build steps from yarn to npm; bumps node |
| .github/workflows/create-build-zip.yml | Switches build steps from yarn to npm; bumps node |
| .github/workflows/copilot.yml | Adds agent setup workflow steps for Copilot runs |
| .eslintrc.json | Adds WordPress ESLint preset config and ignores |
| .distignore | Adds new dev config files to distignore |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: PHPCS | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Setup PHP version | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: "7.4" | ||
| extensions: simplexml | ||
| - name: Checkout source code | ||
| uses: actions/checkout@master | ||
| - name: Install composer | ||
| run: | | ||
| composer install --no-progress | ||
| - name: Run linter for PHP | ||
| run: composer run lint |
| '<input checked="checked" name="ppom[fields][' + | ||
| field_name + | ||
| '][' + | ||
| image_id + | ||
| '][cropped]" type="checkbox"/>' |
| case 'is': | ||
| if ( element_type === 'checkbox' ) { | ||
| var element_value = ppom_get_element_value( rule.elements ); | ||
| jQuery( element_value ).each( function ( i, item ) { |
| } ); | ||
| } else if ( element_type === 'image' ) { | ||
| var element_value = ppom_get_element_value( rule.elements ); | ||
| jQuery( element_value ).each( function ( i, item ) { |
| case 'not': | ||
| if ( element_type === 'checkbox' ) { | ||
| var element_value = ppom_get_element_value( rule.elements ); | ||
| jQuery( element_value ).each( function ( i, item ) { |
| case 'greater than': | ||
| if ( element_type === 'checkbox' ) { | ||
| var element_value = ppom_get_element_value( rule.elements ); | ||
| jQuery( element_value ).each( function ( i, item ) { |
| case 'less than': | ||
| if ( element_type === 'checkbox' ) { | ||
| var element_value = ppom_get_element_value( rule.elements ); | ||
| jQuery( element_value ).each( function ( i, item ) { |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 88 out of 166 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ); | ||
| this.text.classList.toggle( | ||
| 'ppom-hide', | ||
| Boolean( options?.text?.length ) |
There was a problem hiding this comment.
this.text.classList.toggle('ppom-hide', Boolean(options?.text?.length)) will hide the text element when text is provided (since the second arg is true). This looks inverted for a ppom-hide class; it should typically hide when there is no text. Flip the condition so the text is hidden only when options.text is empty/absent.
| Boolean( options?.text?.length ) | |
| ! options?.text?.length |
| // modal behavior, while others use it to initialize tooltip-enabled inputs. | ||
| if ( $( '[data-ppom-tooltip~=ppom_tooltip]' ).length > 0 ) { | ||
| $( '[data-ppom-tooltip~=ppom_tooltip]' ).ppom_tooltipster?.( | ||
| tooltip_options | ||
| ); | ||
| } |
There was a problem hiding this comment.
This introduces optional chaining (?.) in a frontend asset. If these scripts are shipped without transpilation, optional chaining can cause a hard syntax error in older browsers and prevent the entire file from executing. Prefer a feature check (e.g., verify the plugin function exists) without optional chaining to keep runtime compatibility consistent with the rest of the bundle.
| - uses: actions/checkout@master | ||
| - uses: actions/setup-node@v6 |
There was a problem hiding this comment.
Using actions/checkout@master (and similarly other @master action references in this PR) is a supply-chain risk and can introduce unexpected breaking changes. Pin actions to a stable major tag (e.g., actions/checkout@v4) or a specific commit SHA to make CI reproducible and safer.
| } No newline at end of file | ||
| "$schema": "https://schemas.wp.org/trunk/wp-env.json", | ||
| "plugins": [ | ||
| "https://downloads.wordpress.org/plugin/woocommerce.zip", |
There was a problem hiding this comment.
Switching from a pinned WooCommerce version ZIP to the floating woocommerce.zip makes local/E2E environments non-reproducible (the installed WooCommerce version can change over time and break tests/builds). Consider pinning a specific WooCommerce version (as before) or explicitly documenting that wp-env uses a moving target.
| "https://downloads.wordpress.org/plugin/woocommerce.zip", | |
| "https://downloads.wordpress.org/plugin/woocommerce.8.6.1.zip", |
0fbaaa7 to
1ff6f27
Compare
Summary
Will affect visual aspect of the product
NO
Screenshots
Test instructions
Check before Pull Request is ready:
Closes #.