Skip to content

Commit

Permalink
Merge pull request #4493 from WordPress/update/jsdoc-returns-follow-up
Browse files Browse the repository at this point in the history
docs: add preceding line break and remove superfluous spacing in JSDoc `@returns` descriptions
  • Loading branch information
atimmer committed Jan 16, 2018
2 parents af74fa6 + 35b8e04 commit 34930ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion blocks/autocompleters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ import BlockIcon from '../block-icon';

/**
* @callback FnGetOptions
*
* @returns {Promise.<Array.<CompleterOption>>} A promise that resolves to the list of completer options.
*/

/**
* @callback FnAllowNode
* @param {Node} textNode check if the completer can handle this text node.
*
* @returns {boolean} true if the completer can handle this text node.
*/

/**
* @callback FnAllowContext
* @param {Range} before the range before the auto complete trigger and query.
* @param {Range} after the range after the autocomplete trigger and query.
*
* @returns {boolean} true if the completer can handle these ranges.
*/

Expand All @@ -40,6 +43,7 @@ import BlockIcon from '../block-icon';
* @param {*} value the value of the completer option.
* @param {Range} range the nodes included in the autocomplete trigger and query.
* @param {String} query the text value of the autocomplete query.
*
* @returns {?Component} optional html to replace the range.
*/

Expand All @@ -58,7 +62,8 @@ import BlockIcon from '../block-icon';
* The definition can be understood by the Autocomplete component.
*
* @param {Function} onReplace Callback to replace the current block.
* @returns {Completer} Completer object used by the Autocomplete component.
*
* @returns {Completer} Completer object used by the Autocomplete component.
*/
export function blockAutocompleter( { onReplace } ) {
// Prioritize common category in block type options
Expand Down
3 changes: 2 additions & 1 deletion blocks/image-placeholder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import MediaUploadButton from '../media-upload-button';
* ImagePlaceHolder is a react component used by blocks containing user configurable images e.g: image and cover image.
*
* @param {Object} props React props passed to the component.
* @returns {Object} Rendered placeholder.
*
* @returns {Object} Rendered placeholder.
*/
export default function ImagePlaceHolder( { className, icon, label, onSelectImage } ) {
const setImage = ( [ image ] ) => onSelectImage( image );
Expand Down
5 changes: 5 additions & 0 deletions components/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const { ENTER, ESCAPE, UP, DOWN, LEFT, RIGHT, SPACE } = keycodes;
/**
* Recursively select the firstChild until hitting a leaf node.
* @param {Node} node the node to find the recursive first child.
*
* @returns {Node} the first leaf-node >= node in the ordering.
*/
function descendFirst( node ) {
Expand All @@ -39,6 +40,7 @@ function descendFirst( node ) {
/**
* Recursively select the lastChild until hitting a leaf node.
* @param {Node} node the node to find the recursive last child.
*
* @returns {Node} the first leaf-node <= node in the ordering.
*/
function descendLast( node ) {
Expand All @@ -52,6 +54,7 @@ function descendLast( node ) {
/**
* Is the node a text node.
* @param {?Node} node the node to check.
*
* @returns {boolean} true if the node is a text node.
*/
function isTextNode( node ) {
Expand All @@ -61,6 +64,7 @@ function isTextNode( node ) {
/**
* Return the node only if it is a text node, otherwise return null.
* @param {?Node} node the node to filter.
*
* @returns {?Node} the node or null if it is not a text node.
*/
function onlyTextNode( node ) {
Expand All @@ -70,6 +74,7 @@ function onlyTextNode( node ) {
/**
* Find the index of the last charater in the text that is whitespace.
* @param {String} text the text to search.
*
* @returns {Number} the last index of a white space character in the text or -1.
*/
function lastIndexOfSpace( text ) {
Expand Down
2 changes: 2 additions & 0 deletions components/autocomplete/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function makeAutocompleter( completers, AutocompleteComponent = Autocomplete ) {
/**
* Create a text node
* @param {String} text text of text node.
* @returns {Node} a text node.
*/
function tx( text ) {
Expand All @@ -63,6 +64,7 @@ function tx( text ) {

/**
* Create a paragraph node with the arguments as children
* @returns {Node} a paragraph node.
*/
function par( /* arguments */ ) {
Expand Down
3 changes: 2 additions & 1 deletion editor/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { partial, castArray } from 'lodash';
*
* @param {Object} post Post object
* @param {Object} settings Editor settings object
* @returns {Object} Action object
*
* @returns {Object} Action object.
*/
export function setupEditor( post, settings ) {
return {
Expand Down

0 comments on commit 34930ca

Please sign in to comment.