diff --git a/babel.config.js b/babel.config.js index e49b7082665..14d7902c654 100644 --- a/babel.config.js +++ b/babel.config.js @@ -7,6 +7,10 @@ module.exports = { env: { production: { plugins: [ + [ + 'react-remove-properties', + { properties: [ 'data-wcpay-bundled-wp-component' ] }, + ], [ '@wordpress/babel-plugin-makepot', { diff --git a/client/components/wp-components-wrapped/make-wrapped-component.tsx b/client/components/wp-components-wrapped/make-wrapped-component.tsx index 5858d603e98..f4f16fc56ca 100644 --- a/client/components/wp-components-wrapped/make-wrapped-component.tsx +++ b/client/components/wp-components-wrapped/make-wrapped-component.tsx @@ -23,8 +23,14 @@ export const makeWrappedComponent = < const context = useContext( WordPressComponentsContext ); if ( ! context || useBundledComponent ) { - // @ts-expect-error: the type of props is not always well-defined, ignoring the error. - return ; + return ( + // @ts-expect-error: the type of props is not always well-defined, ignoring the error. + + ); } const ContextComponent = context[ diff --git a/client/settings/card-body/index.tsx b/client/settings/card-body/index.tsx index 7b17b3f4ba9..4800d0a759a 100644 --- a/client/settings/card-body/index.tsx +++ b/client/settings/card-body/index.tsx @@ -2,7 +2,8 @@ * External dependencies */ import React, { useContext } from 'react'; -import { CardBody as BundledWordPressComponentsCardBody } from 'wcpay/components/wp-components-wrapped'; +// eslint-disable-next-line no-restricted-syntax +import { CardBody as BundledWordPressComponentsCardBody } from '@wordpress/components'; import clsx from 'clsx'; /** @@ -27,6 +28,7 @@ const WcpayCardBody: React.FC< React.PropsWithChildren< ); } diff --git a/package-lock.json b/package-lock.json index 40deb2e228d..dc262a70ecd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,6 +83,7 @@ "archiver": "5.2.0", "babel-eslint": "10.1.0", "babel-loader": "8.2.2", + "babel-plugin-react-remove-properties": "0.3.0", "chalk": "4.1.2", "clsx": "2.1.1", "config": "3.3.6", @@ -19372,6 +19373,12 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/babel-plugin-react-remove-properties": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-react-remove-properties/-/babel-plugin-react-remove-properties-0.3.0.tgz", + "integrity": "sha512-vbxegtXGyVcUkCvayLzftU95vuvpYFV85pRpeMpohMHeEY46Qe0VNWfkVVcCbaZ12CXHzDFOj0esumATcW83ng==", + "dev": true + }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", diff --git a/package.json b/package.json index 09de9b02f50..efa86e57017 100644 --- a/package.json +++ b/package.json @@ -149,6 +149,7 @@ "archiver": "5.2.0", "babel-eslint": "10.1.0", "babel-loader": "8.2.2", + "babel-plugin-react-remove-properties": "0.3.0", "chalk": "4.1.2", "clsx": "2.1.1", "config": "3.3.6",