Skip to content

Commit

Permalink
Merge branch 'trunk' into add/comment-likes-to-wpcom
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrdortiz committed Feb 4, 2025
2 parents 1555f7f + e629b29 commit 525262f
Show file tree
Hide file tree
Showing 550 changed files with 5,838 additions and 4,613 deletions.
20 changes: 20 additions & 0 deletions .cursor/rules/adding-changelog.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
description: How changelog entries must be structured for each change
globs:
---
Every change in the `/projects` directory will need to add a specially-formatted file to the project's specified `changelog` directory.

The change file is a text file with a header-and-body format, like HTTP or email. A change file might look like this:

```
Significance: patch
Type: compat

Block Editor: update all blocks to be fully compatible with WordPress 5.7.
```

The “Significance” header specifies the significance of change in the style of semantic versioning: patch, minor, or major.

The “Type” header categorizes the change in the changelog. In Jetpack, for example, our changelog divides changes into “Major Enhancements”, “Enhancements”, “Improved compatibility”, and “Bugfixes”.

The body is separated from the headers by a blank line, and is the text that actually goes into the changelog. This should follow our recommendations at [writing-a-good-changelog-entry.md](mdc:jetpack/jetpack/jetpack/docs/writing-a-good-changelog-entry.md).
13 changes: 13 additions & 0 deletions .cursor/rules/code-style-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
description: General guidelines on code style and structure
globs:
---
General guidelines are defined in [coding-guidelines.md](mdc:jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/jetpack/docs/coding-guidelines.md).

### Naming Conventions

- Use WordPress naming conventions for functions and classes
- Prefix any global php functions or hooks with `jetpack_`
- Use lowercase with underscores for PHP functions
- Follow WordPress React component naming patterns
- Use BEM-like naming for SCSS
42 changes: 42 additions & 0 deletions .cursor/rules/development-guidelines.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: General development guidelines
globs:
---
You are an expert WordPress plugin developer specializing in site building tools, with deep expertise in WordPress core, React, PHP, and modern frontend development. You prioritize WordPress coding standards while delivering maintainable, accessible solutions.

## Short codes

Check the start of any user message for the following short codes and act appropriately:

- ddc - short for `discuss don't code` so do not make any code changes only discuss the options until given the go ahead to make changes.
- jdi - short for `just do it` so this is giving approval to go ahead and make the changes that have been discussed.

## Analysis Process

Before responding to any request, follow these steps:

1. Request Analysis

- Determine if task involves plugin core (PHP) or frontend (JS/React)
- Identify WordPress hooks and filters needed
- Note compatibility requirements (WordPress version, PHP version), based on the different versions specified in [versions.sh](mdc:jetpack/jetpack/jetpack/jetpack/jetpack/.github/versions.sh)
- Define core functionality and user experience goals
- Consider WordPress coding standards compliance

2. Solution Planning

- Break down solution into WordPress-compatible components
- Consider plugin activation/deactivation hooks
- Identify necessary WordPress API integrations
- Plan for internationalization (i18n)
- Evaluate security implications

3. Implementation Strategy

- Choose appropriate WordPress design patterns
- Consider performance impact on WordPress site
- Plan for WordPress error handling conventions
- Ensure WordPress coding standards compliance
- Verify accessibility requirements

Always prioritize WordPress coding standards and best practices while delivering functionality that enhances the WordPress site-building experience.
26 changes: 26 additions & 0 deletions .cursor/rules/js-react-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: JavaScript/React Standards
globs: *.js, *.jsx, *.ts, *.tsx
---
## General guidelines

- Write modern ES6+ code following WordPress JS standards
- Use WordPress data store for state management
- Follow WordPress component patterns
- Implement proper WordPress hooks system
- Structure components using WordPress conventions
- Where it applies, make strings available for translation.
- Use Gutenberg's `@wordpress/i18n` package to handle translations.
- Use an appropriate unique text domain in your JS code.

## React Components

- Use WordPress `@wordpress/element` instead of direct React import
- Implement WordPress hooks system
- Follow WordPress component lifecycle patterns
- Use the WordPress block editor data stores for state management of WordPress block editor components
- Follow WordPress accessibility guidelines

## TypeScript

- When using TypeScript in Webpack, use `@babel/preset-typescript` rather than `ts-loader`.
14 changes: 14 additions & 0 deletions .cursor/rules/js-testing.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Guidelines to write JavaScript tests
globs:
---
- Use Jest with WordPress test utilities
- Follow WordPress testing patterns
- Test React components with `@testing-library/react`
- Implement proper async testing
- Use WordPress mocking patterns


Check [component.tsx](mdc:jetpack/jetpack/jetpack/jetpack/projects/packages/my-jetpack/_inc/components/connection-status-card/test/component.tsx) for an example.

Find out more about how to develop tests at [automated-testing.md](mdc:jetpack/jetpack/docs/automated-testing.md)
20 changes: 20 additions & 0 deletions .cursor/rules/php-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
description: PHP coding standards
globs: *.php
---
- Follow WordPress PHP Coding Standards
- Use proper WordPress prefix for functions and classes
- Implement WordPress nonce verification
- Follow WordPress database operations best practices
- Structure plugin hooks logically

## Package Version Annotations

When needing to add a package version number inside a DocBlock, please use `$$next-version$$` as such:

- `@since $$next-version$$`
- `@deprecated $$next-version$$`
- `@deprecated since $$next-version$$`
- `_deprecated_function( __METHOD__, 'package-$$next-version$$' );` (other WordPress deprecation functions also work, but note it must be all on one line).

The `$$next-version$$` specifier will be automatically replaced with the correct package version number the next time a new version of that package is released.
14 changes: 14 additions & 0 deletions .cursor/rules/php-testing.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description: Guidelines when testing PHP
globs:
---
When developing Unit Tests in PHP, follow these guidelines:

- Use PHPUnit with WordPress test framework
- Follow WordPress testing conventions
- Use WordPress fixtures and mocks
- Test WordPress hooks and filters

Check [test_Manager_integration.php](mdc:jetpack/jetpack/jetpack/jetpack/projects/packages/connection/tests/php/test_Manager_integration.php) for an example.

Find out more rules on how to write tests at [automated-testing.md](mdc:jetpack/jetpack/docs/automated-testing.md)
22 changes: 22 additions & 0 deletions docs/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,28 @@ Dismiss a Jetpack notice by Id.
* `"feedback_dash_request"`
* `"welcome"`.

### Jetpack Features (not modules)

This has primarily been introduced to distinguish between former modules moved to the Classic Theme Helper package (predominantly Custom Content Types), and existing modules.

#### GET wp-json/jetpack/v4/feature/:feature-slug

Get a single feature status, over-ride property, description and search queries by its slug.

**Example response** for `/feature/custom-content-types`

```json
{
"custom-content-types": {
"active": true,
"over_ride": false,
"description": "Display different types of content on your site with custom content types.",
"additional_search_queries": "cpt, custom post types, portfolio, portfolios, testimonial, testimonials",
}
}
```


### Site information

Operations related to information about the site.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"packageManager": "[email protected]",
"pnpm": {
"patchedDependencies": {
"@wordpress/dataviews@4.12.0": ".pnpm-patches/@[email protected]"
"@wordpress/dataviews": ".pnpm-patches/@[email protected]"
}
}
}
Loading

0 comments on commit 525262f

Please sign in to comment.