-
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
Update WordPress typing packages #2841
Conversation
📝 WalkthroughWalkthroughThe pull request includes updates to the Changes
Possibly related PRs
Suggested reviewers
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: 1
🧹 Outside diff range and nitpick comments (3)
src/@types/gutenberg/types.ts (3)
6-7
: Ensure the comment ends with a period.The comment on line 6 does not end with a period as per WordPress coding standards, which recommend that all inline comments conclude with a period.
Apply this diff to correct the issue:
/** - * Defines typings for core/block-editor functions, to avoid intellisense errors + * Defines typings for core/block-editor functions, to avoid intellisense errors. * in function calls. * * This can be removed once Gutenberg provides typings for these functions. * * @since 3.12.0 */
37-38
: Format the@since
tag according to WordPress coding standards.The
@since
tag on line 37 includes a description, but according to WordPress coding standards, the@since
tag should only include the version number. Additional details should be moved to the main description.Apply this diff to correct the issue:
* This can be removed once Gutenberg provides typings for these functions. * - * @since 3.17.0 Moved from the GutenbergFunction interface. + * Moved from the GutenbergFunction interface. + * + * @since 3.17.0 */
68-68
: Add type annotation for clarity and type safety.The constant
dispatchCoreEditPost
is defined without an explicit type annotation. To enhance code readability and maintain type safety, consider specifying the type.Apply this diff to add the type annotation:
- export const dispatchCoreEditPost = dispatch( 'core/edit-post' ); + export const dispatchCoreEditPost: GutenbergEditPostFunction = dispatch( 'core/edit-post' );Replace
GutenbergEditPostFunction
with the appropriate type that matches the return value ofdispatch( 'core/edit-post' )
. If such a type doesn't exist, consider defining a new interface for it.
📜 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 (1 hunks)
- src/@types/gutenberg/types.ts (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/@types/gutenberg/types.ts (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 (1)
package.json (1)
53-54
: LGTM! Verify TypeScript compatibility after the update.The updates to
@types/wordpress__edit-post
(7.5.7 → 8.4.0) and@types/wordpress__editor
(13.6.8 → 14.3.0) align with the PR objectives. These major version updates may introduce changes in type definitions.To ensure compatibility:
- Verify that the TypeScript code compiles without errors after these updates.
- Run the project's test suite to catch any potential issues.
- Review the changelogs of these packages for any breaking changes that might affect your codebase.
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.
LGTM, thanks for doing this work!
Description
This PR updates the
@types/wordpress__edit-post
and@types/wordpress__editor
packages to their latest versions, while also fixing a couple of issues that were resulting from the upgrade.Motivation and context
Our dependency update process had become cumbersome, because dependabot was attempting to update
@wordpress/edit-post
and@wordpress/editor
along with these type packages, which resulted in errors. As such, we had to manually do the work. Hopefully with this PR, this should be resolved.How has this been tested?
Automated testing keeps passing.
Summary by CodeRabbit
New Features
Bug Fixes