Fix ESLint errors (https://github.com/woocommerce/woocommerce-blocks/pull/7556)
* 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:
parent
a79bfba32c
commit
6ca9f90c44
|
@ -5,7 +5,7 @@
|
|||
"/**",
|
||||
" * External dependencies",
|
||||
" */",
|
||||
"import { Story, Meta } from '@storybook/react';",
|
||||
"import type { Story, Meta } from '@storybook/react';",
|
||||
"",
|
||||
"/**",
|
||||
" * Internal dependencies",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
import { BlockEditProps } from '@wordpress/blocks';
|
||||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import { useEffect } from 'react';
|
||||
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
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 { useDispatch } from '@wordpress/data';
|
||||
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useArgs } from '@storybook/client-api';
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import {
|
||||
currenciesAPIShape as currencies,
|
||||
currencyControl,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { allSettings } from '@woocommerce/settings';
|
||||
import { Currency } from '@woocommerce/types';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { useDispatch } from '@wordpress/data';
|
||||
import { useState, useEffect } from '@wordpress/element';
|
||||
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { useState } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { currencyControl } from '@woocommerce/storybook-controls';
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useArgs } from '@storybook/client-api';
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
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 {
|
||||
Disabled,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { InspectorControls } from '@wordpress/block-editor';
|
||||
import { PanelBody, ToggleControl } from '@wordpress/components';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { BlockAttributes } from '@wordpress/blocks';
|
||||
import type { BlockAttributes } from '@wordpress/blocks';
|
||||
|
||||
export const BlockSettings = ( {
|
||||
attributes,
|
||||
|
|
|
@ -69,7 +69,12 @@ const Block = ( {
|
|||
setBillingAddress( shippingAddress );
|
||||
}
|
||||
setAddressesSynced( true );
|
||||
}, [ setBillingAddress, shippingAddress, useShippingAsBilling ] );
|
||||
}, [
|
||||
addressesSynced,
|
||||
setBillingAddress,
|
||||
shippingAddress,
|
||||
useShippingAsBilling,
|
||||
] );
|
||||
|
||||
const addressFieldsConfig = useMemo( () => {
|
||||
return {
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
BlockEditProps,
|
||||
createBlock,
|
||||
getBlockType,
|
||||
registerBlockType,
|
||||
unregisterBlockType,
|
||||
} from '@wordpress/blocks';
|
||||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import {
|
||||
isExperimentalBuild,
|
||||
WC_BLOCKS_IMAGE_URL,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Block } from '@wordpress/blocks';
|
||||
import type { Block } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { BlockAlignment } from '@wordpress/blocks';
|
||||
import type { BlockAlignment } from '@wordpress/blocks';
|
||||
|
||||
export interface Attributes {
|
||||
align?: BlockAlignment;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Block } from '@wordpress/blocks';
|
||||
import type { Block } from '@wordpress/blocks';
|
||||
import { addFilter } from '@wordpress/hooks';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { BlockAlignment } from '@wordpress/blocks';
|
||||
import type { BlockAlignment } from '@wordpress/blocks';
|
||||
|
||||
export interface Attributes {
|
||||
align?: BlockAlignment;
|
||||
|
|
|
@ -232,12 +232,7 @@ const StockStatusFilterBlock = ( {
|
|||
|
||||
updateFilterUrl( checkedOptions );
|
||||
},
|
||||
[
|
||||
isEditor,
|
||||
setProductStockStatusQuery,
|
||||
checked,
|
||||
filteringForPhpTemplate,
|
||||
]
|
||||
[ isEditor, setProductStockStatusQuery, filteringForPhpTemplate ]
|
||||
);
|
||||
|
||||
// Track checked STATE changes - if state changes, update the query.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { useArgs } from '@storybook/client-api';
|
||||
import { INTERACTION_TIMEOUT } from '@woocommerce/storybook-controls';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { omitBy } from 'lodash';
|
||||
import { Story } from '@storybook/react';
|
||||
import type { Story } from '@storybook/react';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { Icon } from '@wordpress/icons';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { sanitize } from 'dompurify';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p', 'br' ];
|
||||
const ALLOWED_ATTR = [ 'target', 'href', 'rel', 'name', 'download' ];
|
||||
|
@ -13,7 +13,7 @@ export const sanitizeHTML = (
|
|||
const tagsValue = config?.tags || ALLOWED_TAGS;
|
||||
const attrValue = config?.attr || ALLOWED_ATTR;
|
||||
|
||||
return sanitize( html, {
|
||||
return DOMPurify.sanitize( html, {
|
||||
ALLOWED_TAGS: tagsValue,
|
||||
ALLOWED_ATTR: attrValue,
|
||||
} );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import {
|
||||
currenciesAPIShape,
|
||||
currencies,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import { currencies, currencyControl } from '@woocommerce/storybook-controls';
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@ Let's see the code in detail.
|
|||
This is the minimal scaffold you need for your new Story:
|
||||
|
||||
```tsx
|
||||
import { Story, Meta } from '@storybook/react';
|
||||
import type { Story, Meta } from '@storybook/react';
|
||||
import MyComponent, { MyComponentProps } from '..';
|
||||
|
||||
export default {
|
||||
|
|
Loading…
Reference in New Issue