Skip to content
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

Code style: Fix ESLint warnings reported for JSDoc definitions #18025

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ _Parameters_

_Returns_

- `Array<Editor.InserterItem>`: Items that appear in inserter.
- `Array<WPEditorInserterItem>`: Items that appear in inserter.

<a name="getLastMultiSelectedBlockClientId" href="#getLastMultiSelectedBlockClientId">#</a> **getLastMultiSelectedBlockClientId**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ _Parameters_

- _state_ `Object`: Global application state.
- _preferenceKey_ `string`: Preference Key.
- _defaultValue_ `Mixed`: Default Value.
- _defaultValue_ `*`: Default Value.

_Returns_

- `Mixed`: Preference Value.
- `*`: Preference Value.

<a name="getPreferences" href="#getPreferences">#</a> **getPreferences**

Expand Down
2 changes: 1 addition & 1 deletion docs/designers-developers/developers/data/data-core-nux.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _Parameters_

_Returns_

- `?NUX.GuideInfo`: Information about the associated guide.
- `?NUXGuideInfo`: Information about the associated guide.

<a name="isTipVisible" href="#isTipVisible">#</a> **isTipVisible**

Expand Down
2 changes: 1 addition & 1 deletion docs/designers-developers/developers/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ a given URl has been received.
_Parameters_

- _url_ `string`: URL to preview the embed for.
- _preview_ `Mixed`: Preview data.
- _preview_ `*`: Preview data.

_Returns_

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ _Parameters_

_Returns_

- `WPElement`: Rendered element.
- `WPComponent`: The component to be rendered.

<a name="BlockSelectionClearer" href="#BlockSelectionClearer">#</a> **BlockSelectionClearer**

Expand Down
6 changes: 3 additions & 3 deletions packages/block-editor/src/components/block-edit/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export { Provider as BlockEditContextProvider };
* expected to return object of props to
* merge with the component's own props.
*
* @return {Component} Enhanced component with injected context as props.
* @return {WPComponent} Enhanced component with injected context as props.
*/
export const withBlockEditContext = ( mapContextToProps ) => createHigherOrderComponent( ( OriginalComponent ) => {
return ( props ) => (
Expand All @@ -46,9 +46,9 @@ export const withBlockEditContext = ( mapContextToProps ) => createHigherOrderCo
* A Higher Order Component used to render conditionally the wrapped
* component only when the BlockEdit has selected state set.
*
* @param {Component} OriginalComponent Component to wrap.
* @param {WPComponent} OriginalComponent Component to wrap.
*
* @return {Component} Component which renders only when the BlockEdit is selected.
* @return {WPComponent} Component which renders only when the BlockEdit is selected.
*/
export const ifBlockEditSelected = createHigherOrderComponent( ( OriginalComponent ) => {
return ( props ) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import BlockTitle from '../block-title';
* the root block.
*
* @param {string} props.clientId Client ID of block.
* @return {WPElement} Block Breadcrumb.
* @return {WPComponent} The component to be rendered.
*/
const BlockBreadcrumb = forwardRef( ( { clientId }, ref ) => {
const { setNavigationMode } = useDispatch( 'core/block-editor' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export function BlockPreview( { blocks, viewportWidth = 700, padding, settings }
*
* @param {Array|Object} blocks A block instance (object) or an array of blocks to be previewed.
* @param {number} viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.
* @return {WPElement} Rendered element.
* @return {WPComponent} The component to be rendered.
*/
export default withSelect( ( select ) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/colors/with-colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const withEditorColorPalette = () => withSelect( ( select ) => {
* @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).
* @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.
*
* @return {Component} The component that can be used as a HOC.
* @return {WPComponent} The component that can be used as a HOC.
*/
function createColorHOC( colorTypes, withColorPalette ) {
const colorMap = reduce( colorTypes, ( colorObject, colorType ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Component, forwardRef, createElement } from '@wordpress/element';
* element should stop propagation but not invoke a callback handler, since it
* would be assumed these are invoked by the child element.
*
* @type {Component}
* @type {WPComponent}
*/
export class IgnoreNestedEvents extends Component {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/media-upload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { withFilters } from '@wordpress/components';
* an integration with the core blocks that handle media files. By default it renders nothing but
* it provides a way to have it overridden with the `editor.MediaUpload` filter.
*
* @return {WPElement} Media upload element.
* @return {WPComponent} The component to be rendered.
*/
const MediaUpload = () => null;

Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class BlockEditorProvider extends Component {
* This needs to be done synchronously after state changes (instead of using
* `componentDidUpdate`) in order to avoid batching these changes.
*
* @param {WPDataRegistry} registry Registry from which block editor
* dispatch is to be overriden.
* @param {WPDataRegistry} registry Registry from which block editor
* dispatch is to be overridden.
*/
attachChangeObserver( registry ) {
if ( this.unsubscribe ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/provider/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class BlockEditorProvider extends Component {
* This needs to be done synchronously after state changes (instead of using
* `componentDidUpdate`) in order to avoid batching these changes.
*
* @param {WPDataRegistry} registry Registry from which block editor
* dispatch is to be overriden.
* @param {WPDataRegistry} registry Registry from which block editor
* dispatch is to be overridden.
*/
attachChangeObserver( registry ) {
if ( this.unsubscribe ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ const SHORTCUTS_ELEMENT = (
* Component which registered keyboard event handlers to prevent default
* behaviors for key combinations otherwise handled internally by RichText.
*
* @return {WPElement} WordPress element.
* @return {WPComponent} The component to be rendered.
*/
export const RemoveBrowserShortcuts = () => SHORTCUTS_ELEMENT;
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/typewriter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Typewriter extends Component {
* Maintains the scroll position after a selection change caused by a
* keyboard event.
*
* @param {SyntheticEvent} event Synthetic keyboard event.
* @param {WPSyntheticEvent} event Synthetic keyboard event.
*/
maintainCaretPosition( { keyCode } ) {
if ( ! this.isSelectionEligibleForScroll() ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export function addAttribute( settings ) {
* Override the default edit UI to include a new block inspector control for
* assigning the anchor ID, if block supports anchor.
*
* @param {Function|Component} BlockEdit Original component.
* @param {WPComponent} BlockEdit Original component.
*
* @return {string} Wrapped component.
* @return {WPComponent} Wrapped component.
*/
export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/custom-class-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export function addAttribute( settings ) {
* Override the default edit UI to include a new block inspector control for
* assigning the custom class name, if block supports custom class name.
*
* @param {Function|Component} BlockEdit Original component.
* @param {WPComponent} BlockEdit Original component.
*
* @return {string} Wrapped component.
* @return {WPComponent} Wrapped component.
*/
export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
Expand Down
22 changes: 12 additions & 10 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ import {
} from '@wordpress/blocks';
import { SVG, Rect, G, Path } from '@wordpress/components';

/**
* A block selection object.
*
* @typedef {Object} WPBlockSelection
*
* @property {string} clientId A block client ID.
* @property {string} attributeKey A block attribute key.
* @property {number} offset A block attribute offset.
*/

// Module constants

/**
Expand Down Expand Up @@ -281,14 +291,6 @@ export function getBlockCount( state, rootClientId ) {
return getBlockOrder( state, rootClientId ).length;
}

/**
* @typedef {WPBlockSelection} A block selection object.
*
* @property {string} clientId A block client ID.
* @property {string} attributeKey A block attribute key.
* @property {number} offset A block attribute offset.
*/

/**
* Returns the current selection start block client ID, attribute key and text
* offset.
Expand Down Expand Up @@ -1123,9 +1125,9 @@ const canIncludeBlockTypeInInserter = ( state, blockType, rootClientId ) => {
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Editor.InserterItem[]} Items that appear in inserter.
* @return {WPEditorInserterItem[]} Items that appear in inserter.
*
* @typedef {Object} Editor.InserterItem
* @typedef {Object} WPEditorInserterItem
* @property {string} id Unique identifier for the item.
* @property {string} name The type of block to create.
* @property {Object} initialAttributes Attributes to pass to the newly created block.
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ wrapped component.

_Returns_

- `Component`: Enhanced component with injected BlockContent as prop.
- `WPComponent`: Enhanced component with injected BlockContent as prop.


<!-- END TOKEN(Autogenerated API docs) -->
Expand Down
14 changes: 7 additions & 7 deletions packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ import { DEPRECATED_ENTRY_KEYS } from './constants';
/**
* Defined behavior of a block type.
*
* @typedef {Object} WPBlockType
* @typedef {Object} WPBlock
*
* @property {string} name Block type's namespaced name.
* @property {string} title Human-readable block type label.
* @property {string} category Block type category classification,
* @property {string} name Block type's namespaced name.
* @property {string} title Human-readable block type label.
* @property {string} category Block type category classification,
* used in search interfaces to arrange
* block types by category.
* @property {WPBlockTypeIcon} [icon] Block type icon.
Expand All @@ -74,7 +74,7 @@ import { DEPRECATED_ENTRY_KEYS } from './constants';
* @property {WPComponent} [save] Optional component describing
* serialized markup structure of a
* block type.
* @property {WPComponent} edit Component rendering an element to
* @property {WPComponent} edit Component rendering an element to
* manipulate the attributes of a block
* in the context of an editor.
*/
Expand Down Expand Up @@ -114,7 +114,7 @@ export function unstable__bootstrapServerSideBlockDefinitions( definitions ) { /
* @param {Object} settings Block settings.
*
* @return {?WPBlock} The block, if it has been successfully registered;
* otherwise `undefined`.
* otherwise `undefined`.
*/
export function registerBlockType( name, settings ) {
settings = {
Expand Down Expand Up @@ -234,7 +234,7 @@ export function registerBlockType( name, settings ) {
* @param {string} name Block name.
*
* @return {?WPBlock} The previous block value, if it has been successfully
* unregistered; otherwise `undefined`.
* unregistered; otherwise `undefined`.
*/
export function unregisterBlockType( name ) {
const oldBlock = select( 'core/blocks' ).getBlockType( name );
Expand Down
12 changes: 6 additions & 6 deletions packages/blocks/src/api/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export function getSaveElement( blockTypeOrName, attributes, innerBlocks = [] )
/**
* Filters the props applied to the block save result element.
*
* @param {Object} props Props applied to save element.
* @param {WPBlockType} blockType Block type definition.
* @param {Object} attributes Block attributes.
* @param {Object} props Props applied to save element.
* @param {WPBlock} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
const props = applyFilters(
'blocks.getSaveContent.extraProps',
Expand All @@ -104,9 +104,9 @@ export function getSaveElement( blockTypeOrName, attributes, innerBlocks = [] )
/**
* Filters the save result of a block during serialization.
*
* @param {WPElement} element Block save result.
* @param {WPBlockType} blockType Block type definition.
* @param {Object} attributes Block attributes.
* @param {WPElement} element Block save result.
* @param {WPBlock} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
element = applyFilters( 'blocks.getSaveElement', element, blockType, attributes );

Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/block-content-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const { Consumer, Provider } = createContext( () => {} );
* </BlockContentProvider>
* ```
*
* @return {WPElement} Element with BlockContent injected via context.
* @return {WPComponent} Element with BlockContent injected via context.
*/
const BlockContentProvider = ( { children, innerBlocks } ) => {
const BlockContent = () => {
Expand All @@ -48,7 +48,7 @@ const BlockContentProvider = ( { children, innerBlocks } ) => {
* A Higher Order Component used to inject BlockContent using context to the
* wrapped component.
*
* @return {Component} Enhanced component with injected BlockContent as prop.
* @return {WPComponent} Enhanced component with injected BlockContent as prop.
*/
export const withBlockContentContext = createHigherOrderComponent( ( OriginalComponent ) => {
return ( props ) => (
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import withSpokenMessages from '../higher-order/with-spoken-messages';
*/

/**
* @typedef {Object} Completer
* @typedef {Object} WPCompleter
* @property {string} name a way to identify a completer, useful for selective overriding.
* @property {?string} className A class to apply to the popup menu.
* @property {string} triggerPrefix the prefix that will display the menu.
Expand Down Expand Up @@ -232,8 +232,8 @@ export class Autocomplete extends Component {
/**
* Load options for an autocompleter.
*
* @param {Completer} completer The autocompleter.
* @param {string} query The query, if any.
* @param {WPCompleter} completer The autocompleter.
* @param {string} query The query, if any.
*/
loadOptions( completer, query ) {
const { options } = completer;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/date-time/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DatePicker extends Component {
* object representing now. If a null value is passed, return a null value.
*
* @param {?string} currentDate Date representing the currently selected date or null to signify no selection.
* @return {?Moment} Moment object for selected date or null.
* @return {?moment.Moment} Moment object for selected date or null.
*/
getMomentDate( currentDate ) {
if ( null === currentDate ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function isComponentLike( object ) {
* when the component is unmounted.
*
* @param {(WPComponent|Object)} options The component to be enhanced with
* focus return behavior, or an object
* describing the component and the
* focus return characteristics.
* focus return behavior, or an object
* describing the component and the
* focus return characteristics.
*
* @return {Component} Component with the focus restauration behaviour.
* @return {WPComponent} Component with the focus restauration behaviour.
*/
function withFocusReturn( options ) {
// Normalize as overloaded form `withFocusReturn( options )( Component )`
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/higher-order/with-notices/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import NoticeList from '../../notice/list';
/**
* Override the default edit UI to include notices if supported.
*
* @param {Function|Component} OriginalComponent Original component.
* @return {Component} Wrapped component.
* @param {WPComponent} OriginalComponent Original component.
*
* @return {WPComponent} Wrapped component.
*/
export default createHigherOrderComponent( ( OriginalComponent ) => {
return class WrappedBlockEdit extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { createHigherOrderComponent } from '@wordpress/compose';
* A Higher Order Component used to be provide a unique instance ID by
* component.
*
* @param {WPElement} WrappedComponent The wrapped component.
* @param {WPComponent} WrappedComponent The wrapped component.
*
* @return {Component} Component with an instanceId prop.
* @return {WPComponent} The component to be rendered.
*/
export default createHigherOrderComponent( ( WrappedComponent ) => {
return class extends Component {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/menu-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import IconButton from '../icon-button';
/**
* Renders a generic menu item for use inside the more menu.
*
* @return {WPElement} More menu item.
* @return {WPComponent} The component to be rendered.
*/
export function MenuItem( {
children,
Expand Down
Loading