Skip to content

Commit

Permalink
Code style: Fix ESLint warnings reported for JSDoc definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 18, 2019
1 parent 4e5e7fa commit 1da5770
Show file tree
Hide file tree
Showing 94 changed files with 335 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ _Parameters_

_Returns_

- `Array<WPBlock>`: Block objects.
- `null`: Block objects.

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ _Parameters_

_Returns_

- `Array<WPBlock>`: Filtered set of blocks for save.
- `null`: Filtered set of blocks for save.

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

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.
- `null`: 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 {import('@wordpress/element').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 {import('@wordpress/element').WPComponent} OriginalComponent Component to wrap.
*
* @return {Component} Component which renders only when the BlockEdit is selected.
* @return {import('@wordpress/element').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 {import('@wordpress/element').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 {import('@wordpress/element').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 {import('@wordpress/element').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 {import('@wordpress/element').WPComponent}
*/
export class IgnoreNestedEvents extends Component {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Inserter extends Component {
* pressed.
* @param {boolean} options.isOpen Whether dropdown is currently open.
*
* @return {WPElement} Dropdown toggle element.
* @return {import('@wordpress/element').WPElement} Dropdown toggle element.
*/
renderToggle( { onToggle, isOpen } ) {
const {
Expand All @@ -69,7 +69,7 @@ class Inserter extends Component {
* @param {Function} options.onClose Callback to invoke when dropdown is
* closed.
*
* @return {WPElement} Dropdown content element.
* @return {import('@wordpress/element').WPElement} Dropdown content element.
*/
renderContent( { onClose } ) {
const { rootClientId, clientId, isAppender, showInserterHelpPanel } = this.props;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/inserter/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Inserter extends Component {
* pressed.
* @param {boolean} options.isOpen Whether dropdown is currently open.
*
* @return {WPElement} Dropdown toggle element.
* @return {import('@wordpress/element').WPElement} Dropdown toggle element.
*/
renderToggle( { onToggle, isOpen } ) {
const {
Expand All @@ -69,7 +69,7 @@ class Inserter extends Component {
* @param {Function} options.onClose Callback to invoke when dropdown is
* closed.
*
* @return {WPElement} Dropdown content element.
* @return {import('@wordpress/element').WPElement} Dropdown content element.
*/
renderContent( { onClose, isOpen } ) {
const { rootClientId, clientId, isAppender } = this.props;
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 {import('@wordpress/element').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 {import('@wordpress/data').WPDataRegistry} registry Registry from which block editor
* dispatch is to be overridden.
*/
attachChangeObserver( registry ) {
if ( this.unsubscribe ) {
Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/provider/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { createHigherOrderComponent, compose } from '@wordpress/compose';
* Higher-order component which renders the original component with the current
* registry context passed as its `registry` prop.
*
* @param {WPComponent} OriginalComponent Original component.
* @param {import('@wordpress/element').WPComponent} OriginalComponent Original component.
*
* @return {WPComponent} Enhanced component.
* @return {import('@wordpress/element').WPComponent} Enhanced component.
*/
const withRegistry = createHigherOrderComponent(
( OriginalComponent ) => ( props ) => (
Expand Down 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 {import('@wordpress/data').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 @@ -25,7 +25,7 @@ const HANDLED_SHORTCUTS = [
* shortcuts. Since shortcuts never change, the element can be considered
* static, and can be skipped in reconciliation.
*
* @type {WPElement}
* @type {import('@wordpress/element').WPElement}
*/
const SHORTCUTS_ELEMENT = (
<KeyboardShortcuts
Expand All @@ -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 {import('@wordpress/element').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 {import('@wordpress/element').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 {import('@wordpress/element').WPComponent} BlockEdit Original component.
*
* @return {string} Wrapped component.
* @return {import('@wordpress/element').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 {import('@wordpress/element').WPComponent} BlockEdit Original component.
*
* @return {string} Wrapped component.
* @return {import('@wordpress/element').WPComponent} Wrapped component.
*/
export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) => {
return ( props ) => {
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 @@ -255,7 +255,7 @@ export const getGlobalBlockCount = createSelector(
* @param {Object} state Editor state.
* @param {string[]} clientIds Client IDs for which blocks are to be returned.
*
* @return {WPBlock[]} Block objects.
* @return {import('@wordpress/blocks').WPBlockType[]} Block objects.
*/
export const getBlocksByClientId = createSelector(
( state, clientIds ) => map(
Expand Down
38 changes: 19 additions & 19 deletions packages/block-library/src/columns/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export const toWidthPrecision = ( value ) =>
* when the given block is the last block in the set. For the last block, the
* behavior is reversed.
*
* @param {WPBlock[]} blocks Block objects.
* @param {string} clientId Client ID to consider for adjacent blocks.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
* @param {string} clientId Client ID to consider for adjacent blocks.
*
* @return {WPBlock[]} Adjacent block objects.
* @return {import('@wordpress/blocks').WPBlockType[]} Adjacent block objects.
*/
export function getAdjacentBlocks( blocks, clientId ) {
const index = findIndex( blocks, { clientId } );
Expand All @@ -54,8 +54,8 @@ export function getAdjacentBlocks( blocks, clientId ) {
* Returns an effective width for a given block. An effective width is equal to
* its attribute value if set, or a computed value assuming equal distribution.
*
* @param {WPBlock} block Block object.
* @param {number} totalBlockCount Total number of blocks in Columns.
* @param {import('@wordpress/blocks').WPBlockType} block Block object.
* @param {number} totalBlockCount Total number of blocks in Columns.
*
* @return {number} Effective column width.
*/
Expand All @@ -67,9 +67,9 @@ export function getEffectiveColumnWidth( block, totalBlockCount ) {
/**
* Returns the total width occupied by the given set of column blocks.
*
* @param {WPBlock[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {number} Total width occupied by blocks.
*/
Expand All @@ -80,9 +80,9 @@ export function getTotalColumnsWidth( blocks, totalBlockCount = blocks.length )
/**
* Returns an object of `clientId` → `width` of effective column widths.
*
* @param {WPBlock[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {Object<string,number>} Column widths.
*/
Expand All @@ -98,10 +98,10 @@ export function getColumnWidths( blocks, totalBlockCount = blocks.length ) {
* proportional to their current widths, constrained or expanded to fit within
* the given available width.
*
* @param {WPBlock[]} blocks Block objects.
* @param {number} availableWidth Maximum width to fit within.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
* @param {number} availableWidth Maximum width to fit within.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {Object<string,number>} Redistributed column widths.
*/
Expand All @@ -120,7 +120,7 @@ export function getRedistributedColumnWidths( blocks, availableWidth, totalBlock
* Returns true if column blocks within the provided set are assigned with
* explicit widths, or false otherwise.
*
* @param {WPBlock[]} blocks Block objects.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
*
* @return {boolean} Whether columns have explicit widths.
*/
Expand All @@ -132,10 +132,10 @@ export function hasExplicitColumnWidths( blocks ) {
* Returns a copy of the given set of blocks with new widths assigned from the
* provided object of redistributed column widths.
*
* @param {WPBlock[]} blocks Block objects.
* @param {Object<string,number>} widths Redistributed column widths.
* @param {import('@wordpress/blocks').WPBlockType[]} blocks Block objects.
* @param {Object<string,number>} widths Redistributed column widths.
*
* @return {WPBlock[]} blocks Mapped block objects.
* @return {import('@wordpress/blocks').WPBlockType[]} blocks Mapped block objects.
*/
export function getMappedColumnWidths( blocks, widths ) {
return blocks.map( ( block ) => merge( {}, block, {
Expand Down
12 changes: 6 additions & 6 deletions packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ which means the block is unmodified.

_Parameters_

- _block_ `WPBlock`: Block Object
- _block_ `null`: Block Object

_Returns_

Expand Down Expand Up @@ -561,11 +561,11 @@ in the codebase.

_Parameters_

- _icon_ `WPBlockTypeIconRender`: Render behavior of a block type icon; one of a Dashicon slug, an element, or a component.
- _icon_ `null`: Render behavior of a block type icon; one of a Dashicon slug, an element, or a component.

_Returns_

- `WPBlockTypeIconDescriptor`: Object describing the icon.
- `null`: Object describing the icon.

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

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

_Returns_

- `?WPBlock`: The block, if it has been successfully registered; otherwise `undefined`.
- `?WPBlockType`: The block, if it has been successfully registered; otherwise `undefined`.

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

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

_Returns_

- `?WPBlock`: The previous block value, if it has been successfully unregistered; otherwise `undefined`.
- `?WPBlockType`: The previous block value, if it has been successfully unregistered; otherwise `undefined`.

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

Expand All @@ -768,7 +768,7 @@ wrapped component.

_Returns_

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


<!-- END TOKEN(Autogenerated API docs) -->
Expand Down
Loading

0 comments on commit 1da5770

Please sign in to comment.