From 81919b01e3dc8be5654bb2af0425482919d0b83b Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sun, 18 Dec 2022 19:01:57 +0900 Subject: [PATCH] Code Quality: Use <> instead of Fragment --- docs/reference-guides/filters/block-filters.md | 5 ++--- docs/reference-guides/slotfills/README.md | 4 ++-- .../slotfills/plugin-sidebar-more-menu-item.md | 5 ++--- .../src/components/block-inspector/index.js | 12 +++++------- .../src/components/responsive-block-control/label.js | 5 ++--- .../responsive-block-control/test/index.js | 4 ++-- .../src/cover/edit/inspector-controls.js | 6 +++--- packages/block-library/src/navigation-link/edit.js | 6 +++--- .../block-library/src/navigation-submenu/edit.js | 6 +++--- packages/block-library/src/social-link/edit.js | 6 +++--- packages/components/src/dimension-control/index.js | 5 ++--- packages/components/src/dropdown-menu/README.md | 5 ++--- 12 files changed, 31 insertions(+), 38 deletions(-) diff --git a/docs/reference-guides/filters/block-filters.md b/docs/reference-guides/filters/block-filters.md index 823248bb451bdd..e41215d67065a1 100644 --- a/docs/reference-guides/filters/block-filters.md +++ b/docs/reference-guides/filters/block-filters.md @@ -179,19 +179,18 @@ _Example:_ ```js const { createHigherOrderComponent } = wp.compose; -const { Fragment } = wp.element; const { InspectorControls } = wp.blockEditor; const { PanelBody } = wp.components; const withInspectorControls = createHigherOrderComponent( ( BlockEdit ) => { return ( props ) => { return ( - + <> My custom control - + ); }; }, 'withInspectorControl' ); diff --git a/docs/reference-guides/slotfills/README.md b/docs/reference-guides/slotfills/README.md index b3ab4dcc083862..c41e6da0d8eb9f 100644 --- a/docs/reference-guides/slotfills/README.md +++ b/docs/reference-guides/slotfills/README.md @@ -75,7 +75,7 @@ const PostStatus = ( { isOpened, onTogglePanel } ) => ( > { ( fills ) => ( - + <> @@ -84,7 +84,7 @@ const PostStatus = ( { isOpened, onTogglePanel } ) => ( { fills } - + ) } diff --git a/docs/reference-guides/slotfills/plugin-sidebar-more-menu-item.md b/docs/reference-guides/slotfills/plugin-sidebar-more-menu-item.md index 8ede72e782b02c..4d32d754578cc4 100644 --- a/docs/reference-guides/slotfills/plugin-sidebar-more-menu-item.md +++ b/docs/reference-guides/slotfills/plugin-sidebar-more-menu-item.md @@ -9,17 +9,16 @@ This is done by setting the `target` on `` to match t import { registerPlugin } from '@wordpress/plugins'; import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post'; import { image } from '@wordpress/icons'; -import { Fragment } from '@wordpress/element'; const PluginSidebarMoreMenuItemTest = () => ( - + <> Expanded Sidebar - More item Content of the sidebar - + ); registerPlugin( 'plugin-sidebar-expanded-test', { diff --git a/packages/block-editor/src/components/block-inspector/index.js b/packages/block-editor/src/components/block-inspector/index.js index 48d5d982e75089..3e2aebb5d500a5 100644 --- a/packages/block-editor/src/components/block-inspector/index.js +++ b/packages/block-editor/src/components/block-inspector/index.js @@ -17,7 +17,7 @@ import { __unstableMotion as motion, } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; -import { useMemo, useCallback, Fragment } from '@wordpress/element'; +import { useMemo, useCallback } from '@wordpress/element'; /** * Internal dependencies @@ -268,12 +268,10 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => { ) } > - - - + ); }; diff --git a/packages/block-editor/src/components/responsive-block-control/label.js b/packages/block-editor/src/components/responsive-block-control/label.js index b0bd0c180cb902..49be9ba5227ed1 100644 --- a/packages/block-editor/src/components/responsive-block-control/label.js +++ b/packages/block-editor/src/components/responsive-block-control/label.js @@ -4,7 +4,6 @@ import { useInstanceId } from '@wordpress/compose'; import { VisuallyHidden } from '@wordpress/components'; import { _x, sprintf } from '@wordpress/i18n'; -import { Fragment } from '@wordpress/element'; export default function ResponsiveBlockControlLabel( { property, @@ -24,13 +23,13 @@ export default function ResponsiveBlockControlLabel( { viewport.label ); return ( - + <> { viewport.label } { accessibleLabel } - + ); } diff --git a/packages/block-editor/src/components/responsive-block-control/test/index.js b/packages/block-editor/src/components/responsive-block-control/test/index.js index f0454dcc87bc76..d9e9a26f96dfe7 100644 --- a/packages/block-editor/src/components/responsive-block-control/test/index.js +++ b/packages/block-editor/src/components/responsive-block-control/test/index.js @@ -38,13 +38,13 @@ const sizeOptions = [ const renderTestDefaultControlComponent = ( labelComponent, device ) => { return ( - + <>

{ device.label } is used here for testing purposes to ensure we have access to details about the device.

-
+ ); }; diff --git a/packages/block-library/src/cover/edit/inspector-controls.js b/packages/block-library/src/cover/edit/inspector-controls.js index 6160f5d7828d6a..0332bf42b1e090 100644 --- a/packages/block-library/src/cover/edit/inspector-controls.js +++ b/packages/block-library/src/cover/edit/inspector-controls.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Fragment, useMemo } from '@wordpress/element'; +import { useMemo } from '@wordpress/element'; import { Button, ExternalLink, @@ -146,7 +146,7 @@ export default function CoverInspectorControls( { { !! url && ( { isImageBackground && ( - + <> - + ) } { showFocalPointPicker && ( + <>
- + ); } diff --git a/packages/block-library/src/navigation-submenu/edit.js b/packages/block-library/src/navigation-submenu/edit.js index a6029e98661ddc..30dc457938c91e 100644 --- a/packages/block-library/src/navigation-submenu/edit.js +++ b/packages/block-library/src/navigation-submenu/edit.js @@ -27,7 +27,7 @@ import { getColorClassName, } from '@wordpress/block-editor'; import { isURL, prependHTTP } from '@wordpress/url'; -import { Fragment, useState, useEffect, useRef } from '@wordpress/element'; +import { useState, useEffect, useRef } from '@wordpress/element'; import { placeCaretAtHorizontalEdge } from '@wordpress/dom'; import { link as linkIcon, removeSubmenu } from '@wordpress/icons'; import { useResourcePermissions } from '@wordpress/core-data'; @@ -438,7 +438,7 @@ export default function NavigationSubmenuEdit( { ! selectedBlockHasChildren || onlyDescendantIsEmptyLink; return ( - + <> { ! openSubmenusOnClick && ( @@ -571,6 +571,6 @@ export default function NavigationSubmenuEdit( { ) }
-
+ ); } diff --git a/packages/block-library/src/social-link/edit.js b/packages/block-library/src/social-link/edit.js index fab49838afa2e4..71ec7faee6406b 100644 --- a/packages/block-library/src/social-link/edit.js +++ b/packages/block-library/src/social-link/edit.js @@ -12,7 +12,7 @@ import { URLInput, useBlockProps, } from '@wordpress/block-editor'; -import { Fragment, useState } from '@wordpress/element'; +import { useState } from '@wordpress/element'; import { Button, PanelBody, @@ -89,7 +89,7 @@ const SocialLinkEdit = ( { } ); return ( - + <> - + ); }; diff --git a/packages/components/src/dimension-control/index.js b/packages/components/src/dimension-control/index.js index 3e782e748a90d4..a6893b165fbf0a 100644 --- a/packages/components/src/dimension-control/index.js +++ b/packages/components/src/dimension-control/index.js @@ -7,7 +7,6 @@ import classnames from 'classnames'; * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { Fragment } from '@wordpress/element'; /** * Internal dependencies @@ -50,10 +49,10 @@ export function DimensionControl( props ) { }; const selectLabel = ( - + <> { icon && } { label } - + ); return ( diff --git a/packages/components/src/dropdown-menu/README.md b/packages/components/src/dropdown-menu/README.md index f85d2813fb1c9a..aa930f22edcf18 100644 --- a/packages/components/src/dropdown-menu/README.md +++ b/packages/components/src/dropdown-menu/README.md @@ -101,14 +101,13 @@ const MyDropdownMenu = () => ( Alternatively, specify a `children` function which returns elements valid for use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`. ```jsx -import { Fragment } from '@wordpress/element'; import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components'; import { more, arrowUp, arrowDown, trash } from '@wordpress/icons'; const MyDropdownMenu = () => ( { ( { onClose } ) => ( - + <> Move Up @@ -122,7 +121,7 @@ const MyDropdownMenu = () => ( Remove - + ) } );