Skip to content

refactor: cleanup js - #396

Merged
justlevine merged 4 commits into
tests/js-backportsfrom
refactor/cleanup-js
Nov 23, 2026
Merged

justlevine merged 4 commits into
tests/js-backportsfrom
refactor/cleanup-js

Conversation

@justlevine

@justlevine justlevine commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What

Brings the settings screen code in line with OneDesign:

  • The assets tests check that a script registered a second time keeps its dependencies, and check the exact list of localized keys.
  • The @wordpress/dependency-group ESLint rule and its "External / WordPress / Internal dependencies" comment blocks are gone, so each file has one block of imports.
  • The settings components import their hooks from @wordpress/element instead of react.
  • The admin screens call the REST routes by their literal /onesearch/v1/... paths, and restNamespace is gone from the localized OneSearchSettings.

Why

Related Issue(s):

How

  • New test_registering_a_script_again_keeps_its_dependencies(), and test_get_localized_data_returns_expected_keys() compares array_keys() with assertEqualsCanonicalizing().
  • The two ../js/utils imports switch to @/js/utils.
  • The six apiFetch calls use /onesearch/v1/... directly.

AI Disclosure

Backported initial draft and reviewed with Opus 5.5

Testing Instructions

Screenshots

Additional Info

Checklist

  • I have read the Contribution Guidelines.
  • I have read the Development Guidelines.
  • I have added necessary tests to cover my changes.
  • I have updated the project documentation as needed.
  • My code has detailed inline documentation.
  • My code is tested to the best of my abilities.
  • My code passes all lints, tests, and checks.
Open WordPress Playground Preview

@justlevine
justlevine added this pull request to stack #392 November 20, 2026 12:50
@justlevine
justlevine requested a review from Kallyan01 November 20, 2026 12:52
@codecov-commenter

codecov-commenter commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.77%. Comparing base (5b1147c) to head (cf0d6b1).

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                    @@
##             tests/js-backports     #396      +/-   ##
========================================================
+ Coverage                 86.21%   90.77%   +4.56%     
- Complexity                    0      887     +887     
========================================================
  Files                        14       51      +37     
  Lines                       631     3338    +2707     
  Branches                    190      190              
========================================================
+ Hits                        544     3030    +2486     
- Misses                       33      254     +221     
  Partials                     54       54              
Flag Coverage Δ
unit 91.83% <ø> (?)
vitest 86.19% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
assets/src/admin/settings/page.tsx 80.30% <100.00%> (ø)
assets/src/components/AlgoliaSettings.tsx 90.90% <100.00%> (ø)
assets/src/components/IndexSummary.tsx 100.00% <ø> (ø)
assets/src/components/JobStatus.tsx 100.00% <ø> (ø)
assets/src/components/MultiSelectChips.tsx 74.13% <ø> (ø)
assets/src/components/SiteIndexableEntities.tsx 83.13% <ø> (ø)
assets/src/components/SiteModal.tsx 80.64% <ø> (ø)
assets/src/components/SiteSearchSettings.tsx 84.56% <ø> (ø)
assets/src/components/SiteSettings.tsx 93.87% <ø> (ø)
assets/src/components/SiteTable.tsx 100.00% <ø> (ø)
... and 5 more

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@justlevine justlevine changed the title Refactor/cleanup js refactor: cleanup js Nov 20, 2026
@justlevine
justlevine merged commit 8363195 into main Nov 23, 2026
17 of 18 checks passed
@justlevine
justlevine deleted the refactor/cleanup-js branch November 23, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants