From 3980ff3226cf3d2180c346c3396a573d6b39e63a Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Mon, 13 May 2024 21:59:30 +0200 Subject: [PATCH] Fix lints --- packages/interactivity/src/directives.js | 16 +++++++--------- packages/interactivity/src/vdom.ts | 7 +------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/interactivity/src/directives.js b/packages/interactivity/src/directives.js index c09cecb4afc127..b77a7da02a52a3 100644 --- a/packages/interactivity/src/directives.js +++ b/packages/interactivity/src/directives.js @@ -242,15 +242,13 @@ export default () => { if ( defaultEntry ) { const { namespace, value } = defaultEntry; // Check that the value is a JSON object. Send a console warning if not. - if ( - typeof SCRIPT_DEBUG !== 'undefined' && - SCRIPT_DEBUG === true && - ! isPlainObject( value ) - ) { - // eslint-disable-next-line no-console - console.warn( - `The value of data-wp-context in "${ namespace }" store must be a valid stringified JSON object.` - ); + if ( globalThis.SCRIPT_DEBUG ) { + if ( ! isPlainObject( value ) ) { + // eslint-disable-next-line no-console + console.warn( + `The value of data-wp-context in "${ namespace }" store must be a valid stringified JSON object.` + ); + } } updateSignals( currentValue.current, { [ namespace ]: deepClone( value ), diff --git a/packages/interactivity/src/vdom.ts b/packages/interactivity/src/vdom.ts index 9e6221bb871f4f..171557d7a014fe 100644 --- a/packages/interactivity/src/vdom.ts +++ b/packages/interactivity/src/vdom.ts @@ -120,12 +120,7 @@ export function toVdom( root ) { ( obj, [ name, ns, value ] ) => { const directiveMatch = directiveParser.exec( name ); if ( directiveMatch === null ) { - if ( - // @ts-expect-error This is a debug-only warning. - typeof SCRIPT_DEBUG !== 'undefined' && - // @ts-expect-error This is a debug-only warning. - SCRIPT_DEBUG === true - ) { + if ( globalThis.SCRIPT_DEBUG ) { // eslint-disable-next-line no-console console.warn( `Invalid directive: ${ name }.` ); }