Skip to content

Commit

Permalink
Fix: Invalid JSDoc syntax for optional object. (WordPress#68061)
Browse files Browse the repository at this point in the history
Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: shail-mehta <[email protected]>
  • Loading branch information
4 people authored Dec 18, 2024
1 parent 61dcbee commit 41062d2
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ _Parameters_

_Returns_

- `Object?`: Block attributes.
- `?Object`: Block attributes.

### getBlockCount

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ _Parameters_

_Returns_

- `Object?`: Block Type.
- `?Object`: Block Type.

### getBlockTypes

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Retrieves the template of the currently edited post.

_Returns_

- `Object?`: Post Template.
- `?Object`: Post Template.

### getEditorMode

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-rich-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _Parameters_
_Returns_
- `Object?`: Format type.
- `?Object`: Format type.
### getFormatTypeForBareElement
Expand Down
6 changes: 3 additions & 3 deletions packages/block-editor/src/components/block-styles/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { _x } from '@wordpress/i18n';
* @param {Array} styles Block styles.
* @param {string} className Class name
*
* @return {Object?} The active style.
* @return {?Object} The active style.
*/
export function getActiveStyle( styles, className ) {
for ( const style of new TokenList( className ).values() ) {
Expand All @@ -34,7 +34,7 @@ export function getActiveStyle( styles, className ) {
* Replaces the active style in the block's className.
*
* @param {string} className Class name.
* @param {Object?} activeStyle The replaced style.
* @param {?Object} activeStyle The replaced style.
* @param {Object} newStyle The replacing style.
*
* @return {string} The updated className.
Expand Down Expand Up @@ -83,7 +83,7 @@ export function getRenderedStyles( styles ) {
*
* @param {Array} styles Block styles.
*
* @return {Object?} The default style object, if found.
* @return {?Object} The default style object, if found.
*/
export function getDefaultStyle( styles ) {
return styles?.find( ( style ) => style.isDefault );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights
* @param {Preset} preset
* @param {Object} settings
* @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.
* @param {Object?} settings.typography.layout Layout options.
* @param {?Object} settings.typography.layout Layout options.
*
* @return {string|*} A font-size value or the value of preset.size.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/gap.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/util
* The string check is for backwards compatibility before Gutenberg supported
* split gap values (row and column) and the value was a string n + unit.
*
* @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.
* @param {?string | ?Object} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.
* @return {Object|null} A value to pass to the BoxControl component.
*/
export function getGapBoxControlValueFromStyle( blockGapValue ) {
Expand All @@ -26,7 +26,7 @@ export function getGapBoxControlValueFromStyle( blockGapValue ) {
/**
* Returns a CSS value for the `gap` property from a given blockGap style.
*
* @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.
* @param {?string | ?Object} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.
* @param {?string} defaultValue A default gap value.
* @return {string|null} The concatenated gap value (row and column).
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function isBlockValid( state, clientId ) {
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {Object?} Block attributes.
* @return {?Object} Block attributes.
*/
export function getBlockAttributes( state, clientId ) {
const block = state.blocks.byClientId.get( clientId );
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const getBlockTypes = createSelector(
* };
* ```
*
* @return {Object?} Block Type.
* @return {?Object} Block Type.
*/
export function getBlockType( state, name ) {
return state.blockTypes[ name ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CACHE = new Map();
*
* @async
* @param {string} url the URL to request details from.
* @param {Object?} options any options to pass to the underlying fetch.
* @param {?Object} options any options to pass to the underlying fetch.
* @example
* ```js
* import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const getEditedEntityRecord = forwardResolver( 'getEntityRecord' );
*
* @param {string} kind Entity kind.
* @param {string} name Entity name.
* @param {Object?} query Query Object. If requesting specific fields, fields
* @param {?Object} query Query Object. If requesting specific fields, fields
* must always include the ID.
*/
export const getEntityRecords =
Expand Down
2 changes: 1 addition & 1 deletion packages/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Creates a new store registry, given an optional object of initial store configur
_Parameters_
- _storeConfigs_ `Object`: Initial store configurations.
- _parent_ `Object?`: Parent registry.
- _parent_ `?Object`: Parent registry.
_Returns_
Expand Down
2 changes: 1 addition & 1 deletion packages/data/src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getStoreName( storeNameOrDescriptor ) {
* configurations.
*
* @param {Object} storeConfigs Initial store configurations.
* @param {Object?} parent Parent registry.
* @param {?Object} parent Parent registry.
*
* @return {WPDataRegistry} Data registry.
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Create a new user account.
_Parameters_

- _username_ `string`: User name.
- _object_ `Object?`: Optional Settings for the new user account.
- _object_ `?Object`: Optional Settings for the new user account.
- _object.firstName_ `[string]`: First name.
- _object.lastName_ `[string]`: Last name.
- _object.role_ `[string]`: Role. Defaults to Administrator.
Expand Down Expand Up @@ -252,7 +252,7 @@ Deletes a theme from the site, activating another theme if necessary.
_Parameters_

- _slug_ `string`: Theme slug.
- _settings_ `Object?`: Optional settings object.
- _settings_ `?Object`: Optional settings object.
- _settings.newThemeSlug_ `?string`: A theme to switch to if the theme to delete is active. Required if the theme to delete is active.
- _settings.newThemeSearchTerm_ `?string`: A search term to use if the new theme is not findable by its slug.

Expand Down Expand Up @@ -488,7 +488,7 @@ Installs a theme from the WP.org repository.
_Parameters_

- _slug_ `string`: Theme slug.
- _settings_ `Object?`: Optional settings object.
- _settings_ `?Object`: Optional settings object.
- _settings.searchTerm_ `?string`: Search term to use if the theme is not findable by its slug.

### isCurrentURL
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/create-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { visitAdminPage } from './visit-admin-page';
* Create a new user account.
*
* @param {string} username User name.
* @param {Object?} object Optional Settings for the new user account.
* @param {?Object} object Optional Settings for the new user account.
* @param {string} [object.firstName] First name.
* @param {string} [object.lastName] Last name.
* @param {string} [object.role] Role. Defaults to Administrator.
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/delete-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { isThemeInstalled } from './theme-installed';
* Deletes a theme from the site, activating another theme if necessary.
*
* @param {string} slug Theme slug.
* @param {Object?} settings Optional settings object.
* @param {?Object} settings Optional settings object.
* @param {?string} settings.newThemeSlug A theme to switch to if the theme to delete is active. Required if the theme to delete is active.
* @param {?string} settings.newThemeSearchTerm A search term to use if the new theme is not findable by its slug.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/install-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { isThemeInstalled } from './theme-installed';
* Installs a theme from the WP.org repository.
*
* @param {string} slug Theme slug.
* @param {Object?} settings Optional settings object.
* @param {?Object} settings Optional settings object.
* @param {?string} settings.searchTerm Search term to use if the theme is not findable by its slug.
*/
export async function installTheme( slug, { searchTerm } = {} ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export function areMetaBoxesInitialized( state ) {
/**
* Retrieves the template of the currently edited post.
*
* @return {Object?} Post Template.
* @return {?Object} Post Template.
*/
export const getEditedPostTemplate = createRegistrySelector(
( select ) => () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/store/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function transformWidgetToBlock( widget ) {
* Converts a block to a widget entity record.
*
* @param {Object} block The block.
* @param {Object?} relatedWidget A related widget entity record from the API (optional).
* @param {?Object} relatedWidget A related widget entity record from the API (optional).
* @return {Object} the widget object (converted from block).
*/
export function transformBlockToWidget( block, relatedWidget = {} ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function setCurrentTemplateId( id ) {
/**
* Create a block based template.
*
* @param {Object?} template Template to create and assign.
* @param {?Object} template Template to create and assign.
*/
export const createTemplate =
( template ) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/rich-text/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const getFormatTypes = createSelector(
* };
* ```
*
* @return {Object?} Format type.
* @return {?Object} Format type.
*/
export function getFormatType( state, name ) {
return state.formatTypes[ name ];
Expand Down

0 comments on commit 41062d2

Please sign in to comment.