Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
34b4a75
chore(ts): normalize base tsconfig for pnpm monorepo
danieliser Apr 22, 2026
bc011e0
fix(icons): annotate exported icon consts with JSX.Element
danieliser Apr 22, 2026
3e67cdd
fix(core-data): align Notice type with @wordpress/notices contract
danieliser Apr 22, 2026
db8f5e0
chore(deps): pin typescript@5.7.3 as root devDep
danieliser Apr 22, 2026
570c84d
fix(core-data): type fieldErrors filter as WPNotice, drop optional chain
danieliser Apr 22, 2026
0fb3e9f
chore(deps): refresh pnpm-lock after typescript add
danieliser Apr 22, 2026
ec3b8f8
style(core-data): fix JSDoc @param column alignment in notice actions
danieliser Apr 22, 2026
c2191bc
fix(components): annotate exported React types with JSX.Element (TS2742)
danieliser Apr 22, 2026
6733588
fix(fields): annotate exported field components with JSX.Element (TS2…
danieliser Apr 22, 2026
fdb8b62
fix(layout): annotate slots + components for portable type emit (TS2742)
danieliser Apr 22, 2026
41ecd8a
fix(ts): annotate remaining React components across block-editor, cta…
danieliser Apr 22, 2026
e4a7c8e
style: prettier format on touched files
danieliser Apr 22, 2026
f4d5642
style: satisfy ESLint — translator comments + @popup-maker/* ignore
danieliser Apr 22, 2026
57a62a4
fix(lint): move translator comment inside sprintf() directly before __()
danieliser Apr 22, 2026
da51323
fix(cr): address PR 1208 review findings
danieliser Apr 22, 2026
34a53fb
fix(lint): add JSDoc @param tags required by eslint-plugin-jsdoc
danieliser Apr 22, 2026
025812c
fix(cr): complete Notice shape + drop redundant cast
danieliser Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const eslintConfig = {
'error',
{
// Hate it but this is most reliable way to handle it since its already loaded.
ignore: [ 'jquery' ],
// @popup-maker/* are pnpm workspace packages — the resolver
// can't always follow their symlinks in CI, but they resolve
// correctly at runtime via tsconfig paths / webpack aliases.
ignore: [ 'jquery', '^@popup-maker/' ],
},
],
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"react-dom": "^18.3.1",
"rtlcss-webpack-plugin": "^4.0.7",
"storybook": "8.6.17",
"typescript": "5.7.3",
"webpack-bundle-analyzer": "^4.10.2"
},
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@
"@popup-maker/i18n": "workspace:*",
"@popup-maker/icons": "workspace:*",
"@wordpress/a11y": "^4.29.0",
"@wordpress/api-fetch": "^7.43.0",
"@wordpress/base-styles": "^6.5.0",
"@wordpress/block-editor": "^15.2.0",
"@wordpress/components": "^30.2.0",
"@wordpress/compose": "^7.29.0",
"@wordpress/data": "^10.29.0",
"@wordpress/edit-post": "^8.43.0",
"@wordpress/element": "^6.29.0",
"@wordpress/hooks": "^4.29.0",
"@wordpress/html-entities": "^4.29.0",
"@wordpress/i18n": "^6.17.0",
"@wordpress/keycodes": "^4.29.0",
"@wordpress/plugins": "^7.43.0",
"@wordpress/rich-text": "^7.29.0",
"clsx": "2.1.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/formats/popup-trigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ type Props = {
const title = __( 'Popup Trigger', 'popup-maker' );
export const name = `popup-maker/popup-trigger`;

export const TriggerEdit = withSpokenMessages(
export const TriggerEdit: React.ComponentType< Props > = withSpokenMessages(
( {
isActive,
activeAttributes,
value,
onChange,
onFocus,
contentRef,
}: Props ) => {
}: Props ): JSX.Element => {
const [ addingTrigger, setAddingTrigger ] =
useState< boolean >( false );

Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/formats/popup-trigger/inline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const InlinePopupTriggerUI = ( {
stopAddingTrigger,
contentRef,
focusOnMount,
}: Props ) => {
}: Props ): JSX.Element => {
// Get dispatch action to change the selection.
const { selectionChange } = useDispatch( blockEditorStore );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PopupTriggerEditor = ( {
onChangeInputValue,
value,
...props
}: Props ) => {
}: Props ): JSX.Element => {
return (
<form
className={ clsx(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ function PopupView( {
);

const popup = getPopupById( popupId );
const label = popup
? /* translators: %s = popup title */
sprintf(
__( 'Open "%s" popup', 'popup-maker' ),
decodeEntities( popup.title.rendered )
)
: '';
let label = '';
if ( popup ) {
label = sprintf(
/* translators: %s: popup title. */
__( 'Open "%s" popup', 'popup-maker' ),
decodeEntities( popup.title.rendered )
);
}

return (
<span className={ spanClassName } role="button" aria-label={ label }>
Expand All @@ -59,7 +60,7 @@ export default function PopupTriggerViewer( {
onEditTriggerClick,
popupId,
...props
}: PopupTriggerViewerProps ) {
}: PopupTriggerViewerProps ): JSX.Element {
return (
<div
className={ clsx(
Expand Down
14 changes: 10 additions & 4 deletions packages/block-editor/src/plugins/popup-title-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function setupSaveSubscription() {
let wasSaving = false;

subscribe( () => {
const editor = select( 'core/editor' ) as EditorStore;
const editor = select( 'core/editor' ) as unknown as EditorStore;

const isSaving = editor.isSavingPost();
const isAutosaving = editor.isAutosavingPost();
Expand Down Expand Up @@ -78,7 +78,14 @@ function setupSaveSubscription() {
.catch( ( error ) => {
// eslint-disable-next-line no-console
console.error( 'Failed to save popup title:', error );
dispatch( 'core/notices' ).createErrorNotice(
(
dispatch( 'core/notices' ) as unknown as {
createErrorNotice: (
content: string,
options: { type: string }
) => void;
}
).createErrorNotice(
__( 'Failed to save popup title.', 'popup-maker' ),
{ type: 'snackbar' }
);
Expand All @@ -90,7 +97,7 @@ function setupSaveSubscription() {
/**
* Popup Title Panel Component.
*/
const PopupTitlePanel = () => {
const PopupTitlePanel = (): JSX.Element | null => {
const [ localTitle, setLocalTitle ] = useState( '' );
const [ isInitialized, setIsInitialized ] = useState( false );

Expand Down Expand Up @@ -151,7 +158,6 @@ const PopupTitlePanel = () => {

registerPlugin( 'popup-maker-title-panel', {
render: PopupTitlePanel,
icon: null,
} );

export default PopupTitlePanel;
2 changes: 1 addition & 1 deletion packages/components/src/lib/confirm-dialogue/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ConfirmDialogue = ( {
onClose,
isDestructive = false,
children,
}: Props ) => {
}: Props ): JSX.Element | null => {
const confirmButtonRef = useRef< HTMLButtonElement | null >( null );
const previousFocusRef = useRef< HTMLElement | null >( null );

Expand Down
5 changes: 4 additions & 1 deletion packages/components/src/lib/controlled-tab-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ const TabPanel = ( {
);
};

export default withInstanceId( TabPanel );
const ControlledTabPanel: React.ComponentType< Omit< Props, 'instanceId' > > =
withInstanceId( TabPanel );

export default ControlledTabPanel;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const TabButton = ( {
children,
selected,
...rest
}: Props ) => (
}: Props ): JSX.Element => (
<Button
role="tab"
tabIndex={ selected ? undefined : -1 }
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/cta-select-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CallToActionSelectControl = <
placeholder,
multiple = false,
...inputProps
}: Props< T > ) => {
}: Props< T > ): JSX.Element => {
const [ queryText, setQueryText ] = useState( '' );

const updateQueryText = useDebounce( ( text: string ) => {
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/lib/device-toggle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ type Props = {
onChange?: ( checked: boolean ) => void;
};

const DeviceToggle = ( { label, icon, isVisible, onChange = noop }: Props ) => {
const DeviceToggle = ( {
label,
icon,
isVisible,
onChange = noop,
}: Props ): JSX.Element => {
const toggleLabel = ! isVisible
? /* translators: 1. Device type. */
_x( 'Hide on %1$s', 'Device toggle option', 'popup-maker' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
multiple = false,
forceRefresh = false,
...inputProps
}: Props< T > ) => {
}: Props< T > ): JSX.Element => {
const [ queryText, setQueryText ] = useState( '' );

const updateQueryText = useDebounce( ( text: string ) => {
Expand All @@ -60,7 +60,7 @@
) as ObjectOption[] )
: [],
} ),
[ value, entityKind, entityType, forceRefresh ]

Check warning on line 63 in packages/components/src/lib/entity-select-control/index.tsx

View workflow job for this annotation

GitHub Actions / JS/TS Code Quality

React Hook useSelect has an unnecessary dependency: 'forceRefresh'. Either exclude it or remove the dependency array.
);

const { suggestions = [], isSearching = false } = useSelect(
Expand All @@ -85,7 +85,7 @@
]
),
} ),
[ entityKind, entityType, queryText, forceRefresh ]

Check warning on line 88 in packages/components/src/lib/entity-select-control/index.tsx

View workflow job for this annotation

GitHub Actions / JS/TS Code Quality

React Hook useSelect has an unnecessary dependency: 'forceRefresh'. Either exclude it or remove the dependency array.
);

const findSuggestion = ( _id: number | string ) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/field-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = {
children: React.ReactNode;
};

const FieldPanel = ( { title, className, children }: Props ) => {
const FieldPanel = ( { title, className, children }: Props ): JSX.Element => {
return (
<Panel
header={ title }
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/field-row/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const FieldRow = ( {
description?: string;
className?: clsx.ClassValue;
children: JSX.Element;
} ) => (
} ): JSX.Element => (
<div className={ clsx( [ 'components-field-row', className ] ) }>
<div className="components-base-control">
<label
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/lib/freeform-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ const {
// return /^\n?$/.test( body.innerText || body.textContent );
// }

const FreeFormEditControl = < T extends string >( props: Props< T > ) => {
const FreeFormEditControl = < T extends string >(
props: Props< T >
): JSX.Element => {
const instanceId = useInstanceId( FreeFormEditControl );
const {
label,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/full-screen-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type FullScreenPanelProps = {
children: React.ReactNode;
};

const FullScreenPanel = ( props: FullScreenPanelProps ) => {
const FullScreenPanel = ( props: FullScreenPanelProps ): JSX.Element => {
const { className, children } = props;

const [ isFull, setIsFull ] = useState( false );
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/list-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ListTable = < T extends TableItemBase >( {
onSelectItems = () => {},
onSort,
initialSort,
}: Props< T > ) => {
}: Props< T > ): JSX.Element => {
const cols = { [ idCol ]: columns[ idCol ] ?? '', ...columns };
const colCount = Object.keys( cols ).length;

Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/lib/popup-select-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const PopupSelectControl = ( {
} ),
],
...props
}: PopupSelectControlProps & Pick< SelectControlProps, 'help' > ) => {
}: PopupSelectControlProps &
Pick< SelectControlProps, 'help' > ): JSX.Element => {
return (
<SelectControl
label={ label }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const RadioButtonControl = < T extends string | number = string | number >( {
equalWidth = false,
spacing,
hideLabelFromVision = false,
}: Props< T > ) => {
}: Props< T > ): JSX.Element => {
const instanceId = useInstanceId( RadioButtonControl );

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const SearchableMulticheckControl = < T extends string | number >( {
options = [],
onChange = () => {},
className = '',
}: Props< T > ) => {
}: Props< T > ): JSX.Element => {
const instanceId = useInstanceId( SearchableMulticheckControl );

const [ searchText, setSearchText ] = useState< string >( '' );
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/text-highlight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type TextHighlightProps = {
*
* @param {TextHighlightProps} props Text highlight props.
*/
export const TextHighlight = ( props: TextHighlightProps ) => {
export const TextHighlight = ( props: TextHighlightProps ): JSX.Element => {
const { text = '', highlight = '' } = props;
// Convert single string to array, trim thim & filters empty|null values.
const trimmedHighlightText = (
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/lib/url-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const URLControl = (
className = '',
}: Props,
ref: React.ForwardedRef< HTMLInputElement | null >
) => {
): JSX.Element => {
// Set up instance ID & refs.
const instanceId = useInstanceId( URLControl );
const wrapperRef = useRef< HTMLDivElement | null >( null );
Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/lib/url-control/suggestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ type Props = {
[ key: string ]: any;
};

const Suggestion = forwardRef< HTMLButtonElement, Props >(
const Suggestion: React.ForwardRefExoticComponent<
Props & React.RefAttributes< HTMLButtonElement >
> = forwardRef< HTMLButtonElement, Props >(
(
{
icon,
Expand All @@ -31,7 +33,7 @@ const Suggestion = forwardRef< HTMLButtonElement, Props >(
...buttonProps
},
ref
) => {
): JSX.Element => {
return (
<Button
type="button"
Expand Down
18 changes: 9 additions & 9 deletions packages/core-data/src/call-to-actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DispatchStatus } from '../constants';
import { fetchFromApi, getErrorMessage } from '../utils';
import { validateCallToAction } from './validation';
import { editableEntity } from './utils';
import type { EditorId, Notice } from '../types';
import type { EditorId, Notice, WPNotice } from '../types';
import type {
CallToAction,
ThunkAction,
Expand Down Expand Up @@ -55,10 +55,10 @@ const handleFieldValidationErrors = (
const notices = registry
.select( noticesStore )
.getNotices( NOTICE_CONTEXT );
const fieldErrors = notices.filter(
( n: Notice ) => n.id?.startsWith( `field-error-${ ctaId }-` )
const fieldErrors = notices.filter( ( n: WPNotice ) =>
n.id.startsWith( `field-error-${ ctaId }-` )
);
fieldErrors.forEach( ( n: Notice ) =>
fieldErrors.forEach( ( n: WPNotice ) =>
registry
.dispatch( noticesStore )
.removeNotice( n.id, NOTICE_CONTEXT )
Expand Down Expand Up @@ -1033,21 +1033,21 @@ const noticeActions = {
/**
* Create a notice.
*
* @param {Notice[ 'status' ]} status The notice status.
* @param {Notice[ 'content' ]} content The notice content.
* @param {Notice} options The notice options.
* @param {WPNotice[ 'status' ]} status The notice status.
* @param {WPNotice[ 'content' ]} content The notice content.
* @param {Notice} options The notice options.
* @return {Promise<void>}
*/
createNotice:
(
/**
* Notice status.
*/
status: Notice[ 'status' ] = 'info',
status: WPNotice[ 'status' ] = 'info',
/**
* Notice content.
*/
content: Notice[ 'content' ] = '',
content: WPNotice[ 'content' ] = '',
/**
* Notice options.
*/
Expand Down
Loading
Loading