Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Upgrade wp-prettier to 2.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
frontdevde committed Jun 14, 2022
1 parent 28e8e7a commit 0c4f115
Show file tree
Hide file tree
Showing 160 changed files with 1,464 additions and 1,564 deletions.
5 changes: 2 additions & 3 deletions assets/js/atomic/blocks/product-elements/add-to-cart/block.js
Expand Up @@ -37,9 +37,8 @@ const Block = ( { className, showFormElements } ) => {
className,
'wc-block-components-product-add-to-cart',
{
'wc-block-components-product-add-to-cart--placeholder': isEmpty(
product
),
'wc-block-components-product-add-to-cart--placeholder':
isEmpty( product ),
}
);

Expand Down
Expand Up @@ -32,11 +32,8 @@ const AttributeSelectControl = ( {
'woo-gutenberg-products-block'
),
} ) => {
const {
getValidationError,
setValidationErrors,
clearValidationError,
} = useValidationContext();
const { getValidationError, setValidationErrors, clearValidationError } =
useValidationContext();
const errorId = attributeName;
const error = getValidationError( errorId ) || {};

Expand All @@ -60,10 +57,10 @@ const AttributeSelectControl = ( {
] );

// Remove validation errors when unmounted.
useEffect( () => () => void clearValidationError( errorId ), [
errorId,
clearValidationError,
] );
useEffect(
() => () => void clearValidationError( errorId ),
[ errorId, clearValidationError ]
);

return (
<div className="wc-block-components-product-add-to-cart-attribute-picker__container">
Expand Down
Expand Up @@ -45,10 +45,11 @@ const AddToCartButton = () => {
}
return true;
};
const unsubscribeProcessing = eventRegistration.onAddToCartAfterProcessingWithSuccess(
onSuccess,
0
);
const unsubscribeProcessing =
eventRegistration.onAddToCartAfterProcessingWithSuccess(
onSuccess,
0
);
return () => {
unsubscribeProcessing();
};
Expand Down
3 changes: 2 additions & 1 deletion assets/js/atomic/blocks/product-elements/button/block.js
Expand Up @@ -52,7 +52,8 @@ const Block = ( props ) => {
'wp-block-button',
'wc-block-components-product-button',
{
[ `${ parentClassName }__product-add-to-cart` ]: parentClassName,
[ `${ parentClassName }__product-add-to-cart` ]:
parentClassName,
}
) }
>
Expand Down
Expand Up @@ -49,7 +49,8 @@ const Block = ( props: Props ): JSX.Element | null => {
'wc-block-components-product-category-list',
colorProps.className,
{
[ `${ parentClassName }__product-category-list` ]: parentClassName,
[ `${ parentClassName }__product-category-list` ]:
parentClassName,
}
) }
style={ { ...colorProps.style, ...typographyProps.style } }
Expand Down
3 changes: 2 additions & 1 deletion assets/js/atomic/blocks/product-elements/image/block.js
Expand Up @@ -60,7 +60,8 @@ export const Block = ( props ) => {
className,
'wc-block-components-product-image',
{
[ `${ parentClassName }__product-image` ]: parentClassName,
[ `${ parentClassName }__product-image` ]:
parentClassName,
},
borderProps.className
) }
Expand Down
8 changes: 2 additions & 6 deletions assets/js/atomic/blocks/product-elements/image/edit.js
Expand Up @@ -23,12 +23,8 @@ import withProductSelector from '../shared/with-product-selector';
import { BLOCK_TITLE, BLOCK_ICON } from './constants';

const Edit = ( { attributes, setAttributes } ) => {
const {
showProductLink,
imageSizing,
showSaleBadge,
saleBadgeAlign,
} = attributes;
const { showProductLink, imageSizing, showSaleBadge, saleBadgeAlign } =
attributes;

const blockProps = useBlockProps();

Expand Down
Expand Up @@ -46,8 +46,7 @@ const productWithImages = {
id: 56,
src: 'logo-1.jpg',
thumbnail: 'logo-1-324x324.jpg',
srcset:
'logo-1.jpg 800w, logo-1-300x300.jpg 300w, logo-1-150x150.jpg 150w, logo-1-768x767.jpg 768w, logo-1-324x324.jpg 324w, logo-1-416x415.jpg 416w, logo-1-100x100.jpg 100w',
srcset: 'logo-1.jpg 800w, logo-1-300x300.jpg 300w, logo-1-150x150.jpg 150w, logo-1-768x767.jpg 768w, logo-1-324x324.jpg 324w, logo-1-416x415.jpg 416w, logo-1-100x100.jpg 100w',
sizes: '(max-width: 800px) 100vw, 800px',
name: 'logo-1.jpg',
alt: '',
Expand All @@ -56,8 +55,7 @@ const productWithImages = {
id: 55,
src: 'beanie-with-logo-1.jpg',
thumbnail: 'beanie-with-logo-1-324x324.jpg',
srcset:
'beanie-with-logo-1.jpg 800w, beanie-with-logo-1-300x300.jpg 300w, beanie-with-logo-1-150x150.jpg 150w, beanie-with-logo-1-768x768.jpg 768w, beanie-with-logo-1-324x324.jpg 324w, beanie-with-logo-1-416x416.jpg 416w, beanie-with-logo-1-100x100.jpg 100w',
srcset: 'beanie-with-logo-1.jpg 800w, beanie-with-logo-1-300x300.jpg 300w, beanie-with-logo-1-150x150.jpg 150w, beanie-with-logo-1-768x768.jpg 768w, beanie-with-logo-1-324x324.jpg 324w, beanie-with-logo-1-416x416.jpg 416w, beanie-with-logo-1-100x100.jpg 100w',
sizes: '(max-width: 800px) 100vw, 800px',
name: 'beanie-with-logo-1.jpg',
alt: '',
Expand Down
3 changes: 2 additions & 1 deletion assets/js/atomic/blocks/product-elements/price/block.js
Expand Up @@ -79,7 +79,8 @@ const Block = ( props ) => {
// This is the regular or original price when the `price` value is a sale price.
regularPrice={ prices.regular_price }
regularPriceClassName={ classnames( {
[ `${ parentClassName }__product-price__regular` ]: parentClassName,
[ `${ parentClassName }__product-price__regular` ]:
parentClassName,
} ) }
/>
);
Expand Down
15 changes: 10 additions & 5 deletions assets/js/atomic/blocks/product-elements/stock-indicator/block.js
Expand Up @@ -48,11 +48,16 @@ const Block = ( props ) => {
colorProps.className,
'wc-block-components-product-stock-indicator',
{
[ `${ parentClassName }__stock-indicator` ]: parentClassName,
'wc-block-components-product-stock-indicator--in-stock': inStock,
'wc-block-components-product-stock-indicator--out-of-stock': ! inStock,
'wc-block-components-product-stock-indicator--low-stock': !! lowStock,
'wc-block-components-product-stock-indicator--available-on-backorder': !! isBackordered,
[ `${ parentClassName }__stock-indicator` ]:
parentClassName,
'wc-block-components-product-stock-indicator--in-stock':
inStock,
'wc-block-components-product-stock-indicator--out-of-stock':
! inStock,
'wc-block-components-product-stock-indicator--low-stock':
!! lowStock,
'wc-block-components-product-stock-indicator--available-on-backorder':
!! isBackordered,
}
) }
style={ { ...colorProps.style, ...typographyProps.style } }
Expand Down
6 changes: 4 additions & 2 deletions assets/js/atomic/blocks/product-elements/summary/block.js
Expand Up @@ -43,7 +43,8 @@ const Block = ( props ) => {
className,
`wc-block-components-product-summary`,
{
[ `${ parentClassName }__product-summary` ]: parentClassName,
[ `${ parentClassName }__product-summary` ]:
parentClassName,
}
) }
/>
Expand All @@ -65,7 +66,8 @@ const Block = ( props ) => {
colorProps.className,
`wc-block-components-product-summary`,
{
[ `${ parentClassName }__product-summary` ]: parentClassName,
[ `${ parentClassName }__product-summary` ]:
parentClassName,
}
) }
source={ source }
Expand Down
3 changes: 2 additions & 1 deletion assets/js/atomic/blocks/product-elements/tag-list/block.js
Expand Up @@ -45,7 +45,8 @@ const Block = ( props ) => {
colorProps.className,
'wc-block-components-product-tag-list',
{
[ `${ parentClassName }__product-tag-list` ]: parentClassName,
[ `${ parentClassName }__product-tag-list` ]:
parentClassName,
}
) }
style={ { ...colorProps.style, ...typographyProps.style } }
Expand Down
6 changes: 4 additions & 2 deletions assets/js/atomic/blocks/product-elements/title/block.tsx
Expand Up @@ -33,7 +33,8 @@ interface TagNameProps extends HTMLAttributes< HTMLOrSVGElement > {
const TagName = ( {
children,
headingLevel,
elementType: ElementType = `h${ headingLevel }` as keyof JSX.IntrinsicElements,
elementType:
ElementType = `h${ headingLevel }` as keyof JSX.IntrinsicElements,
...props
}: TagNameProps ): JSX.Element => {
return <ElementType { ...props }>{ children }</ElementType>;
Expand Down Expand Up @@ -77,7 +78,8 @@ export const Block = ( props: Props ): JSX.Element => {
colorProps.className,
'wc-block-components-product-title',
{
[ `${ parentClassName }__product-title` ]: parentClassName,
[ `${ parentClassName }__product-title` ]:
parentClassName,
[ `wc-block-components-product-title--align-${ align }` ]:
align && isFeaturePluginBuild(),
}
Expand Down
Expand Up @@ -78,20 +78,17 @@ interface AddressFormProps {
*/
const AddressForm = ( {
id = '',
fields = ( Object.keys(
fields = Object.keys(
defaultAddressFields
) as unknown ) as ( keyof AddressFields )[],
) as unknown as ( keyof AddressFields )[],
fieldConfig = {} as Record< keyof AddressFields, Partial< AddressField > >,
instanceId,
onChange,
type = 'shipping',
values,
}: AddressFormProps ): JSX.Element => {
const {
getValidationError,
setValidationErrors,
clearValidationError,
} = useValidationContext();
const { getValidationError, setValidationErrors, clearValidationError } =
useValidationContext();

const currentFields = useShallowEqual( fields );

Expand Down
Expand Up @@ -81,11 +81,8 @@ const inputAddress = async ( {

describe( 'AddressForm Component', () => {
const WrappedAddressForm = ( { type } ) => {
const {
defaultAddressFields,
setShippingAddress,
shippingAddress,
} = useCheckoutAddress();
const { defaultAddressFields, setShippingAddress, shippingAddress } =
useCheckoutAddress();

return (
<AddressForm
Expand Down
3 changes: 2 additions & 1 deletion assets/js/base/components/cart-checkout/form-step/index.tsx
Expand Up @@ -64,7 +64,8 @@ const FormStep = ( {
className,
'wc-block-components-checkout-step',
{
'wc-block-components-checkout-step--with-step-number': showStepNumber,
'wc-block-components-checkout-step--with-step-number':
showStepNumber,
'wc-block-components-checkout-step--disabled': disabled,
}
) }
Expand Down
Expand Up @@ -25,10 +25,8 @@ const ShippingCalculatorAddress = ( {
addressFields,
}: ShippingCalculatorAddressProps ): JSX.Element => {
const [ address, setAddress ] = useState( initialAddress );
const {
hasValidationErrors,
showAllValidationErrors,
} = useValidationContext();
const { hasValidationErrors, showAllValidationErrors } =
useValidationContext();

const validateSubmit = () => {
showAllValidationErrors();
Expand Down
Expand Up @@ -62,12 +62,8 @@ const PackageRates = ( {
);
}

const {
label,
secondaryLabel,
description,
secondaryDescription,
} = renderOption( rates[ 0 ] );
const { label, secondaryLabel, description, secondaryDescription } =
renderOption( rates[ 0 ] );

return (
<RadioControlOptionLayout
Expand Down
Expand Up @@ -21,8 +21,7 @@ const NZD: Currency = {
};

export default {
title:
'WooCommerce Blocks/@base-components/cart-checkout/totals/FooterItem',
title: 'WooCommerce Blocks/@base-components/cart-checkout/totals/FooterItem',
component: FooterItem,
args: {
currency: NZD,
Expand Down
Expand Up @@ -131,9 +131,8 @@ export const TotalsShipping = ( {
isCheckout = false,
className,
}: TotalShippingProps ): ReactElement => {
const [ isShippingCalculatorOpen, setIsShippingCalculatorOpen ] = useState(
false
);
const [ isShippingCalculatorOpen, setIsShippingCalculatorOpen ] =
useState( false );
const {
shippingAddress,
cartHasCalculatedShipping,
Expand Down
10 changes: 4 additions & 6 deletions assets/js/base/components/combobox/index.tsx
Expand Up @@ -55,11 +55,8 @@ const Combobox = ( {
instanceId = '0',
autoComplete = 'off',
}: ComboboxProps ): JSX.Element => {
const {
getValidationError,
setValidationErrors,
clearValidationError,
} = useValidationContext();
const { getValidationError, setValidationErrors, clearValidationError } =
useValidationContext();

const controlRef = useRef< HTMLDivElement >( null );
const controlId = id || 'control-' + instanceId;
Expand Down Expand Up @@ -126,7 +123,8 @@ const Combobox = ( {
}

// Try to match.
const normalizedFilterValue = filterValue.toLocaleUpperCase();
const normalizedFilterValue =
filterValue.toLocaleUpperCase();
const foundOption = options.find(
( option ) =>
option.label
Expand Down
3 changes: 2 additions & 1 deletion assets/js/base/components/country-input/country-input.tsx
Expand Up @@ -64,7 +64,8 @@ export const CountryInput = ( {
autoComplete={ autoComplete }
value={ value }
onChange={ ( event ) => {
const textValue = event.target.value.toLocaleUpperCase();
const textValue =
event.target.value.toLocaleUpperCase();
const foundOption = options.find(
( option ) =>
( textValue.length !== 2 &&
Expand Down
6 changes: 2 additions & 4 deletions assets/js/base/components/country-input/stories/index.tsx
Expand Up @@ -44,10 +44,8 @@ const Template: Story< CountryInputWithCountriesProps > = ( args ) => {
const [ selectedCountry, selectCountry ] = useState< CountryCode | '' >(
''
);
const {
clearValidationError,
showValidationError,
} = useValidationContext();
const { clearValidationError, showValidationError } =
useValidationContext();

useEffect( () => {
showValidationError( 'country' );
Expand Down
9 changes: 6 additions & 3 deletions assets/js/base/components/drawer/index.tsx
Expand Up @@ -46,9 +46,12 @@ const Drawer = ( {
overlayClassName={ classNames(
'wc-block-components-drawer__screen-overlay',
{
'wc-block-components-drawer__screen-overlay--is-hidden': ! isOpen,
'wc-block-components-drawer__screen-overlay--with-slide-in': slideIn,
'wc-block-components-drawer__screen-overlay--with-slide-out': slideOut,
'wc-block-components-drawer__screen-overlay--is-hidden':
! isOpen,
'wc-block-components-drawer__screen-overlay--with-slide-in':
slideIn,
'wc-block-components-drawer__screen-overlay--with-slide-out':
slideOut,
}
) }
closeButtonLabel={ __(
Expand Down

0 comments on commit 0c4f115

Please sign in to comment.