Skip to content

Commit

Permalink
Fix: Invalid JSDoc for optional string parameter and return value. (#…
Browse files Browse the repository at this point in the history
…67489)

Co-authored-by: jorgefilipecosta <[email protected]>
  • Loading branch information
2 people authored and michalczaplinski committed Dec 5, 2024
1 parent 4a15f00 commit f7226c4
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ _Parameters_

_Returns_

- `string?`: Default block name.
- `?string`: Default block name.

### getDefaultBlockVariation

Expand Down Expand Up @@ -464,7 +464,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling non-block content.
- `?string`: Name of the block for handling non-block content.

### getGroupingBlockName

Expand Down Expand Up @@ -502,7 +502,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling the grouping of blocks.
- `?string`: Name of the block for handling the grouping of blocks.

### getUnregisteredFallbackBlockName

Expand Down Expand Up @@ -540,7 +540,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling unregistered blocks.
- `?string`: Name of the block for handling unregistered blocks.

### hasBlockSupport

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

_Returns_

- `string?`: Template ID.
- `?string`: Template ID.

### getDeviceType

Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/data/data-core-keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut description.
- `?string`: Shortcut description.

### getShortcutKeyCombination

Expand Down Expand Up @@ -335,7 +335,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut representation.
- `?string`: Shortcut representation.

<!-- END TOKEN(Autogenerated selectors|../../../packages/keyboard-shortcuts/src/store/selectors.js) -->

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/gap.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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?} defaultValue A default gap value.
* @param {?string} defaultValue A default gap value.
* @return {string|null} The concatenated gap value (row and column).
*/
export function getGapCSSValue( blockGapValue, defaultValue = '0' ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/list-item/hooks/use-merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function useMerge( clientId, onMerge ) {
* return the next list item of the parent list item if it exists.
*
* @param {string} id A list item client ID.
* @return {string?} The client ID of the next list item.
* @return {?string} The client ID of the next list item.
*/
function _getNextId( id ) {
const next = getNextBlockClientId( id );
Expand All @@ -68,7 +68,7 @@ export default function useMerge( clientId, onMerge ) {
* line, regardless of indentation level.
*
* @param {string} id The client ID of the current list item.
* @return {string?} The client ID of the next list item.
* @return {?string} The client ID of the next list item.
*/
function getNextId( id ) {
const order = getBlockOrder( id );
Expand Down
8 changes: 4 additions & 4 deletions packages/blocks/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export function getCollections( state ) {
* };
* ```
*
* @return {string?} Default block name.
* @return {?string} Default block name.
*/
export function getDefaultBlockName( state ) {
return state.defaultBlockName;
Expand Down Expand Up @@ -473,7 +473,7 @@ export function getDefaultBlockName( state ) {
* };
* ```
*
* @return {string?} Name of the block for handling non-block content.
* @return {?string} Name of the block for handling non-block content.
*/
export function getFreeformFallbackBlockName( state ) {
return state.freeformFallbackBlockName;
Expand Down Expand Up @@ -509,7 +509,7 @@ export function getFreeformFallbackBlockName( state ) {
* };
* ```
*
* @return {string?} Name of the block for handling unregistered blocks.
* @return {?string} Name of the block for handling unregistered blocks.
*/
export function getUnregisteredFallbackBlockName( state ) {
return state.unregisteredFallbackBlockName;
Expand Down Expand Up @@ -545,7 +545,7 @@ export function getUnregisteredFallbackBlockName( state ) {
* };
* ```
*
* @return {string?} Name of the block for handling the grouping of blocks.
* @return {?string} Name of the block for handling the grouping of blocks.
*/
export function getGroupingBlockName( state ) {
return state.groupingBlockName;
Expand Down
2 changes: 1 addition & 1 deletion packages/date/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Create and return a JavaScript Date Object from a date string in the WP timezone

_Parameters_

- _dateString_ `string?`: Date formatted in the WP timezone.
- _dateString_ `?string`: Date formatted in the WP timezone.

_Returns_

Expand Down
2 changes: 1 addition & 1 deletion packages/date/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export function isInTheFuture( dateValue ) {
/**
* Create and return a JavaScript Date Object from a date string in the WP timezone.
*
* @param {string?} dateString Date formatted in the WP timezone.
* @param {?string} dateString Date formatted in the WP timezone.
*
* @return {Date} Date
*/
Expand Down
8 changes: 4 additions & 4 deletions packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ _Parameters_

- _slug_ `string`: Theme slug.
- _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.
- _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.

### deleteUser

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

- _slug_ `string`: Plugin slug.
- _searchTerm_ `string?`: If the plugin is not findable by its slug use an alternative term to search.
- _searchTerm_ `?string`: If the plugin is not findable by its slug use an alternative term to search.

### installTheme

Expand All @@ -489,7 +489,7 @@ _Parameters_

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

### isCurrentURL

Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-test-utils/src/delete-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { isThemeInstalled } from './theme-installed';
*
* @param {string} slug Theme slug.
* @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.
* @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.
*/
export async function deleteTheme(
slug,
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/get-current-user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Get the username of the user that's currently logged into WordPress (if any).
*
* @return {string?} username The user that's currently logged into WordPress (if any).
* @return {?string} username The user that's currently logged into WordPress (if any).
*/
export async function getCurrentUser() {
const cookies = await page.cookies();
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/install-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { visitAdminPage } from './visit-admin-page';
* Installs a plugin from the WP.org repository.
*
* @param {string} slug Plugin slug.
* @param {string?} searchTerm If the plugin is not findable by its slug use an alternative term to search.
* @param {?string} searchTerm If the plugin is not findable by its slug use an alternative term to search.
*/
export async function installPlugin( slug, searchTerm ) {
await switchUserToAdmin();
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 @@ -11,7 +11,7 @@ import { isThemeInstalled } from './theme-installed';
*
* @param {string} slug Theme slug.
* @param {Object?} settings Optional settings object.
* @param {string?} settings.searchTerm Search term to use if the theme is not findable by its slug.
* @param {?string} settings.searchTerm Search term to use if the theme is not findable by its slug.
*/
export async function installTheme( slug, { searchTerm } = {} ) {
await switchUserToAdmin();
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function getCurrentPostId( state ) {
*
* @param {Object} state Global application state.
*
* @return {string?} Template ID.
* @return {?string} Template ID.
*/
export function getCurrentTemplateId( state ) {
return state.templateId;
Expand Down
6 changes: 3 additions & 3 deletions packages/keyboard-shortcuts/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const FORMATTING_METHODS = {
* @param {keyof FORMATTING_METHODS} representation Type of representation
* (display, raw, ariaLabel).
*
* @return {string?} Shortcut representation.
* @return {?string} Shortcut representation.
*/
function getKeyCombinationRepresentation( shortcut, representation ) {
if ( ! shortcut ) {
Expand Down Expand Up @@ -135,7 +135,7 @@ export function getShortcutKeyCombination( state, name ) {
* };
*```
*
* @return {string?} Shortcut representation.
* @return {?string} Shortcut representation.
*/
export function getShortcutRepresentation(
state,
Expand Down Expand Up @@ -172,7 +172,7 @@ export function getShortcutRepresentation(
* );
* };
*```
* @return {string?} Shortcut description.
* @return {?string} Shortcut description.
*/
export function getShortcutDescription( state, name ) {
return state[ name ] ? state[ name ].description : null;
Expand Down

0 comments on commit f7226c4

Please sign in to comment.