Fix js package lint errors

This commit is contained in:
Chi-Hsuan Huang 2022-03-28 11:14:09 +08:00
parent 2c5c7549b5
commit d45606293c
4 changed files with 33 additions and 44 deletions

View File

@ -47,7 +47,7 @@ async function deactivateAndDeletePlugin( pluginName: string ) {
}
export async function deactivateAndDeleteAllPlugins( except: string[] = [] ) {
let plugins = await getPlugins();
let skippedPlugins = [];
const skippedPlugins = [];
const promises = [];
for ( const plugin of plugins ) {
const splitPluginName = plugin.plugin.split( '/' );

View File

@ -18,7 +18,9 @@ export class ThemeSection extends BasePage {
const title = await waitForElementByText( 'h2', themeTitle );
const chooseButton = await title?.evaluateHandle( ( element ) => {
const card = element.closest( '.components-card' );
return Array.from( card?.querySelectorAll('button') || [] ).find( el => el.textContent === 'Choose');
return Array.from( card?.querySelectorAll( 'button' ) || [] ).find(
( el ) => el.textContent === 'Choose'
);
} );
if ( chooseButton ) {
await chooseButton.asElement()?.click();

View File

@ -12,56 +12,44 @@ const { options: babelDefaultConfig } = babel.loadPartialConfig( {
} );
const plugins = babelDefaultConfig.plugins;
if ( ! process.env.SKIP_JSX_PRAGMA_TRANSFORM ) {
plugins.push( [ '@wordpress/babel-plugin-import-jsx-pragma', {
scopeVariable: 'createElement',
source: '@wordpress/element',
isDefault: false,
} ] );
plugins.push( [
'@wordpress/babel-plugin-import-jsx-pragma',
{
scopeVariable: 'createElement',
source: '@wordpress/element',
isDefault: false,
},
] );
}
const overrideOptions = ( target, targetName, options ) => {
if ( get( target, [ 'file', 'request' ] ) === targetName ) {
return [ targetName, Object.assign(
{},
target.options,
options
) ];
return [ targetName, Object.assign( {}, target.options, options ) ];
}
return target;
};
const babelConfigs = {
main: Object.assign(
{},
babelDefaultConfig,
{
plugins,
presets: map(
babelDefaultConfig.presets,
( preset ) => overrideOptions( preset, '@babel/preset-env', {
modules: 'commonjs',
} )
),
}
),
module: Object.assign(
{},
babelDefaultConfig,
{
plugins: map(
plugins,
( plugin ) => overrideOptions( plugin, '@babel/plugin-transform-runtime', {
useESModules: true,
} )
),
presets: map(
babelDefaultConfig.presets,
( preset ) => overrideOptions( preset, '@babel/preset-env', {
modules: false,
} )
),
}
),
main: Object.assign( {}, babelDefaultConfig, {
plugins,
presets: map( babelDefaultConfig.presets, ( preset ) =>
overrideOptions( preset, '@babel/preset-env', {
modules: 'commonjs',
} )
),
} ),
module: Object.assign( {}, babelDefaultConfig, {
plugins: map( plugins, ( plugin ) =>
overrideOptions( plugin, '@babel/plugin-transform-runtime', {
useESModules: true,
} )
),
presets: map( babelDefaultConfig.presets, ( preset ) =>
overrideOptions( preset, '@babel/preset-env', {
modules: false,
} )
),
} ),
};
function getBabelConfig( environment ) {

View File

@ -26,7 +26,6 @@ const getRequestQueryString = ( {
* args.experimentName = 'my-experiment';
* return args;
* });
*
*/
return stringify(
applyFilters( 'woocommerce_explat_request_args', {