-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove deprecated @types/wordpress__editor package #2999
Remove deprecated @types/wordpress__editor package #2999
Conversation
📝 WalkthroughWalkthroughThe pull request includes updates to the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
src/content-helper/editor-sidebar/excerpt-suggestions/component-panel.tsx (2)
Line range hint
164-169
: Document console.error usageThe error handling is well-structured, but the console.error usage should be documented to explain why we're logging unknown errors.
- console.error( err ); // eslint-disable-line no-console + // Log unknown errors to help with debugging in production + console.error( err ); // eslint-disable-line no-console
Line range hint
252-267
: Improve keyboard shortcuts handling and documentationThe current implementation uses a flag to prevent duplicate updates, but this could be simplified. Also, the comment about keyboard shortcuts could be more descriptive.
- onKeyUp={ () => { // Make word count work with Keyboard shortcuts. + onKeyUp={ () => { + // Handle keyboard shortcuts (e.g., Cmd+X, Cmd+V) that might not trigger onChange // This ensures the word count is updated correctly for all user interactions if ( onChangeFired ) { setOnChangeFired( false ); return; } const textarea = document.querySelector( '.editor-post-excerpt textarea' ); - const value = textarea?.textContent ?? ''; + const value = textarea?.value ?? ''; setExcerptData( { ...excerptData, currentExcerpt: value } ); } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.json
(0 hunks)src/content-helper/editor-sidebar/excerpt-suggestions/component-panel.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- package.json
🧰 Additional context used
📓 Path-based instructions (1)
src/content-helper/editor-sidebar/excerpt-suggestions/component-panel.tsx (1)
Pattern **/*.{js,ts,tsx,jsx}
: "Perform a detailed review of the provided code with following key aspects in mind:
- Review the code to ensure it is well-structured and adheres to best practices.
- Verify compliance with WordPress coding standards.
- Ensure the code is well-documented.
- Check for security vulnerabilities and confirm the code is secure.
- Optimize the code for performance, removing any unnecessary elements.
- Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
- Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features."
🔇 Additional comments (2)
src/content-helper/editor-sidebar/excerpt-suggestions/component-panel.tsx (2)
99-99
: LGTM: Clean type handling improvement
The removal of the explicit type assertion as GutenbergFunction
aligns with the PR objective and results in cleaner code while maintaining the same functionality.
Line range hint 1-399
: Verify WordPress compatibility and standards
The changes align well with the PR objectives and WordPress coding standards. Let's verify the removal of all @types/wordpress__editor dependencies.
✅ Verification successful
Let me verify the specific usage of GutenbergFunction to understand if it's still dependent on @types/wordpress__editor.
Let me check the local type definition to see if it's still dependent on @types/wordpress__editor.
The code changes are correctly implemented and the dependency is properly removed
The code has successfully moved away from @types/wordpress__editor by implementing its own type definitions in src/@types/gutenberg/types.ts
. The GutenbergFunction and GutenbergCoreEditorFunction interfaces are now locally defined and only depend on official WordPress packages (@wordpress/blocks and @wordpress/data). The implementation is clean and follows WordPress coding standards.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify complete removal of @types/wordpress__editor dependencies
# Check for any remaining references to @types/wordpress__editor
rg -l "@types/wordpress__editor"
# Check for any remaining GutenbergFunction type assertions
rg -l "as GutenbergFunction"
Length of output: 641
Script:
#!/bin/bash
# Check the actual usage of GutenbergFunction in the files
rg -A 2 "GutenbergFunction"
# Check if there's a local type definition for GutenbergFunction
ast-grep --pattern 'type GutenbergFunction'
Length of output: 8051
Script:
#!/bin/bash
# Check the content of the local types file
cat src/@types/gutenberg/types.ts
Length of output: 2310
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
…wordpress-editor-package" (1a15fab)
Description
The
@types/wordpress__editor
package is now deprecated and we're removing it in this PR. With this done, we also don't needas GutenbergFunction
when usingselect( editorStore )
.This PR also cleans-up after the latest component updates, by running
npm dedupe
a couple of times.Motivation and context
Remove unneeded code.
How has this been tested?
Builds succeed and automated testing keeps passing.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor