Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Sep 20, 2024
1 parent 4e90772 commit 6c723ba
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 44 deletions.
23 changes: 12 additions & 11 deletions src/js/features/classification/classification-button.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* External dependencies.
*/
import { select, dispatch, useSelect } from '@wordpress/data';
import { dispatch, useSelect } from '@wordpress/data';
import { useState } from '@wordpress/element';
import { Button, Modal } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies.
Expand All @@ -26,10 +26,11 @@ export const ClassificationButton = () => {
)
);

const postId = select( 'core/editor' ).getCurrentPostId();
const postType = select( 'core/editor' ).getCurrentPostType();
const postId = wp.data.select( 'core/editor' ).getCurrentPostId();
const postType = wp.data.select( 'core/editor' ).getCurrentPostType();
const postTypeLabel =
select( 'core/editor' ).getPostTypeLabel() || __( 'Post', 'classifai' );
wp.data.select( 'core/editor' ).getPostTypeLabel() ||
__( 'Post', 'classifai' );

const [ isLoading, setLoading ] = useState( false );
const [ resultReceived, setResultReceived ] = useState( false );
Expand Down Expand Up @@ -60,11 +61,9 @@ export const ClassificationButton = () => {
const taxTermsExisting = {};

// get current terms of the post
const currentTerms = select( 'core' ).getEntityRecord(
'postType',
postType,
postId
);
const currentTerms = wp.data
.select( 'core' )
.getEntityRecord( 'postType', postType, postId );

Object.keys( taxonomies ).forEach( ( taxonomy ) => {
let tax = taxonomy;
Expand Down Expand Up @@ -159,7 +158,9 @@ export const ClassificationButton = () => {
);

// If no edited values in post trigger save.
const isDirty = await select( 'core/editor' ).isEditedPostDirty();
const isDirty = await wp.data
.select( 'core/editor' )
.isEditedPostDirty();
if ( ! isDirty ) {
await dispatch( 'core' ).saveEditedEntityRecord(
'postType',
Expand Down
9 changes: 3 additions & 6 deletions src/js/features/classification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ const ClassificationPlugin = () => {
);
};

registerPlugin(
'classifai-plugin-classification',
{
render: ClassificationPlugin
}
);
registerPlugin( 'classifai-plugin-classification', {
render: ClassificationPlugin,
} );
6 changes: 3 additions & 3 deletions src/js/features/classification/taxonomy-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getEntitiesInfo,
useTaxonomies,
} from '../../../../includes/Classifai/Blocks/recommended-content-block/utils';
import { useState } from '@wordpress/element';
import { useState, Fragment } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';

const termsPerPage = -1;
Expand Down Expand Up @@ -274,7 +274,7 @@ const TaxonomyControls = ( { onChange, query } ) => {
}

return (
<React.Fragment key={ slug }>
<Fragment key={ slug }>
<FormTokenField
key={ slug }
label={ name }
Expand All @@ -300,7 +300,7 @@ const TaxonomyControls = ( { onChange, query } ) => {
</>
) }
<hr />
</React.Fragment>
</Fragment>
);
} ) }
</>
Expand Down
8 changes: 6 additions & 2 deletions src/js/features/excerpt-generation/classic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const classifaiExcerptData = window.classifaiGenerateExcerpt || {};
$( '<p>', {
class: 'classifai-excerpt-generation__excerpt-generate-error',
} ).insertAfter(
document.getElementById( 'classifai-excerpt-generation__excerpt-generate-btn' )
document.getElementById(
'classifai-excerpt-generation__excerpt-generate-btn'
)
);

// Append disable feature link.
Expand Down Expand Up @@ -85,7 +87,9 @@ const classifaiExcerptData = window.classifaiGenerateExcerpt || {};
const spinnerEl = $(
'.classifai-excerpt-generation__excerpt-generate-btn--spinner'
);
const errorEl = $( '.classifai-excerpt-generation__excerpt-generate-error' );
const errorEl = $(
'.classifai-excerpt-generation__excerpt-generate-error'
);

generateTextEl.css( 'opacity', '0' );
spinnerEl.show();
Expand Down
11 changes: 4 additions & 7 deletions src/js/features/slot-fill/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
import { Icon, SlotFillProvider, Slot, Fill, } from '@wordpress/components';
import { Icon, SlotFillProvider, Slot, Fill } from '@wordpress/components';
import { PluginArea, registerPlugin } from '@wordpress/plugins';
import { __ } from '@wordpress/i18n';

Expand All @@ -22,12 +22,9 @@ const ClassifAIPluginArea = () => {
);
};

registerPlugin(
'classifai-plugin-area',
{
render: ClassifAIPluginArea
}
);
registerPlugin( 'classifai-plugin-area', {
render: ClassifAIPluginArea,
} );

window.ClassifaiEditorSettingPanel = ( { children } ) => {
return <Fill name="classifai-editor-setting-panel">{ children }</Fill>;
Expand Down
20 changes: 10 additions & 10 deletions src/js/features/text-to-speech/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

/**
* External dependencies.
*/
import { useState, useEffect, useRef } from '@wordpress/element';
import { ToggleControl, BaseControl, Button, Icon } from '@wordpress/components';
import {
ToggleControl,
BaseControl,
Button,
Icon,
} from '@wordpress/components';
import { useSelect, subscribe } from '@wordpress/data';
import { registerPlugin } from '@wordpress/plugins';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies.
Expand Down Expand Up @@ -223,13 +227,9 @@ const TextToSpeechPlugin = () => {
);
};

registerPlugin(
'classifai-plugin-text-to-speech',
{
render: TextToSpeechPlugin
}
);

registerPlugin( 'classifai-plugin-text-to-speech', {
render: TextToSpeechPlugin,
} );

let saveHappened = false;
let showingNotice = false;
Expand Down
18 changes: 14 additions & 4 deletions src/js/features/title-generation/classic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ const scriptData = classifaiChatGPTData.enabledFeatures.reduce(
class: 'button classifai-title-generation__select-title',
} )
)
.appendTo( '#classifai-title-generation__results-content' );
.appendTo(
'#classifai-title-generation__results-content'
);
} );

// Append disable feature link.
Expand Down Expand Up @@ -162,8 +164,12 @@ const scriptData = classifaiChatGPTData.enabledFeatures.reduce(

$( '<span class="error">' )
.text( error?.message )
.wrap( `<div class="classifai-title-generation__result-item" />` )
.appendTo( '#classifai-title-generation__results-content' );
.wrap(
`<div class="classifai-title-generation__result-item" />`
)
.appendTo(
'#classifai-title-generation__results-content'
);

$( '#classifai-title-generation__results' )
.show()
Expand All @@ -179,7 +185,11 @@ const scriptData = classifaiChatGPTData.enabledFeatures.reduce(
);

// Event handler registration to hide the popup.
$( document ).on( 'click', '#classifai-title-generation__overlay', hidePopup );
$( document ).on(
'click',
'#classifai-title-generation__overlay',
hidePopup
);
$( document ).on(
'click',
'#classifai-title-generation__close-modal-button',
Expand Down
4 changes: 3 additions & 1 deletion src/js/features/title-generation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ const TitleGenerationPlugin = () => {
);
};

registerPlugin( 'classifai-plugin-title-generation', { render: TitleGenerationPlugin } );
registerPlugin( 'classifai-plugin-title-generation', {
render: TitleGenerationPlugin,
} );

0 comments on commit 6c723ba

Please sign in to comment.