Skip to content

Commit

Permalink
Remove unnecessary boolean assignments (WordPress#66857)
Browse files Browse the repository at this point in the history
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: mcsf <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 93a025d commit 3a29771
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/cover/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function CoverEdit( {
setAttributes( { minHeight: newMinHeight } );
},
// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.
showHandle: ! attributes.style?.dimensions?.aspectRatio ? true : false,
showHandle: ! attributes.style?.dimensions?.aspectRatio,
size: resizableBoxDimensions,
width,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
checked={ !! dropCap }
onChange={ () => setAttributes( { dropCap: ! dropCap } ) }
help={ helpText }
disabled={ hasDropCapDisabled( align ) ? true : false }
disabled={ hasDropCapDisabled( align ) }
/>
</ToolsPanelItem>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/search/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function render_block_core_search( $attributes ) {

$input_id = wp_unique_id( 'wp-block-search__input-' );
$classnames = classnames_for_block_core_search( $attributes );
$show_label = ( ! empty( $attributes['showLabel'] ) ) ? true : false;
$use_icon_button = ( ! empty( $attributes['buttonUseIcon'] ) ) ? true : false;
$show_label = ! empty( $attributes['showLabel'] );
$use_icon_button = ! empty( $attributes['buttonUseIcon'] );
$show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true;
$button_position = $show_button ? $attributes['buttonPosition'] : null;
$query_params = ( ! empty( $attributes['query'] ) ) ? $attributes['query'] : array();
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
### Internal

- `Snackbar`: Use link variant for action Button ([#66560](https://github.com/WordPress/gutenberg/pull/66560)).
- `BorderControl`: Remove unnecessary boolean assignments ([#66857](https://github.com/WordPress/gutenberg/pull/66857)).

## 28.11.0 (2024-10-30)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const BorderControlDropdown = (
tooltipPosition={ dropdownPosition }
label={ __( 'Border color and style picker' ) }
showTooltip
__next40pxDefaultSize={ size === '__unstable-large' ? true : false }
__next40pxDefaultSize={ size === '__unstable-large' }
>
<span className={ indicatorWrapperClassName }>
<ColorIndicator
Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module.exports = ( sourceFile, options ) => {
}
sourceFile = path.join( processDir, sourceFile );

const debugMode = options.debug ? true : false;
const debugMode = options.debug;

const inputBase = path.join(
path.dirname( sourceFile ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function setupRest( this: RequestUtils ): Promise< StorageState > {
return error;
}

return nonce && rootURL ? true : false;
return !! ( nonce && rootURL );
},
{
message: 'Failed to setup REST API.',
Expand Down
2 changes: 1 addition & 1 deletion packages/media-utils/src/components/media-upload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class MediaUpload extends Component {
state: currentState,
multiple,
selection,
editing: value && value.length ? true : false,
editing: !! value?.length,
} );
wp.media.frame = this.frame;
this.initializeListeners();
Expand Down

0 comments on commit 3a29771

Please sign in to comment.