DataViews: remove kebabCase private import by inlining it - #81284
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
🟢 Ready to approve
The copied implementation and tests match the existing utility, and the dependency and call-site updates are complete.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Removes DataViews’ private kebabCase dependency while preserving modal class-name behavior.
Changes:
- Adds a local
kebabCaseimplementation and parity tests. - Updates modal actions to use the local utility.
- Declares
change-caseand documents the internal change.
File summaries
| File | Description |
|---|---|
packages/dataviews/src/utils/kebab-case.ts |
Adds the local utility. |
packages/dataviews/src/utils/test/kebab-case.js |
Adds parity coverage. |
packages/dataviews/src/components/dataviews-item-actions/index.tsx |
Replaces the private import. |
packages/dataviews/package.json |
Declares change-case. |
packages/dataviews/CHANGELOG.md |
Records the internal change. |
package-lock.json |
Updates workspace dependency metadata. |
Review details
- Files reviewed: 5/6 changed files
- Comments generated: 0
- Review effort level: Balanced
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Removes one of the @wordpress/components private API usages listed in #81230. The utility is copied verbatim, including its change-case dependency and the full test suite (Lodash and _wp_to_kebab_case compatibility), so the generated action modal overlay class names are byte-for-byte identical to before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0b21891 to
812e71c
Compare
|
Size Change: +1.21 kB (+0.02%) Total Size: 7.82 MB 📦 View Changed
|
im3dabasia
left a comment
There was a problem hiding this comment.
Thanks for working on this!
Looks like a straightforward merge! LGTM ✅
One CI test was failing, I have re-run it 🤞
|
Potential, more ambitious, follow-up at #81294 |
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Extracts the WP-parity kebabCase utility (backwards compatible with Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new dependency-only package (no wpScript), and migrates the two identical copies: - @wordpress/components: utils/strings.ts now re-exports kebabCase from the new package, so the existing private API surface and all unlock() consumers are unchanged. The kebabCase test suite moves to the new package. - @wordpress/dataviews: removes the copy inlined in #81284 and imports the package directly. Follow-up to #81284 and part of the direction discussed in #81230; the utility originally became a components private API in #56758. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extracts the WP-parity kebabCase utility (backwards compatible with Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new dependency-only package (no wpScript), and migrates the two identical copies: - @wordpress/components: utils/strings.ts now re-exports kebabCase from the new package, so the existing private API surface and all unlock() consumers are unchanged. The kebabCase test suite moves to the new package. - @wordpress/dataviews: removes the copy inlined in #81284 and imports the package directly. Follow-up to #81284 and part of the direction discussed in #81230; the utility originally became a components private API in #56758. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extracts the WP-parity kebabCase utility (backwards compatible with Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new dependency-only package (no wpScript), and migrates the two identical copies: - @wordpress/components: utils/strings.ts now re-exports kebabCase from the new package, so the existing private API surface and all unlock() consumers are unchanged. The kebabCase test suite moves to the new package. - @wordpress/dataviews: removes the copy inlined in #81284 and imports the package directly. Follow-up to #81284 and part of the direction discussed in #81230; the utility originally became a components private API in #56758. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Part of #81230.
What?
Removes one of the
@wordpress/componentsprivate API usages in@wordpress/dataviews: thekebabCaseutility by making a local copy within the dataviews package.Why?
See #81230.
How?
packages/dataviews/src/utils/kebab-case.ts, a verbatim copy of the private kebabCase frompackages/components/src/utils/strings.ts. Same implementation. Because the copy is identical, the generated action modal overlay class names will remain unchanged for any input.Alternatives considered:
@wordpress/components, since the utility was made private deliberately to avoid committing to a public utils surface. If a shared home for it ever materializes (e.g. a small dedicated package, which would also serve the other packages currently unlocking it from components), this local copy can be swapped out trivially.Testing Instruction
npm run test:unit packages/dataviews/src/utils/test/kebab-case.js.dataviews-action-modal dataviews-action-modal__duplicate-patternclasses and the modal is styled as before (no visual change).Use of AI Tools
This PR was written with Claude Code (implementation, tests, and this description), under human direction and review.