+
{ category.label }
) : (
diff --git a/src/animation/editor.js b/src/animation/editor.js
index c66843523..c23c58d3d 100644
--- a/src/animation/editor.js
+++ b/src/animation/editor.js
@@ -7,22 +7,22 @@ import {
Button,
PanelBody,
SelectControl,
- ToggleControl
+ ToggleControl,
+ __experimentalUnitControl as UnitControl
} from '@wordpress/components';
import {
Fragment,
useState,
- useEffect
+ useEffect,
+ memo
} from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';
-import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
-
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import {
animationsList,
delayList,
@@ -44,17 +44,16 @@ const AnimationType = {
default: 'default'
};
-import { memo } from '@wordpress/element';
import { useCSSNode } from '../blocks/helpers/block-utility.js';
/**
* Update the animation config.
*
- * @param {string} type The type of animation. (e.g. count, typing, default)
- * @param {string|undefined} oldValue The old value of the animation.
- * @param {string|undefined} newValue The new value of the animation.
- * @param {Function|undefined} callback The callback function which will be called after the animation is updated.
- * @param {Object} attributes The attributes of the block.
+ * @param {string} type The type of animation. (e.g. count, typing, default)
+ * @param {string|undefined} oldValue The old value of the animation.
+ * @param {string|undefined} newValue The new value of the animation.
+ * @param {Function|undefined} callback The callback function which will be called after the animation is updated.
+ * @param {Object} attributes The attributes of the block.
* @param {(x: Object) => void} setAttributes The setAttributes function of the block.
*/
export const updateAnimConfig = ( type, oldValue, newValue, callback, attributes, setAttributes ) => {
@@ -136,7 +135,7 @@ function AnimationControls({
const updateAnimation = ( e ) => {
let classes;
- let animationValue = 'none' !== e ? e : '';
+ const animationValue = 'none' !== e ? e : '';
if ( attributes.className ) {
classes = attributes.className;
@@ -179,7 +178,7 @@ function AnimationControls({
setAnimation( e );
setAttributes({ className: classes });
- let block = document.querySelector( `#block-${ clientId } .animated` ) || document.querySelector( `#block-${ clientId }.animated` );
+ const block = document.querySelector( `#block-${ clientId } .animated` ) || document.querySelector( `#block-${ clientId }.animated` );
if ( block ) {
outAnimation.forEach( ( i ) => {
diff --git a/src/animation/frontend.js b/src/animation/frontend.js
index 0025671f0..614a2ac6c 100644
--- a/src/animation/frontend.js
+++ b/src/animation/frontend.js
@@ -272,7 +272,7 @@ const animateElements = () => {
};
const isElementInViewport = ( el ) => {
- let scroll = window.scrollY || window.pageYOffset;
+ const scroll = window.scrollY || window.pageYOffset;
const offset = calculateOffset( getTriggerOffset( el ) );
const boundsTop = el.getBoundingClientRect().top + scroll + offset;
diff --git a/src/animation/frontend/count/index.js b/src/animation/frontend/count/index.js
index 7ebbc74aa..c510ce8be 100644
--- a/src/animation/frontend/count/index.js
+++ b/src/animation/frontend/count/index.js
@@ -19,10 +19,10 @@ const speedConfig = {
/**
* Get the configuration option from the element CSS classes.
* @param {HTMLDivElement} elem
- * @returns Configuration options.
+ * @return Configuration options.
*/
const getConfiguration = ( elem ) => {
- let parent = elem.parentElement;
+ const parent = elem.parentElement;
for ( let i = 0; i < MAX_PARENT_SEARCH; ++i ) {
if ( Array.from( parent.classList ).some( o => o.includes( 'o-count-' ) ) ) {
const arr = Array.from( parent.classList );
@@ -52,7 +52,7 @@ const NUMBER_EXTRA_FORMAT = new Set( Array.from( ',' ) );
/**
* Extract the number, prefix, and suffix.
* @param {string} text The selected text
- * @returns An object with the number, prefix and suffix
+ * @return An object with the number, prefix and suffix
*/
const extract = ( text ) => {
const arr = Array.from( text );
@@ -64,7 +64,7 @@ const extract = ( text ) => {
let isPrefix = true;
let isSuffix = false;
- for ( let x of arr ) {
+ for ( const x of arr ) {
if ( NUMERIC_FORMATS.has( x ) ) {
if ( isPrefix ) {
isPrefix = false;
@@ -76,15 +76,13 @@ const extract = ( text ) => {
} else {
number.push( x );
}
+ } else if ( isPrefix ) {
+ prefix.push( x );
} else {
- if ( isPrefix ) {
- prefix.push( x );
- } else {
- if ( ! isSuffix ) {
- isSuffix = true;
- }
- suffix.push( x );
+ if ( ! isSuffix ) {
+ isSuffix = true;
}
+ suffix.push( x );
}
}
diff --git a/src/animation/frontend/typing/index.js b/src/animation/frontend/typing/index.js
index cd4fae4fd..381c99e59 100644
--- a/src/animation/frontend/typing/index.js
+++ b/src/animation/frontend/typing/index.js
@@ -22,10 +22,10 @@ const speedConfig = {
/**
* Get the configuration option from the element CSS classes.
* @param {HTMLDivElement} elem
- * @returns Configuration options.
+ * @return Configuration options.
*/
const getConfiguration = ( elem ) => {
- let parent = elem.parentElement;
+ const parent = elem.parentElement;
for ( let i = 0; i < MAX_PARENT_SEARCH; ++i ) {
if ( Array.from( parent.classList ).some( o => o.includes( 'o-typing-' ) ) ) {
const arr = Array.from( parent.classList );
diff --git a/src/animation/index.js b/src/animation/index.js
index a80ae6971..b21fea478 100644
--- a/src/animation/index.js
+++ b/src/animation/index.js
@@ -18,8 +18,8 @@ import { addFilter } from '@wordpress/hooks';
import { select } from '@wordpress/data';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import './editor.scss';
import Edit from './editor.js';
diff --git a/src/animation/utils.js b/src/animation/utils.js
index 018f5ae1d..edb3e12a2 100644
--- a/src/animation/utils.js
+++ b/src/animation/utils.js
@@ -1,8 +1,8 @@
/**
* Create utility functions for an interval timer.
- * @param {number} duration The duration, in seconds.
+ * @param {number} duration The duration, in seconds.
* @param {number} deltaTime The time between two time ticks, in seconds.
- * @returns Utility functions.
+ * @return Utility functions.
*/
export const makeInterval = ( duration, deltaTime ) => {
@@ -21,7 +21,7 @@ export const makeInterval = ( duration, deltaTime ) => {
/**
* Start the interval. Get a callback function that execute at every tick and the one that execute at the end.
- * @param {Function} callback Function that execute at every tick.
+ * @param {Function} callback Function that execute at every tick.
* @param {Function} endCallback Function that execute at the end.
*/
const start = ( callback, endCallback ) => {
@@ -45,7 +45,7 @@ export const makeInterval = ( duration, deltaTime ) => {
/**
* Specify a function to execute when the DOM is fully loaded.
*
- * @param {Callback} callback A function to execute after the DOM is ready.
+ * @param {()=>{}} callback A function to execute after the DOM is ready.
* @return {void}
*/
export const domReady = ( callback ) => {
diff --git a/src/blocks/blocks/accordion/group/edit.js b/src/blocks/blocks/accordion/group/edit.js
index a1096d140..5399ca46a 100644
--- a/src/blocks/blocks/accordion/group/edit.js
+++ b/src/blocks/blocks/accordion/group/edit.js
@@ -42,7 +42,7 @@ const PREFIX_TO_FAMILY = {
/**
* Accordion Group component
* @param {import('./types').AccordionGroupProps} props
- * @returns
+ * @return
*/
const Edit = ({
name,
diff --git a/src/blocks/blocks/accordion/group/inspector.js b/src/blocks/blocks/accordion/group/inspector.js
index 4029e35c0..efc7a6c48 100644
--- a/src/blocks/blocks/accordion/group/inspector.js
+++ b/src/blocks/blocks/accordion/group/inspector.js
@@ -72,7 +72,7 @@ const gapCompatibility = {
/**
*
* @param {import('./types.js').AccordionGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
clientId,
@@ -137,7 +137,7 @@ const Inspector = ({
const changeBoxShadow = data => {
const boxShadow = { ...attributes.boxShadow };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
diff --git a/src/blocks/blocks/accordion/item/edit.js b/src/blocks/blocks/accordion/item/edit.js
index 2eec9702c..221a4e8f7 100644
--- a/src/blocks/blocks/accordion/item/edit.js
+++ b/src/blocks/blocks/accordion/item/edit.js
@@ -28,7 +28,7 @@ import { select } from '@wordpress/data';
/**
* Accordion Item component
* @param {import('./types.js').AccordionItemProps} props
- * @returns
+ * @return
*/
const Edit = ({
clientId,
@@ -50,7 +50,7 @@ const Edit = ({
const parentClientId = select( 'core/block-editor' ).getBlockParents( clientId ).at( -1 );
const parentBlock = select( 'core/block-editor' ).getBlock( parentClientId );
- setAttributes({ title: __( 'Accordion item ', 'otter-blocks' ) + parentBlock.innerBlocks.length });
+ setAttributes({ title: __( 'Accordion item', 'otter-blocks' ) + parentBlock.innerBlocks.length });
}
}, []);
diff --git a/src/blocks/blocks/advanced-heading/edit.js b/src/blocks/blocks/advanced-heading/edit.js
index 66ec6b6be..2cfab5e84 100644
--- a/src/blocks/blocks/advanced-heading/edit.js
+++ b/src/blocks/blocks/advanced-heading/edit.js
@@ -45,7 +45,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Advanced Heading component
* @param {import('./types').AdvancedHeadingProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/advanced-heading/inspector.js b/src/blocks/blocks/advanced-heading/inspector.js
index 84796c726..4bde8e75e 100644
--- a/src/blocks/blocks/advanced-heading/inspector.js
+++ b/src/blocks/blocks/advanced-heading/inspector.js
@@ -65,7 +65,7 @@ const fieldMapping = {
/**
*
* @param {import('./types.js').AdvancedHeadingInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/button-group/button/edit.js b/src/blocks/blocks/button-group/button/edit.js
index 3def04c01..0361c8668 100644
--- a/src/blocks/blocks/button-group/button/edit.js
+++ b/src/blocks/blocks/button-group/button/edit.js
@@ -39,7 +39,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Button component
* @param {import('./types').ButtonGroupButtonProps} props
- * @returns
+ * @return
*/
const Edit = ( props ) => {
const {
diff --git a/src/blocks/blocks/button-group/button/inspector.js b/src/blocks/blocks/button-group/button/inspector.js
index 6d7520731..b85d8bbc9 100644
--- a/src/blocks/blocks/button-group/button/inspector.js
+++ b/src/blocks/blocks/button-group/button/inspector.js
@@ -54,7 +54,7 @@ const styles = [
/**
*
* @param {import('./types.js').ButtonGroupButtonInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -301,7 +301,7 @@ const Inspector = ({
label={ __( 'Background', 'otter-blocks' ) }
colorValue={ attributes.background }
gradientValue={ attributes.backgroundGradient }
- onColorChange={ background => setAttributes({ background: background })}
+ onColorChange={ background => setAttributes({ background })}
onGradientChange={ backgroundGradient => setAttributes({ backgroundGradient })}
className="is-list"
/>
diff --git a/src/blocks/blocks/button-group/group/controls.tsx b/src/blocks/blocks/button-group/group/controls.tsx
index 3e5d745ce..7d843cb48 100644
--- a/src/blocks/blocks/button-group/group/controls.tsx
+++ b/src/blocks/blocks/button-group/group/controls.tsx
@@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { AlignmentToolbar, BlockControls } from '@wordpress/block-editor';
+import { BlockControls } from '@wordpress/block-editor';
import { DropdownMenu, ToolbarGroup } from '@wordpress/components';
/**
* Internal dependencies
*/
-import { ButtonGroupInspectorProps } from './types';
+import type { ButtonGroupInspectorProps } from './types.d.ts';
import { useResponsiveAttributes } from '../../../helpers/utility-hooks';
import { alignCenter, alignLeft, alignRight, menu } from '@wordpress/icons';
diff --git a/src/blocks/blocks/button-group/group/deprecated.js b/src/blocks/blocks/button-group/group/deprecated.js
index 8e85d08e7..35d0de1c5 100644
--- a/src/blocks/blocks/button-group/group/deprecated.js
+++ b/src/blocks/blocks/button-group/group/deprecated.js
@@ -152,6 +152,7 @@ const deprecated = [{
padding: `${ attributes.data[i].paddingTopBottom }px ${ attributes.data[i].paddingLeftRight }px`
};
+ /* eslint-disable react/jsx-no-target-blank */
return (
);
+ /* eslint-enable react/jsx-no-target-blank */
};
return (
diff --git a/src/blocks/blocks/button-group/group/edit.js b/src/blocks/blocks/button-group/group/edit.js
index dc2a29315..54471c0bd 100644
--- a/src/blocks/blocks/button-group/group/edit.js
+++ b/src/blocks/blocks/button-group/group/edit.js
@@ -32,7 +32,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Button Group Props
* @param {import('./types').ButtonGroupProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/button-group/group/inspector.js b/src/blocks/blocks/button-group/group/inspector.js
index 222b37fc8..256a8e081 100644
--- a/src/blocks/blocks/button-group/group/inspector.js
+++ b/src/blocks/blocks/button-group/group/inspector.js
@@ -42,7 +42,7 @@ import { useTabSwitch } from '../../../helpers/block-utility';
/**
*
* @param {import('./types.js').ButtonGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/circle-counter/edit.js b/src/blocks/blocks/circle-counter/edit.js
index 0d5279d7b..c2e263bb8 100644
--- a/src/blocks/blocks/circle-counter/edit.js
+++ b/src/blocks/blocks/circle-counter/edit.js
@@ -37,7 +37,7 @@ const { attributes: defaultAttributes } = metadata;
/**
*
* @param {import('./types').CircleCounterPros} param0
- * @returns
+ * @return
*/
const CircularProgressBarBlock = ({
clientId,
diff --git a/src/blocks/blocks/circle-counter/inspector.js b/src/blocks/blocks/circle-counter/inspector.js
index 3cdccbd11..b87631231 100644
--- a/src/blocks/blocks/circle-counter/inspector.js
+++ b/src/blocks/blocks/circle-counter/inspector.js
@@ -27,14 +27,14 @@ import { Fragment, useState } from '@wordpress/element';
/**
* Internal dependencies
-*/
+ */
import { InspectorHeader } from '../../components';
import { useTabSwitch } from '../../helpers/block-utility';
/**
*
* @param {import('./types').CircleCounterInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/content-generator/edit.js b/src/blocks/blocks/content-generator/edit.js
index aa6c0f2d7..d357d0552 100644
--- a/src/blocks/blocks/content-generator/edit.js
+++ b/src/blocks/blocks/content-generator/edit.js
@@ -134,7 +134,7 @@ const ContentGenerator = ({
* When destroying the block, the original inner blocks are also destroyed, thus we need to make a copy of them when transferring them to another block.
*
* @param {import('../../helpers/blocks.js').BlockProps
} block The block to copy.
- * @returns {import('../../helpers/blocks.js').BlockProps} The copied block.
+ * @return {import('../../helpers/blocks.js').BlockProps|void} The copied block.
*/
const makeBlockCopy = ( block ) => {
if ( undefined === block ) {
@@ -185,7 +185,7 @@ const ContentGenerator = ({
const PRESETS = {
form: {
title: __( 'AI Form generator', 'otter-blocks' ),
- placeholder: __( 'Start describing what form you need...', 'otter-blocks' ),
+ placeholder: __( 'Start describing what form you need…', 'otter-blocks' ),
actions: ( props ) => {
return (
@@ -209,7 +209,7 @@ const ContentGenerator = ({
},
textTransformation: {
title: __( 'AI Content generator', 'otter-blocks' ),
- placeholder: __( 'Start describing what content you need...', 'otter-blocks' ),
+ placeholder: __( 'Start describing what content you need…', 'otter-blocks' ),
actions: ( props ) => {
return (
diff --git a/src/blocks/blocks/content-generator/inspector.js b/src/blocks/blocks/content-generator/inspector.js
index 948f8f815..7a88f8c77 100644
--- a/src/blocks/blocks/content-generator/inspector.js
+++ b/src/blocks/blocks/content-generator/inspector.js
@@ -8,7 +8,7 @@ import {
/**
*
* @param {import('./types').ContentGeneratorInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/countdown/common.ts b/src/blocks/blocks/countdown/common.ts
index bd52d0d94..56a533d11 100644
--- a/src/blocks/blocks/countdown/common.ts
+++ b/src/blocks/blocks/countdown/common.ts
@@ -1,4 +1,4 @@
-import { CountdownTimer } from './types';
+import type { CountdownTimer } from './types.d.ts';
import { __ } from '@wordpress/i18n';
const _MS_PER_SECONDS = 1000;
@@ -10,7 +10,7 @@ const _MS_PER_DAY = _MS_PER_HOURS * 24;
* Get the time from a timer structure
*
* @param timer The timer data strcture.
- * @returns The time in miliseconds
+ * @return The time in miliseconds
*/
export const toTimer = ( timer: CountdownTimer = {}): number => {
return ( parseInt( timer?.days || '0' ) * _MS_PER_DAY + parseInt( timer?.hours || '0' ) * _MS_PER_HOURS + parseInt( timer?.minutes || '0' ) * _MS_PER_MINUTES + parseInt( timer?.seconds || '0' ) * _MS_PER_SECONDS ) ?? 0;
@@ -20,8 +20,8 @@ export const toTimer = ( timer: CountdownTimer = {}): number => {
* Get the time interval from two dates.
*
* @param start The start date.
- * @param end The end date.
- * @returns
+ * @param end The end date.
+ * @return
*/
export const fromInterval = ( start?: string, end?: string ): number => {
if ( ! start || ! end ) {
@@ -36,9 +36,11 @@ export const fromInterval = ( start?: string, end?: string ): number => {
/**
* Get the time interval from the unix time
*
- * @param unixTime Time as UNIX
- * @param settings Options to keep a components or/and allow negative time
- * @returns An object with the values for days, hours, minutes, seconds
+ * @param unixTime Time as UNIX
+ * @param settings Options to keep a components or/and allow negative time
+ * @param settings.exclude
+ * @param settings.keepNeg
+ * @return An object with the values for days, hours, minutes, seconds
*/
export const getIntervalFromUnix = ( unixTime: number, settings: { exclude?: string[], keepNeg?: boolean }) => {
unixTime ??= 0; // Check for null/undefined
diff --git a/src/blocks/blocks/countdown/edit.tsx b/src/blocks/blocks/countdown/edit.tsx
index 41bc082bf..accdf6976 100644
--- a/src/blocks/blocks/countdown/edit.tsx
+++ b/src/blocks/blocks/countdown/edit.tsx
@@ -43,7 +43,7 @@ import {
} from '../../helpers/helper-functions.js';
import DisplayTime from './components/display-time';
import { fromInterval, toTimer } from './common';
-import { CountdownProps } from './types';
+import type { CountdownProps } from './types.d.ts';
const { attributes: defaultAttributes } = metadata;
diff --git a/src/blocks/blocks/countdown/inspector.js b/src/blocks/blocks/countdown/inspector.js
index 35e1d25ac..63d89803c 100644
--- a/src/blocks/blocks/countdown/inspector.js
+++ b/src/blocks/blocks/countdown/inspector.js
@@ -143,7 +143,7 @@ const EndActionPanel = () => (
/**
*
* @param {import('./types.js').CountdownInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -193,7 +193,7 @@ const Inspector = ({
- { applyFilters( 'otter.countdown.controls.settings', , { attributes: attributes, setAttributes: setAttributes }) }
+ { applyFilters( 'otter.countdown.controls.settings', , { attributes, setAttributes }) }
{ attributes.mode === undefined && (
- { applyFilters( 'otter.countdown.controls.end', , { attributes: attributes, setAttributes: setAttributes }) }
+ { applyFilters( 'otter.countdown.controls.end', , { attributes, setAttributes }) }
diff --git a/src/blocks/blocks/countdown/save.tsx b/src/blocks/blocks/countdown/save.tsx
index 7f275f9b8..a10596c34 100644
--- a/src/blocks/blocks/countdown/save.tsx
+++ b/src/blocks/blocks/countdown/save.tsx
@@ -18,7 +18,7 @@ import {
} from '../../helpers/helper-functions.js';
import { getIntervalFromUnix, timerSerialization } from './common';
import { isEmpty } from 'lodash';
-import { CountdownProps } from './types.js';
+import type { CountdownProps } from './types.d.ts';
const DisplayTimeComponent = ({
name,
@@ -62,7 +62,7 @@ const DisplayTime = ({