* Add type to imports that need it

* Add type to imports that need it

* Fix the sanitize lint error

* Include missing dep

* Remove check from deps

* bot: update checkstyle.xml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Alba Rincón 2022-11-02 17:46:14 +01:00 committed by GitHub
parent a79bfba32c
commit 6ca9f90c44
35 changed files with 41 additions and 41 deletions

View File

@ -5,7 +5,7 @@
"/**", "/**",
" * External dependencies", " * External dependencies",
" */", " */",
"import { Story, Meta } from '@storybook/react';", "import type { Story, Meta } from '@storybook/react';",
"", "",
"/**", "/**",
" * Internal dependencies", " * Internal dependencies",

View File

@ -3,7 +3,7 @@
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor'; import { useBlockProps } from '@wordpress/block-editor';
import { BlockEditProps } from '@wordpress/blocks'; import type { BlockEditProps } from '@wordpress/blocks';
import { useEffect } from 'react'; import { useEffect } from 'react';
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types'; import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { useArgs } from '@storybook/client-api'; import { useArgs } from '@storybook/client-api';
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { INTERACTION_TIMEOUT } from '@woocommerce/storybook-controls'; import { INTERACTION_TIMEOUT } from '@woocommerce/storybook-controls';
import { useDispatch } from '@wordpress/data'; import { useDispatch } from '@wordpress/data';
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data'; import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { useArgs } from '@storybook/client-api'; import { useArgs } from '@storybook/client-api';
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { import {
currenciesAPIShape as currencies, currenciesAPIShape as currencies,
currencyControl, currencyControl,

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { allSettings } from '@woocommerce/settings'; import { allSettings } from '@woocommerce/settings';
import { Currency } from '@woocommerce/types'; import { Currency } from '@woocommerce/types';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { useDispatch } from '@wordpress/data'; import { useDispatch } from '@wordpress/data';
import { useState, useEffect } from '@wordpress/element'; import { useState, useEffect } from '@wordpress/element';
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data'; import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
/** /**

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
import { currencies, currencyControl } from '@woocommerce/storybook-controls'; import { currencies, currencyControl } from '@woocommerce/storybook-controls';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { currencyControl } from '@woocommerce/storybook-controls'; import { currencyControl } from '@woocommerce/storybook-controls';
/** /**

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { useArgs } from '@storybook/client-api'; import { useArgs } from '@storybook/client-api';
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -3,7 +3,7 @@
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { InspectorControls, useBlockProps } from '@wordpress/block-editor'; import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
import { BlockEditProps } from '@wordpress/blocks'; import type { BlockEditProps } from '@wordpress/blocks';
import BlockTitle from '@woocommerce/editor-components/block-title'; import BlockTitle from '@woocommerce/editor-components/block-title';
import { import {
Disabled, Disabled,

View File

@ -4,7 +4,7 @@
import { InspectorControls } from '@wordpress/block-editor'; import { InspectorControls } from '@wordpress/block-editor';
import { PanelBody, ToggleControl } from '@wordpress/components'; import { PanelBody, ToggleControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { BlockAttributes } from '@wordpress/blocks'; import type { BlockAttributes } from '@wordpress/blocks';
export const BlockSettings = ( { export const BlockSettings = ( {
attributes, attributes,

View File

@ -69,7 +69,12 @@ const Block = ( {
setBillingAddress( shippingAddress ); setBillingAddress( shippingAddress );
} }
setAddressesSynced( true ); setAddressesSynced( true );
}, [ setBillingAddress, shippingAddress, useShippingAsBilling ] ); }, [
addressesSynced,
setBillingAddress,
shippingAddress,
useShippingAsBilling,
] );
const addressFieldsConfig = useMemo( () => { const addressFieldsConfig = useMemo( () => {
return { return {

View File

@ -2,12 +2,12 @@
* External dependencies * External dependencies
*/ */
import { import {
BlockEditProps,
createBlock, createBlock,
getBlockType, getBlockType,
registerBlockType, registerBlockType,
unregisterBlockType, unregisterBlockType,
} from '@wordpress/blocks'; } from '@wordpress/blocks';
import type { BlockEditProps } from '@wordpress/blocks';
import { import {
isExperimentalBuild, isExperimentalBuild,
WC_BLOCKS_IMAGE_URL, WC_BLOCKS_IMAGE_URL,

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Block } from '@wordpress/blocks'; import type { Block } from '@wordpress/blocks';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { BlockAlignment } from '@wordpress/blocks'; import type { BlockAlignment } from '@wordpress/blocks';
export interface Attributes { export interface Attributes {
align?: BlockAlignment; align?: BlockAlignment;

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Block } from '@wordpress/blocks'; import type { Block } from '@wordpress/blocks';
import { addFilter } from '@wordpress/hooks'; import { addFilter } from '@wordpress/hooks';
/** /**

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { BlockAlignment } from '@wordpress/blocks'; import type { BlockAlignment } from '@wordpress/blocks';
export interface Attributes { export interface Attributes {
align?: BlockAlignment; align?: BlockAlignment;

View File

@ -232,12 +232,7 @@ const StockStatusFilterBlock = ( {
updateFilterUrl( checkedOptions ); updateFilterUrl( checkedOptions );
}, },
[ [ isEditor, setProductStockStatusQuery, filteringForPhpTemplate ]
isEditor,
setProductStockStatusQuery,
checked,
filteringForPhpTemplate,
]
); );
// Track checked STATE changes - if state changes, update the query. // Track checked STATE changes - if state changes, update the query.

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { useArgs } from '@storybook/client-api'; import { useArgs } from '@storybook/client-api';
import { INTERACTION_TIMEOUT } from '@woocommerce/storybook-controls'; import { INTERACTION_TIMEOUT } from '@woocommerce/storybook-controls';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { omitBy } from 'lodash'; import { omitBy } from 'lodash';
import { Story } from '@storybook/react'; import type { Story } from '@storybook/react';
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
import { Icon } from '@wordpress/icons'; import { Icon } from '@wordpress/icons';

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { sanitize } from 'dompurify'; import DOMPurify from 'dompurify';
const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p', 'br' ]; const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p', 'br' ];
const ALLOWED_ATTR = [ 'target', 'href', 'rel', 'name', 'download' ]; const ALLOWED_ATTR = [ 'target', 'href', 'rel', 'name', 'download' ];
@ -13,7 +13,7 @@ export const sanitizeHTML = (
const tagsValue = config?.tags || ALLOWED_TAGS; const tagsValue = config?.tags || ALLOWED_TAGS;
const attrValue = config?.attr || ALLOWED_ATTR; const attrValue = config?.attr || ALLOWED_ATTR;
return sanitize( html, { return DOMPurify.sanitize( html, {
ALLOWED_TAGS: tagsValue, ALLOWED_TAGS: tagsValue,
ALLOWED_ATTR: attrValue, ALLOWED_ATTR: attrValue,
} ); } );

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
/** /**
* Internal dependencies * Internal dependencies

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { import {
currenciesAPIShape, currenciesAPIShape,
currencies, currencies,

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls'; import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/** /**

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls'; import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/** /**

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import { currencies, currencyControl } from '@woocommerce/storybook-controls'; import { currencies, currencyControl } from '@woocommerce/storybook-controls';
/** /**

View File

@ -38,7 +38,7 @@ Let's see the code in detail.
This is the minimal scaffold you need for your new Story: This is the minimal scaffold you need for your new Story:
```tsx ```tsx
import { Story, Meta } from '@storybook/react'; import type { Story, Meta } from '@storybook/react';
import MyComponent, { MyComponentProps } from '..'; import MyComponent, { MyComponentProps } from '..';
export default { export default {