From 2f2543647311b9703706a3431e26531781fc9610 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 20 Aug 2024 12:39:12 -0400 Subject: [PATCH] Update jsdoc comments to better match WordPress coding standards (#38466) More specifically, this enables a few linting rules from `@wordpress/eslint-plugin` that had previously been disabled: * For `jsdoc/check-tag-names`, prefer `@return` and `@yield` over `@returns` and `@yields`. * Enable `jsdoc/check-line-alignment` for certain tags, most notably `@param. * Update `jsdoc/check-indentation` rule config to not conflict with `jsdoc/check-line-alignment`. --- .../check-test-reminder-comment.js | 14 +-- .../get-check-comments.js | 2 +- .pnpmfile.cjs | 10 +- pnpm-lock.yaml | 56 ++++++--- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../src/tasks/add-labels/index.js | 14 +-- .../src/tasks/check-description/index.js | 32 ++--- .../tasks/gather-support-references/index.js | 48 +++---- .../src/tasks/notify-design/index.js | 6 +- .../src/tasks/notify-editorial/index.js | 6 +- .../reply-to-customers-reminder/index.js | 4 +- .../src/tasks/update-board/index.js | 30 ++--- .../src/tasks/wpcom-commit-reminder/index.js | 4 +- .../get-affected-changelogger-projects.js | 6 +- .../src/utils/get-associated-pull-request.js | 2 +- .../repo-gardening/src/utils/get-comments.js | 2 +- .../repo-gardening/src/utils/get-files.js | 2 +- .../src/utils/get-next-valid-milestone.js | 4 +- .../src/utils/get-plugin-names.js | 2 +- .../src/utils/get-pr-workspace.js | 2 +- .../repo-gardening/src/utils/if-not-closed.js | 2 +- .../repo-gardening/src/utils/if-not-fork.js | 2 +- .../src/utils/labels/get-labels.js | 2 +- .../src/utils/labels/has-escalated-label.js | 2 +- .../src/utils/labels/has-priority-labels.js | 2 +- .../repo-gardening/src/utils/labels/is-bug.js | 2 +- .../src/utils/parse-content/find-platforms.js | 2 +- .../src/utils/parse-content/find-plugins.js | 2 +- .../src/utils/parse-content/find-priority.js | 2 +- .../has-many-support-references.js | 2 +- .../src/utils/slack/format-slack-message.js | 2 +- .../src/utils/slack/send-slack-message.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../required-review/src/main.js | 2 +- .../required-review/src/paths.js | 2 +- .../required-review/src/reporter.js | 2 +- .../required-review/src/requirement.js | 32 ++--- .../required-review/src/reviewers.js | 2 +- .../required-review/src/team-members.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../test-results-to-slack/src/github.js | 4 +- .../test-results-to-slack/src/message.js | 14 +-- .../test-results-to-slack/src/playwright.js | 12 +- .../test-results-to-slack/src/rules.js | 2 +- .../test-results-to-slack/src/slack.js | 32 ++--- .../test-results-to-slack/tests/rules.test.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../ai-client/src/ask-question/index.ts | 6 +- .../ai-client/src/ask-question/sync.ts | 6 +- .../src/audio-transcription/index.ts | 6 +- .../src/components/ai-control/ai-control.tsx | 2 +- .../ai-control/block-ai-control.tsx | 6 +- .../ai-control/extension-ai-control.tsx | 6 +- .../components/ai-status-indicator/index.tsx | 2 +- .../audio-duration-display/index.tsx | 2 +- .../audio-duration-display/lib/media.ts | 4 +- .../src/components/message/index.tsx | 8 +- .../ai-client/src/data-flow/context.tsx | 4 +- .../ai-client/src/data-flow/use-ai-context.ts | 2 +- .../src/data-flow/with-ai-assistant-data.tsx | 2 +- .../src/hooks/use-ai-suggestions/index.ts | 22 ++-- .../hooks/use-audio-transcription/index.ts | 4 +- .../src/hooks/use-audio-validation/index.ts | 2 +- .../src/hooks/use-image-generator/index.ts | 18 +-- .../src/hooks/use-media-recording/index.ts | 8 +- .../hooks/use-save-to-media-library/index.ts | 2 +- .../index.ts | 2 +- .../src/icons/stories/index.stories.tsx | 2 +- .../js-packages/ai-client/src/jwt/index.ts | 2 +- .../src/libs/markdown/html-to-markdown.ts | 2 +- .../src/libs/markdown/markdown-to-html.ts | 8 +- .../src/logo-generator/lib/logo-storage.ts | 34 ++--- .../src/logo-generator/lib/media-exists.ts | 4 +- .../src/logo-generator/lib/set-site-logo.ts | 6 +- .../lib/wpcom-limited-request.ts | 2 +- .../src/logo-generator/store/actions.ts | 6 +- .../src/logo-generator/store/reducer.ts | 44 +++---- .../src/logo-generator/store/selectors.ts | 40 +++--- .../src/suggestions-event-source/index.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/js-packages/analytics/index.jsx | 8 +- projects/js-packages/analytics/package.json | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/js-packages/api/index.jsx | 28 ++--- projects/js-packages/api/package.json | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../js-packages/boost-score-api/package.json | 2 +- .../js-packages/boost-score-api/src/api.ts | 42 +++---- .../js-packages/boost-score-api/src/index.ts | 28 ++--- .../src/utils/cast-to-number.ts | 2 +- .../src/utils/cast-to-string.ts | 2 +- .../boost-score-api/src/utils/json-types.ts | 4 +- .../boost-score-api/src/utils/poll-promise.ts | 2 +- .../src/utils/standardize-error.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../components/action-button/index.jsx | 2 +- .../components/admin-page/index.tsx | 2 +- .../components/admin-section/basic/index.tsx | 2 +- .../components/admin-section/hero/index.tsx | 2 +- .../components/components/alert/index.tsx | 12 +- .../automattic-byline-logo/index.tsx | 2 +- .../automattic-for-agencies-logo/index.tsx | 6 +- .../components/automattic-icon-logo/index.tsx | 8 +- .../boost-score-graph/day-highlight-plugin.ts | 2 +- .../boost-score-graph/get-date-format.ts | 6 +- .../components/boost-score-graph/index.tsx | 10 +- .../boost-score-graph/tooltips-plugin.ts | 4 +- .../boost-score-graph/uplot-line-chart.tsx | 16 +-- .../use-boost-score-transform.ts | 2 +- .../boost-score-graph/use-resize.ts | 2 +- .../components/components/button/index.tsx | 2 +- .../components/components/chip/index.tsx | 8 +- .../components/decorative-card/index.tsx | 2 +- .../components/components/dialog/index.tsx | 12 +- .../components/donut-meter/index.tsx | 2 +- .../global-notices/global-notices.tsx | 2 +- .../global-notices/use-global-notices.ts | 2 +- .../components/icon-tooltip/index.tsx | 2 +- .../components/components/icons/index.tsx | 6 +- .../icons/stories/index.stories.tsx | 2 +- .../indeterminate-progress-bar/index.tsx | 2 +- .../components/jetpack-footer/index.tsx | 2 +- .../components/layout/col/index.tsx | 4 +- .../components/layout/container/index.tsx | 2 +- .../layout/use-breakpoint-match/index.ts | 6 +- .../components/components/notice/index.tsx | 16 +-- .../components/number-format/index.ts | 4 +- .../components/number-slider/index.tsx | 2 +- .../components/pricing-card/index.tsx | 4 +- .../components/product-offer/icons-card.tsx | 4 +- .../components/product-offer/index.tsx | 2 +- .../product-offer/product-offer-header.tsx | 2 +- .../components/product-price/index.tsx | 2 +- .../components/product-price/price.tsx | 4 +- .../components/progress-bar/index.tsx | 2 +- .../components/components/qr-code/index.tsx | 2 +- .../components/record-meter-bar/index.tsx | 2 +- .../components/components/stat-card/index.tsx | 2 +- .../components/components/text/index.tsx | 14 +-- .../text/stories/headings.index.stories.tsx | 4 +- .../components/theme-provider/index.tsx | 4 +- .../theme-provider/stories/index.stories.tsx | 4 +- .../components/upsell-banner/index.tsx | 2 +- .../components/lib/locale/index.ts | 4 +- .../tools/get-product-checkout-url/index.ts | 8 +- .../tools/get-site-admin-url/index.ts | 2 +- .../components/tools/jp-redirect/index.ts | 14 +-- .../components/tools/pricing-utils/index.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../components/connect-button/index.jsx | 2 +- .../connect-screen/required-plan/index.jsx | 2 +- .../connect-screen/required-plan/visual.jsx | 2 +- .../components/connect-user/index.jsx | 10 +- .../components/connected-plugins/index.jsx | 2 +- .../connection-error-notice/index.jsx | 2 +- .../components/disconnect-card/index.jsx | 2 +- .../components/disconnect-dialog/index.jsx | 4 +- .../steps/step-disconnect-confirm.jsx | 2 +- .../steps/step-disconnect.jsx | 6 +- .../disconnect-dialog/steps/step-survey.jsx | 2 +- .../steps/step-thank-you.jsx | 2 +- .../components/disconnect-survey/index.jsx | 12 +- .../disconnect-survey/survey-choice.jsx | 12 +- .../components/in-place-connection/index.jsx | 24 ++-- .../manage-connection-dialog/index.jsx | 2 +- .../components/use-connection/index.jsx | 4 +- .../connection/helpers/get-calypso-origin.ts | 2 +- .../use-connection-error-notice/index.jsx | 2 +- .../use-product-checkout-workflow/index.jsx | 22 ++-- .../hooks/use-restore-connection/index.jsx | 4 +- .../js-packages/connection/state/actions.jsx | 22 ++-- .../connection/state/selectors.jsx | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../src/browser-interface-playwright.ts | 8 +- .../critical-css-gen/src/browser-interface.ts | 24 ++-- .../critical-css-gen/src/css-file-set.ts | 6 +- .../src/generate-critical-css.ts | 20 +-- .../src/ignored-pseudo-elements.ts | 4 +- .../critical-css-gen/src/minify-css.ts | 2 +- .../src/object-promise-all.ts | 2 +- .../critical-css-gen/src/style-ast.ts | 26 ++-- .../critical-css-gen/tests/lib/mock-fetch.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../js-packages/eslint-changed/src/cli.js | 12 +- .../eslint-changed/tests/cli.test.js | 20 +-- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../eslint-config-target-es/src/funcs.js | 14 +-- .../eslint-config-target-es/src/needsCheck.js | 8 +- .../tests/configs-eslintrc.test.js | 2 +- .../tests/configs-flat.test.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../i18n-check-webpack-plugin/package.json | 2 +- .../src/GettextEntry.js | 12 +- .../src/GettextExtractor.js | 38 +++--- .../src/I18nCheckPlugin.js | 10 +- .../src/I18nSafeMangleExportsPlugin.js | 12 +- .../tests/build.test.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../i18n-loader-webpack-plugin/package.json | 2 +- .../src/I18nLoaderPlugin.js | 2 +- .../src/I18nLoaderRuntimeModule.js | 4 +- .../tests/build.test.js | 8 +- .../tests/globals.js | 6 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../idc/components/card-fresh/index.jsx | 4 +- .../idc/components/card-migrate/index.jsx | 4 +- .../idc/components/idc-screen/index.jsx | 2 +- .../idc/components/idc-screen/screen-main.jsx | 2 +- .../components/idc-screen/screen-migrated.jsx | 2 +- .../idc-screen/screen-non-admin.jsx | 2 +- .../idc/components/safe-mode/index.jsx | 10 +- .../idc/hooks/use-migration-finished.jsx | 2 +- .../js-packages/idc/hooks/use-migration.jsx | 2 +- .../js-packages/idc/hooks/use-start-fresh.jsx | 2 +- projects/js-packages/idc/package.json | 2 +- .../idc/tools/extract-hostname.jsx | 2 +- projects/js-packages/idc/tools/tracking.jsx | 4 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../activation-screen-controls/index.jsx | 44 +++---- .../activation-screen-illustration/index.jsx | 6 +- .../activation-screen-success-info/index.jsx | 10 +- .../product-details/index.js | 6 +- .../components/activation-screen/index.jsx | 18 +-- .../components/activation-screen/utils.js | 2 +- .../components/golden-token-modal/index.jsx | 10 +- .../hooks/use-active-plugins/index.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../index.jsx | 4 +- projects/js-packages/partner-coupon/hooks.js | 12 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../connection-management/connection-info.tsx | 2 +- .../connection-management/connection-name.tsx | 2 +- .../connection-status.tsx | 2 +- .../connection-management/disconnect.tsx | 2 +- .../connection-management/mark-as-shared.tsx | 2 +- .../connection-management/reconnect.tsx | 2 +- .../src/components/connection/index.js | 4 +- .../form/enabled-connections-notice.tsx | 2 +- .../src/components/form/index.tsx | 2 +- .../src/components/form/settings-button.tsx | 2 +- .../src/components/form/share-post-form.tsx | 4 +- .../form/use-auto-save-and-redirect.ts | 2 +- .../generated-image-preview/index.js | 4 +- .../generated-image-preview/utils.js | 2 +- .../confirmation-form/index.tsx | 4 +- .../manage-connections-modal/index.tsx | 2 +- .../src/components/manual-sharing/index.tsx | 2 +- .../src/components/manual-sharing/info.tsx | 2 +- .../src/components/media-picker/index.js | 18 +-- .../media-picker/test/index.test.js | 2 +- .../src/components/media-section/index.js | 12 +- .../components/message-box-control/index.js | 12 +- .../post-publish-manual-sharing/index.jsx | 2 +- .../refresh-jetpack-social-settings/index.js | 6 +- .../src/components/services/connect-form.tsx | 2 +- .../services/service-item-details.tsx | 2 +- .../src/components/services/service-item.tsx | 2 +- .../components/services/service-status.tsx | 2 +- .../src/components/services/services-list.tsx | 2 +- .../components/services/use-request-access.ts | 2 +- .../components/services/use-service-label.ts | 2 +- .../src/components/services/use-service.ts | 2 +- .../services/use-supported-services.tsx | 2 +- .../share-buttons/share-buttons.tsx | 2 +- .../share-buttons/useShareButtonText.ts | 2 +- .../src/components/share-post/index.js | 4 +- .../template-picker/modal/index.js | 8 +- .../template-picker/modal/test/index.test.js | 2 +- .../template-picker/picker/index.js | 6 +- .../social-image-generator/toggle/index.tsx | 2 +- .../components/social-post-modal/modal.tsx | 2 +- .../social-post-modal/post-preview.tsx | 2 +- .../social-post-modal/preview-section.tsx | 2 +- .../social-post-modal/settings-section.tsx | 2 +- .../social-previews/google-search.js | 6 +- .../components/social-previews/instagram.js | 2 +- .../components/social-previews/linkedin.js | 2 +- .../components/social-previews/nextdoor.js | 2 +- .../src/components/social-previews/threads.js | 16 +-- .../src/components/social-previews/twitter.js | 14 +-- .../social-previews/use-available-services.js | 2 +- .../social-previews/use-post-data.js | 2 +- .../src/components/social-previews/utils.js | 4 +- .../src/hooks/use-attached-media/index.js | 4 +- .../src/hooks/use-dismiss-notice/index.js | 18 +-- .../src/hooks/use-featured-image/index.js | 2 +- .../hooks/use-image-generator-config/index.js | 18 +-- .../src/hooks/use-media-details/index.js | 6 +- .../hooks/use-media-restrictions/constants.ts | 4 +- .../src/hooks/use-media-restrictions/index.ts | 36 +++--- .../src/hooks/use-post-meta/index.js | 2 +- .../src/hooks/use-publicize-config/index.js | 2 +- .../hooks/use-refresh-connections/index.js | 2 +- .../hooks/use-save-image-to-library/index.ts | 2 +- .../src/hooks/use-saving-post/index.js | 12 +- .../src/hooks/use-share-limits/index.ts | 4 +- .../use-share-limits/test/index.test.tsx | 4 +- .../src/hooks/use-share-post/index.js | 4 +- .../use-social-media-connections/index.ts | 2 +- .../hooks/use-social-media-message/index.js | 6 +- .../social-store/actions/connection-data.js | 78 ++++++------ .../social-store/actions/jetpack-settings.js | 10 +- .../actions/jetpack-social-settings.js | 4 +- .../social-image-generator-settings.js | 14 +-- .../actions/social-notes-settings.js | 18 +-- .../actions/test/connection-data.js | 2 +- .../src/social-store/controls.js | 10 +- .../social-store/reducer/connection-data.js | 6 +- .../src/social-store/resolvers.js | 10 +- .../social-store/selectors/connection-data.js | 58 ++++----- .../src/social-store/selectors/shares-data.ts | 18 +-- .../src/utils/get-share-message-max-length.js | 2 +- .../get-supported-additional-connections.js | 2 +- .../src/utils/request-external-access.js | 4 +- .../src/utils/script-data.ts | 2 +- .../src/utils/test-utils.js | 4 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../react-data-sync-client/package.json | 2 +- .../react-data-sync-client/src/DataSync.ts | 22 ++-- .../src/DataSyncHooks.ts | 8 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/js-packages/script-data/package.json | 2 +- projects/js-packages/script-data/src/utils.ts | 12 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../shared-extension-utils/package.json | 2 +- .../jetpack-editor-panel-logo/index.jsx | 2 +- .../src/get-block-icon-from-metadata.js | 4 +- .../get-block-icon-from-metadata.native.js | 4 +- .../src/get-host-app-namespace.native.js | 2 +- .../src/get-icon-color.js | 2 +- .../src/get-jetpack-blocks-variation.js | 2 +- .../src/get-jetpack-data.js | 2 +- .../src/get-jetpack-extension-availability.js | 2 +- .../src/get-site-fragment.js | 2 +- .../src/hooks/use-module-status/index.js | 2 +- .../src/is-current-user-connected.js | 2 +- .../src/is-my-jetpack-available.js | 2 +- .../src/modules-state/actions.js | 24 ++-- .../src/modules-state/controls.js | 6 +- .../src/modules-state/resolvers.js | 4 +- .../shared-extension-utils/src/plan-utils.js | 18 +-- .../src/register-jetpack-plugin.js | 4 +- .../src/site-type-utils.js | 10 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../social-logos/src/react/example.tsx | 2 +- .../social-logos/tools/svg-to-react-data.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../stories/playground/index.stories.jsx | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../svelte-data-sync-client/src/DataSync.ts | 12 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../js-packages/videopress-core/src/index.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../js-packages/webpack-config/package.json | 2 +- .../src/webpack/pnpm-deterministic-ids.js | 4 +- .../webpack-config/src/webpack/terser.js | 14 +-- .../src/webpack/transpile-rule.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../packages/assets/src/js/i18n-loader.js | 6 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../js/components/backup-promotion/index.jsx | 2 +- .../backup/src/js/hooks/useCapabilities.js | 2 +- .../backup/src/js/hooks/useConnection.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/packages/blaze/src/js/icon.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../connection/src/js/tracks-callables.js | 6 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/packages/explat/package.json | 2 +- projects/packages/explat/src/class-explat.php | 2 +- projects/packages/explat/src/client/anon.ts | 4 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../blocks/contact-form/util/block-icons.js | 2 +- .../blocks/contact-form/util/block-support.js | 2 +- .../src/blocks/contact-form/util/caret.js | 2 +- .../contact-form/util/plugin-management.js | 6 +- .../util/register-jetpack-block.js | 10 +- .../components/switch-transition/index.js | 12 +- .../forms/src/dashboard/data/responses.js | 8 +- .../src/dashboard/inbox/bulk-actions-menu.js | 2 +- .../src/dashboard/inbox/export-modal/util.js | 10 +- .../forms/src/dashboard/state/actions.js | 24 ++-- .../bin/sync-newspack-blocks-formatter.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../use-has-selected-payment-block-once.js | 2 +- .../src/common/tour-kit/utils/index.ts | 2 +- .../tour-kit/utils/live-resize-modifier.tsx | 8 +- .../src/contextual-tip.js | 6 +- .../src/tip-link.js | 6 +- .../block-inserter-modifications/src/utils.js | 2 +- .../js/core-customizer-css-preview.js | 2 +- .../js/core-customizer-css.core-4.9.js | 4 +- .../jetpack-global-styles/src/dom-updater.js | 2 +- .../src/components/FrequencyToggle/index.tsx | 12 +- .../src/components/email-frequency-group.tsx | 2 +- .../src/components/logged-in.tsx | 2 +- .../src/hooks/useSocialLogin.tsx | 2 +- .../src/features/verbum-comments/src/utils.ts | 18 +-- .../src/inline-support-link.tsx | 8 +- .../src/sharing-modal/inline-social-logo.tsx | 2 +- .../inline-social-logos-sprite.tsx | 2 +- .../src/welcome-modal/wpcom-nux.js | 12 +- .../src/welcome-tour/tour-launch.jsx | 2 +- .../src/welcome-tour/use-tour-steps.tsx | 8 +- .../wpcom-blocks/event-countdown/edit.js | 4 +- .../wpcom-blocks/event-countdown/view.js | 4 +- .../wpcom-global-styles-view.js | 2 +- projects/packages/my-jetpack/_inc/admin.jsx | 2 +- .../components/add-license-screen/index.jsx | 2 +- .../components/connections-section/index.jsx | 2 +- .../_inc/components/go-back-link/index.js | 6 +- .../components/golden-token/tooltip/index.jsx | 6 +- .../_inc/components/idc-modal/index.js | 2 +- .../jetpack-manage-banner/index.jsx | 4 +- .../components/my-jetpack-screen/index.jsx | 2 +- .../_inc/components/plans-section/index.jsx | 18 +-- .../boost-card/use-boost-tooltip-copy.ts | 6 +- .../protect-card/auto-firewall-status.tsx | 4 +- .../protect-card/logins-blocked-status.tsx | 4 +- .../protect-card/scan-threats-status.tsx | 12 +- .../protect-card/use-protect-tooltip-copy.ts | 2 +- .../components/product-detail-card/index.jsx | 30 ++--- .../stories/broken/utils.js | 6 +- .../components/product-detail-table/index.jsx | 4 +- .../stories/broken/utils.js | 6 +- .../components/product-interstitial/index.jsx | 58 ++++----- .../product-interstitial/jetpack-ai/index.jsx | 2 +- .../jetpack-ai/more-requests.jsx | 4 +- .../jetpack-ai/product-page.jsx | 2 +- .../components/redeem-token-screen/index.jsx | 2 +- .../_inc/components/stats-section/cards.jsx | 2 +- .../stats-section/count-comparison-card.jsx | 12 +- .../_inc/components/welcome-banner/index.jsx | 2 +- .../welcome-flow/ConnectionStep.tsx | 8 +- .../_inc/data/use-jetpack-api-query.ts | 8 +- .../_inc/data/use-simple-mutation.ts | 12 +- .../my-jetpack/_inc/data/use-simple-query.ts | 12 +- .../_inc/hooks/use-analytics/index.ts | 4 +- .../_inc/hooks/use-go-back/index.ts | 2 +- .../hooks/use-my-jetpack-connection/index.ts | 2 +- .../hooks/use-my-jetpack-navigate/index.ts | 2 +- .../use-my-jetpack-return-to-page/index.ts | 2 +- .../hooks/use-redirect-to-referrer/index.ts | 2 +- .../_inc/utils/get-manage-your-plan-url.ts | 2 +- .../_inc/utils/get-purchase-plan-url.ts | 2 +- .../_inc/utils/is-jetpack-plugin-active.ts | 2 +- .../_inc/utils/is-lifetime-purchase.ts | 8 +- .../my-jetpack/_inc/utils/side-load-tracks.ts | 6 +- .../my-jetpack/_inc/utils/time-since.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../components/app-wrapper/index.jsx | 2 +- .../customberg/components/header/index.jsx | 4 +- .../customberg/components/layout/index.jsx | 2 +- .../components/layout/interface.jsx | 2 +- .../components/save-button/index.jsx | 2 +- .../components/sidebar/color-control.jsx | 8 +- .../sidebar/excluded-post-types-control.jsx | 12 +- .../customberg/components/sidebar/index.jsx | 2 +- .../sidebar/sidebar-description.jsx | 2 +- .../components/sidebar/sidebar-options.jsx | 2 +- .../customberg/components/sidebar/tabs.jsx | 18 +-- .../components/sidebar/theme-control.jsx | 8 +- .../components/sidebar/theme-icon.jsx | 4 +- .../hooks/use-entity-record-state.js | 2 +- .../src/customberg/hooks/use-loading-state.js | 2 +- .../customberg/hooks/use-search-options.js | 2 +- .../dashboard/wrapped-dashboard.jsx | 6 +- .../donut-meter-container/index.jsx | 12 +- .../components/global-notices/index.jsx | 2 +- .../global-notices/store/actions.js | 8 +- .../dashboard/components/loading/index.jsx | 2 +- .../components/mocked-search/index.jsx | 6 +- .../mocked-search/mocked-instant-search.jsx | 2 +- .../mocked-search/mocked-legacy-search.jsx | 2 +- .../components/module-control/index.jsx | 30 ++--- .../components/pages/connection-page.jsx | 4 +- .../components/pages/dashboard-page.jsx | 4 +- .../components/pages/upsell-page/index.jsx | 4 +- .../src/dashboard/components/price/index.jsx | 10 +- .../components/record-meter/index.jsx | 12 +- .../record-meter/lib/record-info.js | 28 ++--- .../components/record-meter/notice-box.jsx | 12 +- .../components/record-meter/record-count.jsx | 2 +- .../components/search-promotion/index.jsx | 2 +- .../components/upsell-nudge/index.jsx | 2 +- .../src/dashboard/hooks/use-connection.jsx | 2 +- .../hooks/use-product-checkout-workflow.jsx | 18 +-- .../store/actions/jetpack-settings.js | 10 +- .../dashboard/store/actions/search-pricing.js | 2 +- .../src/dashboard/store/actions/site-plan.js | 2 +- .../src/dashboard/store/actions/site-stats.js | 2 +- .../search/src/dashboard/store/controls.js | 12 +- .../search/src/dashboard/store/resolvers.js | 16 +-- .../components/path-breadcrumbs.jsx | 2 +- .../components/product-ratings.jsx | 8 +- .../components/search-filter.jsx | 2 +- .../components/search-result-expanded.jsx | 2 +- .../search/src/instant-search/lib/a11y.js | 2 +- .../search/src/instant-search/lib/api.js | 34 ++--- .../src/instant-search/lib/array-overlap.js | 2 +- .../search/src/instant-search/lib/colors.js | 4 +- .../src/instant-search/lib/customize.js | 2 +- .../search/src/instant-search/lib/dom.js | 4 +- .../src/instant-search/lib/dummy-debug.js | 2 +- .../search/src/instant-search/lib/errors.js | 2 +- .../search/src/instant-search/lib/filters.js | 20 +-- .../instant-search/lib/hooks/use-photon.js | 10 +- .../src/instant-search/lib/query-string.js | 10 +- .../search/src/instant-search/lib/sort.js | 4 +- .../lib/test-helpers/tiny-lru.mock.js | 2 +- .../search/src/instant-search/lib/tracks.js | 14 +-- .../src/instant-search/store/actions.js | 44 +++---- .../src/instant-search/store/effects.js | 4 +- .../src/instant-search/store/reducer/api.js | 12 +- .../instant-search/store/reducer/history.js | 4 +- .../store/reducer/query-string.js | 16 +-- .../store/reducer/server-options.js | 2 +- .../src/instant-search/store/selectors.js | 28 ++--- ...fine-palette-colors-as-static-variables.js | 2 +- .../search/tools/webpack.instant.config.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../clipboard-button-input/index.tsx | 2 +- .../admin/components/global-notice/index.tsx | 16 +-- .../client/admin/components/input/index.tsx | 4 +- .../admin/components/pagination/index.tsx | 2 +- .../publish-first-video-popover/index.tsx | 2 +- .../site-settings-section/index.tsx | 2 +- .../admin/components/video-card/error.tsx | 2 +- .../admin/components/video-card/index.tsx | 2 +- .../admin/components/video-grid/index.tsx | 2 +- .../components/video-stats-group/index.tsx | 2 +- .../components/video-storage-meter/index.tsx | 2 +- .../video-thumbnail-selector-modal/index.tsx | 2 +- .../components/video-thumbnail/index.tsx | 2 +- .../components/video-upload-area/index.tsx | 2 +- .../src/client/admin/hooks/use-plan/index.ts | 2 +- .../admin/hooks/use-playback-token/index.ts | 2 +- .../admin/hooks/use-search-params/index.ts | 6 +- .../src/client/admin/hooks/use-users/index.js | 2 +- .../src/client/admin/hooks/use-video/index.ts | 4 +- .../client/admin/hooks/use-videos/index.js | 4 +- .../videopress/src/client/admin/index.js | 2 +- .../videopress/src/client/admin/mock/index.ts | 2 +- .../components/banner/connect-banner.tsx | 2 +- .../blocks/video/components/banner/index.tsx | 10 +- .../components/color-panel/index.native.js | 6 +- .../video/components/color-panel/index.tsx | 2 +- .../components/details-panel/index.native.js | 8 +- .../video/components/details-panel/index.tsx | 2 +- .../details-panel/learn-how-notice/index.tsx | 2 +- .../components/playback-panel/index.native.js | 6 +- .../video/components/playback-panel/index.tsx | 2 +- .../video/components/player/index.native.js | 6 +- .../blocks/video/components/player/index.tsx | 4 +- .../poster-image-block-control/index.tsx | 4 +- .../components/poster-panel/index.native.js | 2 +- .../video/components/poster-panel/index.tsx | 10 +- .../privacy-and-rating-panel/index.native.js | 12 +- .../privacy-and-rating-panel/index.tsx | 2 +- .../privacy-and-rating-settings.native.js | 12 +- .../privacy-and-rating-settings.tsx | 2 +- .../video/components/tracks-control/index.tsx | 6 +- .../components/tracks-control/track-form.tsx | 2 +- .../video-not-owned-warning/index.native.js | 2 +- .../components/videopress-uploader/index.js | 4 +- .../blocks/video/deprecated/index.tsx | 6 +- .../block-editor/blocks/video/edit.native.js | 14 +-- .../client/block-editor/blocks/video/edit.tsx | 10 +- .../block-editor/blocks/video/index.native.ts | 2 +- .../client/block-editor/blocks/video/view.ts | 2 +- .../block-editor/extend/core-video/index.js | 4 +- .../client/block-editor/extensions/index.ts | 4 +- .../hooks/use-sync-media/index.native.js | 6 +- .../hooks/use-sync-media/index.ts | 8 +- .../hooks/use-video-data-update/index.ts | 2 +- .../hooks/use-video-data/index.ts | 2 +- .../hooks/use-video-player/index.ts | 10 +- .../hooks/use-video-poster-data/index.ts | 2 +- .../utils/add-token-iframe-source.js | 4 +- .../block-editor/utils/editor-image-url.ts | 2 +- .../utils/is-local-file.native.js | 4 +- .../src/client/block-editor/utils/video.ts | 4 +- .../components/timestamp-control/index.tsx | 10 +- .../hooks/use-resumable-uploader/index.ts | 2 +- .../src/client/lib/connection/index.ts | 8 +- .../src/client/lib/fetch-video-item/index.ts | 14 +-- .../lib/get-media-token/index.native.ts | 12 +- .../src/client/lib/get-media-token/index.ts | 12 +- .../videopress/src/client/lib/poster/index.ts | 12 +- .../src/client/lib/token-bridge/index.ts | 4 +- .../videopress/src/client/lib/url/index.ts | 18 +-- .../src/client/lib/video-tracks/index.ts | 14 +-- .../videopress/src/client/state/actions.js | 10 +- .../videopress/src/client/state/reducers.js | 2 +- .../videopress/src/client/state/resolvers.js | 2 +- .../client/state/utils/video-is-private.ts | 6 +- .../map-object-keys-to-camel-case/index.ts | 6 +- .../videopress/src/client/utils/time/index.ts | 2 +- .../extract-video-chapters/index.ts | 8 +- .../generate-chapters-file/index.ts | 6 +- .../video-chapters/validate-chapters/index.ts | 4 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../dashboard/components/dashboard/index.jsx | 2 +- .../components/global-notices/index.jsx | 2 +- .../global-notices/store/actions.js | 8 +- .../components/module-control/index.jsx | 12 +- .../store/actions/jetpack-settings.js | 10 +- .../wordads/src/dashboard/store/controls.js | 4 +- .../wordads/src/dashboard/store/resolvers.js | 4 +- ...fine-palette-colors-as-static-variables.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../src/js/components/branded-card/index.jsx | 6 +- .../js/components/check-circle-icon/index.jsx | 6 +- .../src/js/components/check-icon/index.jsx | 6 +- .../js/components/close-circle-icon/index.jsx | 6 +- .../src/js/components/close-icon/index.jsx | 6 +- .../js/components/connected-card/index.jsx | 2 +- .../js/components/connection-card/index.jsx | 14 +-- .../components/disconnect-site-link/index.jsx | 2 +- .../js/components/disconnected-card/index.jsx | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + projects/plugins/beta/src/admin/admin.js | 6 +- projects/plugins/beta/src/admin/updates.js | 6 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../src/js/components/admin-page/index.tsx | 2 +- .../plugins/crm/src/js/data/hooks/queries.ts | 2 +- .../src/js/state/automations-admin/util.ts | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../debug-helper/modules/inc/js/loader.js | 2 +- projects/plugins/jetpack/_inc/client/admin.js | 2 +- .../at-a-glance/backup-upgrade/bar-chart.tsx | 2 +- .../at-a-glance/backup-upgrade/index.tsx | 2 +- .../at-a-glance/backup-upgrade/popup.tsx | 2 +- .../_inc/client/at-a-glance/backups.jsx | 4 +- .../jetpack/_inc/client/at-a-glance/index.jsx | 4 +- .../_inc/client/at-a-glance/jetpack-ai.jsx | 2 +- .../jetpack/_inc/client/at-a-glance/scan.jsx | 4 +- .../_inc/client/at-a-glance/search.jsx | 2 +- .../_inc/client/at-a-glance/stats/index.jsx | 2 +- .../_inc/client/at-a-glance/test/fixtures.js | 4 +- .../_inc/client/components/banner/index.jsx | 2 +- .../contextualized-connection/index.jsx | 2 +- .../components/dash-item/test/fixtures.js | 4 +- .../components/jetpack-banner/index.jsx | 2 +- .../components/jetpack-benefits/index.jsx | 8 +- .../notice-action-reconnect.jsx | 2 +- .../jetpack-notices/plan-conflict-warning.jsx | 2 +- .../connect-module-options.jsx | 4 +- .../with-module-settings-form-helpers.jsx | 32 ++--- .../_inc/client/components/popover/index.jsx | 2 +- .../_inc/client/components/popover/util.js | 2 +- .../components/reconnect-modal/index.jsx | 2 +- .../_inc/client/components/search/index.jsx | 2 +- .../client/components/tree-selector/utils.jsx | 2 +- .../_inc/client/discussion/comments.jsx | 4 +- .../jetpack/_inc/client/earn/index.jsx | 4 +- .../_inc/client/lib/decode-entities/index.js | 2 +- .../_inc/client/lib/device-detector/index.js | 2 +- .../_inc/client/lib/plans/constants.js | 54 ++++---- .../_inc/client/lib/touch-detect/index.js | 2 +- projects/plugins/jetpack/_inc/client/main.jsx | 14 +-- .../client/my-plan/my-plan-header/index.js | 2 +- .../jetpack/_inc/client/newsletter/index.jsx | 2 +- .../newsletter/newsletter-categories.jsx | 2 +- .../_inc/client/newsletter/newsletter.jsx | 2 +- .../client/newsletter/paid-newsletter.jsx | 2 +- .../newsletter/subscriptions-settings.jsx | 2 +- .../jetpack/_inc/client/notices/index.js | 30 ++--- .../_inc/client/performance/search.jsx | 4 +- .../_inc/client/performance/test/fixtures.js | 6 +- .../client/portals/plugin-deactivation.jsx | 12 +- .../jetpack/_inc/client/pro-status/index.jsx | 6 +- .../product-description/test/fixtures.js | 2 +- .../_inc/client/product-descriptions/utils.js | 6 +- .../prompts/feature-prompt/test/component.js | 4 +- .../product-suggestions/test/fixtures.js | 2 +- .../prompts/resource-prompt/index.jsx | 2 +- .../prompts/site-type/test/component.js | 2 +- .../recommendations/summary/test/fixtures.js | 36 +++--- .../utils/compute-max-suggested-discount.js | 8 +- .../utils/generate-checkout-link.js | 10 +- .../recommendations/utils/is-coupon-valid.js | 2 +- .../_inc/client/security/allowList.jsx | 4 +- .../jetpack/_inc/client/security/index.jsx | 2 +- .../jetpack/_inc/client/security/sso.jsx | 2 +- .../jetpack/_inc/client/security/waf.jsx | 6 +- .../_inc/client/sharing/share-buttons.jsx | 4 +- .../_inc/client/state/at-a-glance/reducer.js | 80 ++++++------ .../_inc/client/state/connection/reducer.js | 74 +++++------ .../_inc/client/state/dev-version/reducer.js | 2 +- .../client/state/disconnect-survey/reducer.js | 6 +- .../client/state/initial-state/reducer.js | 102 +++++++-------- .../_inc/client/state/intro-offers/reducer.js | 8 +- .../client/state/jetpack-notices/reducer.js | 12 +- .../_inc/client/state/licensing/reducer.js | 24 ++-- .../_inc/client/state/modules/reducer.js | 68 +++++----- .../_inc/client/state/plans/reducer.js | 2 +- .../_inc/client/state/products/reducer.js | 4 +- .../_inc/client/state/publicize/reducer.js | 4 +- .../state/recommendations/onboarding-utils.ts | 6 +- .../_inc/client/state/redux-store-minimal.js | 2 +- .../jetpack/_inc/client/state/redux-store.js | 2 +- .../state/rewind/preflight/selectors.js | 10 +- .../client/state/rewind/preflight/utils.js | 2 +- .../_inc/client/state/rewind/reducer.js | 4 +- .../jetpack/_inc/client/state/scan/reducer.js | 8 +- .../_inc/client/state/search/reducer.js | 6 +- .../_inc/client/state/settings/actions.js | 4 +- .../_inc/client/state/settings/reducer.js | 38 +++--- .../client/state/site-products/reducer.js | 26 ++-- .../_inc/client/state/site-verify/reducer.js | 4 +- .../_inc/client/state/site/plugins/reducer.js | 16 +-- .../jetpack/_inc/client/state/site/reducer.js | 118 +++++++++--------- .../_inc/client/state/tracking/reducer.js | 6 +- .../jetpack/_inc/client/state/waf/actions.js | 2 +- .../jetpack/_inc/client/state/waf/reducer.js | 10 +- .../jetpack/_inc/client/test/test-utils.js | 16 +-- .../jetpack/_inc/client/traffic/blaze.jsx | 2 +- .../_inc/client/traffic/related-posts.jsx | 2 +- .../client/traffic/seo/custom-seo-titles.jsx | 8 +- .../_inc/client/utils/onkeydown-callback.js | 2 +- .../jetpack/_inc/client/writing/composing.jsx | 4 +- .../_inc/client/writing/custom-css.jsx | 2 +- .../client/writing/theme-enhancements.jsx | 6 +- .../_inc/client/writing/writing-media.jsx | 10 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../dropdown-content.tsx | 2 +- .../ai-assistant-toolbar-dropdown/index.tsx | 4 +- .../components/message/block-message.tsx | 2 +- .../ai-assistant/components/message/index.tsx | 2 +- .../components/upgrade-prompt/index.tsx | 8 +- .../extensions/ai-assistant/index.ts | 6 +- .../components/ai-assistant-bar/index.tsx | 2 +- .../ai-assistant-toolbar-button/index.tsx | 4 +- .../extensions/jetpack-contact-form/index.tsx | 6 +- .../with-ui-handler-data-provider.tsx | 14 +-- .../hooks/use-selected-blocks/index.ts | 2 +- .../ai-assistant-toolbar-dropdown/index.tsx | 2 +- .../inline-extensions/get-block-handler.tsx | 4 +- .../lib/is-possible-to-extend-block.ts | 2 +- .../inline-extensions/with-ai-extension.tsx | 2 +- .../ai-assistant/lib/connection/index.ts | 2 +- .../ai-assistant/lib/prompt/backend-prompt.ts | 20 +-- .../blocks/ai-assistant/lib/prompt/index.ts | 2 +- .../ai-assistant/lib/utils/block-content.ts | 10 +- .../ai-assistant/lib/utils/compare-blocks.ts | 2 +- .../blocks/ai-assistant/transforms/index.tsx | 4 +- .../blocks/ai-chat/question-answer.js | 16 +-- .../extensions/blocks/button/test/edit.js | 2 +- .../extensions/blocks/cookie-consent/edit.js | 8 +- .../extensions/blocks/cookie-consent/save.js | 4 +- .../extensions/blocks/donations/utils.js | 2 +- .../blocks/eventbrite/deprecated/v1/index.js | 4 +- .../extensions/blocks/eventbrite/utils.js | 8 +- .../blocks/gif/test/use-fetch-giphy-data.js | 2 +- .../blocks/google-calendar/utils.js | 12 +- .../blocks/google-docs-embed/edit.js | 6 +- .../blocks/google-docs-embed/embed.js | 14 +-- .../blocks/image-compare/test/edit.js | 2 +- .../blocks/mailchimp/test/controls.js | 2 +- .../extensions/blocks/mailchimp/test/edit.js | 2 +- .../jetpack/extensions/blocks/map/edit.js | 8 +- .../extensions/blocks/map/get-coordinates.js | 6 +- .../extensions/blocks/pinterest/utils.js | 2 +- .../components/podcast-player.js | 4 +- .../extensions/blocks/podcast-player/utils.js | 8 +- .../_inc/remove-block-keep-content.js | 2 +- .../blocks/premium-content/_inc/tab.js | 14 +-- .../extensions/blocks/premium-content/edit.js | 10 +- .../blocks/premium-content/editor.js | 2 +- .../premium-content/logged-out-view/save.js | 2 +- .../premium-content/subscriber-view/save.js | 2 +- .../blocks/recurring-payments/edit.jsx | 6 +- .../blocks/recurring-payments/test/edit.js | 2 +- .../related-posts/hooks/use-related-posts.js | 2 +- .../related-posts/hooks/use-status-toggle.js | 4 +- .../simple-payments/deprecated/v2/edit.js | 8 +- .../extensions/blocks/simple-payments/edit.js | 8 +- .../blocks/story/player/modal/aria-helper.js | 6 +- .../blocks/story/player/modal/index.js | 2 +- .../blocks/story/player/store/actions.js | 44 +++---- .../blocks/story/player/store/effects.js | 12 +- .../blocks/story/player/store/middlewares.js | 4 +- .../blocks/story/player/store/reducer.js | 2 +- .../blocks/story/player/store/selectors.js | 32 ++--- .../subscriptions/deprecated/v7/save.js | 2 +- .../deprecated/v1/layout/index.js | 6 +- .../deprecated/v1/layout/mosaic/ratios.js | 6 +- .../deprecated/v1/layout/mosaic/resize.js | 6 +- .../deprecated/v2/layout/mosaic/ratios.js | 6 +- .../deprecated/v2/utils/index.js | 18 +-- .../deprecated/v3/layout/mosaic/ratios.js | 6 +- .../deprecated/v3/utils/index.js | 22 ++-- .../deprecated/v4/layout/mosaic/ratios.js | 6 +- .../deprecated/v4/layout/mosaic/resize.js | 6 +- .../deprecated/v4/utils/index.js | 20 +-- .../deprecated/v6/layout/mosaic/ratios.js | 6 +- .../deprecated/v6/utils/index.js | 20 +-- .../extensions/blocks/tiled-gallery/editor.js | 2 +- .../tiled-gallery/layout/mosaic/ratios.js | 6 +- .../tiled-gallery/layout/mosaic/resize.js | 6 +- .../layout/mosaic/resize.native.js | 6 +- .../blocks/tiled-gallery/utils/index.js | 20 +-- .../extensions/blocks/tiled-gallery/view.js | 2 +- .../blocks/videopress/components.js | 12 +- .../blocks/videopress/deprecated/v2/utils.js | 6 +- .../extensions/blocks/videopress/edit.js | 2 +- .../extensions/blocks/videopress/editor.js | 12 +- .../blocks/videopress/tracks-editor.js | 10 +- .../extensions/blocks/videopress/utils.js | 8 +- .../components/transform-control/index.js | 10 +- .../utils/extract-video-chapters.ts | 8 +- .../utils/generate-chapters-file.ts | 4 +- .../blocks/voice-to-content/edit.tsx | 8 +- .../hooks/use-transcription-creator/index.ts | 2 +- .../hooks/use-transcription-inserter/index.ts | 2 +- projects/plugins/jetpack/extensions/editor.js | 2 +- .../extended-blocks/core-embed/facebook.js | 4 +- .../extended-blocks/core-embed/instagram.js | 4 +- .../components/ai-toolbar-button.tsx | 4 +- .../extended-blocks/core-site-logo/index.tsx | 10 +- .../core-social-links/index.js | 8 +- .../extended-blocks/paid-blocks/components.js | 8 +- .../paid-blocks/media-placeholder.js | 2 +- .../paid-blocks/render-paid-icon.js | 6 +- .../extended-blocks/paid-blocks/utils.js | 20 +-- .../paid-blocks/with-upgrade-banner.jsx | 2 +- .../components/usage-bar/index.tsx | 2 +- .../components/usage-panel/index.tsx | 10 +- .../plugins/ai-content-lens/editor.js | 2 +- .../extend/ai-post-excerpt/index.tsx | 2 +- .../components/image-actions-panel-row.js | 2 +- .../components/qr-post.js | 2 +- .../hooks/use-site-logo.js | 4 +- .../utils/handle-download-qr-code.js | 6 +- .../shared/block-editor-asset-loader.js | 32 ++--- .../jetpack/extensions/shared/block-styles.js | 4 +- .../components/number-control/index.jsx | 2 +- ...create-block-from-inner-blocks-template.js | 2 +- .../jetpack/extensions/shared/currencies.js | 8 +- .../jetpack/extensions/shared/debounce.js | 2 +- .../extensions/shared/execution-lock.js | 10 +- .../external-media/media-service/index.ts | 32 ++--- .../shared/get-allowed-mime-types.js | 12 +- .../shared/get-category-with-fallbacks.js | 2 +- .../extensions/shared/get-connect-url.js | 4 +- .../shared/get-validated-attributes.js | 13 +- .../jetpack/extensions/shared/is-active.js | 2 +- .../extensions/shared/is-offline-mode.js | 2 +- .../memberships/subscribers-affirmation.js | 4 +- .../extensions/shared/memberships/utils.js | 2 +- .../extensions/shared/plugin-management.js | 6 +- .../shared/register-jetpack-block.js | 24 ++-- .../shared/register-jetpack-block.native.js | 24 ++-- .../extensions/shared/test-embed-url.js | 4 +- .../extensions/shared/test/block-fixtures.js | 40 +++--- .../extensions/shared/use-plan-type/index.ts | 2 +- .../extensions/shared/use-ref-interval.ts | 4 +- .../extensions/shared/wait-for-editor.js | 2 +- .../extensions/store/wordpress-com/actions.ts | 12 +- .../extensions/store/wordpress-com/index.ts | 4 +- .../widget-visibility/editor/index.jsx | 4 +- .../jetpack/tests/e2e/helpers/sync-helper.js | 14 +-- .../jetpack/tests/e2e/helpers/waf-helper.js | 4 +- .../jetpack/tests/e2e/specs/sync/sync.test.js | 2 +- .../tools/webpack.config.extensions.js | 8 +- .../plugins/jetpack/tools/webpack.helpers.js | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../components/hooks/use-migration-status.ts | 4 +- .../src/js/components/migration/error.tsx | 2 +- .../src/js/components/migration/index.tsx | 2 +- .../src/js/components/migration/loading.tsx | 2 +- .../src/js/components/migration/progress.tsx | 2 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../src/js/components/alert-icon/index.jsx | 2 +- .../src/js/components/button-group/index.jsx | 4 +- .../src/js/components/diff-viewer/index.jsx | 4 +- .../src/js/components/error-section/index.tsx | 2 +- .../js/components/interstitial-page/index.jsx | 6 +- .../protect/src/js/components/logo/index.tsx | 4 +- .../src/js/components/marked-lines/index.jsx | 8 +- .../src/js/components/navigation/badge.jsx | 4 +- .../js/components/paid-plan-gate/index.tsx | 2 +- .../src/js/components/pricing-table/index.jsx | 6 +- .../src/js/components/progress-bar/index.jsx | 2 +- .../components/protect-check-icon/index.tsx | 2 +- .../components/seventy-five-layout/index.jsx | 10 +- .../js/components/threat-fix-header/index.jsx | 10 +- .../src/js/components/threats-list/empty.jsx | 2 +- .../threats-list/use-threats-list.js | 14 +-- .../src/js/hooks/use-onboarding/index.jsx | 2 +- .../src/js/hooks/use-protect-data/index.js | 16 +-- .../src/js/hooks/use-waf-data/index.jsx | 2 +- projects/plugins/protect/src/js/index.tsx | 2 +- .../protect/src/js/routes/firewall/index.jsx | 22 ++-- .../js/routes/scan/history/status-filters.jsx | 6 +- .../routes/scan/scan-section-navigation.jsx | 2 +- .../plugins/protect/src/js/state/actions.js | 14 +-- .../plugins/protect/src/js/state/selectors.js | 6 +- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../search/tests/e2e/helpers/search-helper.js | 16 +-- ...ate-jsdoc-comments-for-wp-coding-standards | 5 + .../publicize-panel/description.jsx | 4 +- .../src/js/hooks/use-product-info/index.js | 2 +- .../social/tests/e2e/flows/connection.js | 2 +- .../e2e/pages/wp-admin/jetpack-social.js | 2 +- tools/cli/bin/jetpack.js | 2 +- tools/cli/commands/build.js | 28 ++--- tools/cli/commands/changelog.js | 50 ++++---- tools/cli/commands/clean.js | 38 +++--- tools/cli/commands/cli.js | 8 +- tools/cli/commands/dependencies.js | 2 +- tools/cli/commands/docker.js | 36 +++--- tools/cli/commands/docs.js | 4 +- tools/cli/commands/draft.js | 4 +- tools/cli/commands/generate.js | 54 ++++---- tools/cli/commands/install.js | 2 +- tools/cli/commands/noop.js | 2 +- tools/cli/commands/phan.js | 4 +- tools/cli/commands/release.js | 16 +-- tools/cli/commands/rsync.js | 38 +++--- tools/cli/commands/test.js | 12 +- tools/cli/commands/watch.js | 8 +- tools/cli/helpers/analytics.js | 2 +- tools/cli/helpers/checkEnvironment.js | 20 +-- tools/cli/helpers/dependencyAnalysis.js | 20 +-- tools/cli/helpers/docker-config.js | 16 +-- tools/cli/helpers/filter-stream.js | 4 +- tools/cli/helpers/format-duration.js | 2 +- tools/cli/helpers/github.js | 6 +- tools/cli/helpers/install.js | 28 ++--- tools/cli/helpers/json.js | 60 ++++----- tools/cli/helpers/list-project-files.js | 4 +- tools/cli/helpers/mergeDirs.js | 4 +- tools/cli/helpers/normalizeArgv.js | 8 +- tools/cli/helpers/prefix-stream.js | 6 +- tools/cli/helpers/projectHelpers.js | 8 +- .../cli/helpers/projectNameTransformations.js | 22 ++-- tools/cli/helpers/promptForProject.js | 6 +- tools/cli/helpers/runCommand.js | 4 +- tools/cli/helpers/searchReplaceInFolder.js | 6 +- tools/e2e-commons/bin/performance.js | 10 +- tools/e2e-commons/bin/tunnel.js | 14 +-- tools/e2e-commons/bin/update-beta-version.js | 8 +- tools/e2e-commons/env/prerequisites.js | 26 ++-- tools/e2e-commons/flows/jetpack-connect.js | 6 +- tools/e2e-commons/flows/log-in.js | 6 +- tools/e2e-commons/helpers/blocks-helper.js | 8 +- .../helpers/partner-provisioning.js | 2 +- tools/e2e-commons/helpers/plan-helper.js | 16 +-- tools/e2e-commons/helpers/utils-helper.js | 30 ++--- .../pages/frontend/postFrontend.js | 2 +- tools/e2e-commons/pages/page-actions.js | 62 ++++----- .../pages/wp-admin/blocks/mailchimp.js | 2 +- .../pages/wp-admin/blocks/subscribe.js | 2 +- .../pages/wp-admin/jetpack-dashboard.js | 6 +- tools/e2e-commons/pages/wp-page.js | 4 +- tools/e2e-commons/reporters/screenshot.js | 2 +- tools/eslint-excludelist.json | 1 - .../jetpack-live-branches.user.js | 36 +++--- tools/js-tools/await-packagist-updates.mjs | 4 +- tools/js-tools/eslintrc/base.js | 21 ++-- tools/js-tools/git-hooks/pre-commit-hook.js | 30 ++--- tools/js-tools/git-hooks/pre-push-hook.mjs | 8 +- tools/js-tools/lint-gh-actions.js | 18 +-- tools/js-tools/list-gh-secrets.mjs | 4 +- tools/js-tools/load-eslint-ignore.js | 2 +- tools/js-tools/mass-update-gh-secret.mjs | 8 +- tools/js-tools/package.json | 2 +- 970 files changed, 3746 insertions(+), 3483 deletions(-) create mode 100644 projects/github-actions/repo-gardening/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/github-actions/required-review/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/github-actions/test-results-to-slack/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/ai-client/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/analytics/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/api/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/boost-score-api/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/components/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/critical-css-gen/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/eslint-changed/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/eslint-config-target-es/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/i18n-check-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/i18n-loader-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/idc/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/licensing/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/partner-coupon/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/publicize-components/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/react-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/script-data/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/shared-extension-utils/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/social-logos/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/storybook/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/svelte-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/videopress-core/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/js-packages/webpack-config/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/assets/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/backup/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/blaze/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/explat/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/forms/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/my-jetpack/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/search/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/videopress/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/packages/wordads/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/automattic-for-agencies-client/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/beta/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/crm/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/debug-helper/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/jetpack/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/migration/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/protect/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/search/changelog/update-jsdoc-comments-for-wp-coding-standards create mode 100644 projects/plugins/social/changelog/update-jsdoc-comments-for-wp-coding-standards diff --git a/.github/files/build-reminder-comment/check-test-reminder-comment.js b/.github/files/build-reminder-comment/check-test-reminder-comment.js index f9f8a8f4df83a..cd9a4b43eca60 100644 --- a/.github/files/build-reminder-comment/check-test-reminder-comment.js +++ b/.github/files/build-reminder-comment/check-test-reminder-comment.js @@ -9,12 +9,12 @@ const getCheckComments = require( './get-check-comments.js' ); * meaning that Jetpack is being built. Or `packages/jetpack-mu-wpcom`, * for the jetpack-mu-wpcom-plugin used on WordPress.com is being built. * - * @param {GitHub} github - Initialized Octokit REST client. - * @param {string} owner - Repository owner. - * @param {string} repo - Repository name. - * @param {string} number - PR number. - * @param {Core} core - A reference to the @actions/core package - * @returns {Promise} Promise resolving to an array of project strings needing testing. + * @param {GitHub} github - Initialized Octokit REST client. + * @param {string} owner - Repository owner. + * @param {string} repo - Repository name. + * @param {string} number - PR number. + * @param {Core} core - A reference to the @actions/core package + * @return {Promise} Promise resolving to an array of project strings needing testing. */ async function touchedProjectsNeedingTesting( github, owner, repo, number, core ) { const changed = JSON.parse( process.env.CHANGED ); @@ -46,7 +46,7 @@ async function touchedProjectsNeedingTesting( github, owner, repo, number, core * @param {github} github - Pre-authenticated octokit/rest.js client with pagination plugins * @param {object} context - Context of the workflow run * @param {core} core - A reference to the @actions/core package - * @returns {Promise} Promise resolving to an object with the following properties: + * @return {Promise} Promise resolving to an object with the following properties: * - {commentId} - a comment ID, or 0 if no comment is found. * - {projects} - an array of project strings needing testing. */ diff --git a/.github/files/build-reminder-comment/get-check-comments.js b/.github/files/build-reminder-comment/get-check-comments.js index 2c81c8552c6e9..16305ed28ccbe 100644 --- a/.github/files/build-reminder-comment/get-check-comments.js +++ b/.github/files/build-reminder-comment/get-check-comments.js @@ -10,7 +10,7 @@ const cache = {}; * @param {string} number - Issue number. * @param {string} testCommentIndicator - A piece of text unique to all test reminder comments. * @param {core} core - A reference to the @actions/core package - * @returns {Promise} Promise resolving to an array of comment IDs. + * @return {Promise} Promise resolving to an array of comment IDs. */ async function getCheckComments( github, owner, repo, number, testCommentIndicator, core ) { const testCommentIDs = []; diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs index 56644644bfeeb..5512a5b502207 100644 --- a/.pnpmfile.cjs +++ b/.pnpmfile.cjs @@ -4,7 +4,7 @@ * We could generally do the same with pnpm.overrides in packages.json, but this allows for comments. * * @param {object} pkg - Dependency package.json contents. - * @returns {object} Modified pkg. + * @return {object} Modified pkg. */ function fixDeps( pkg ) { // Deps tend to get outdated due to a slow release cycle. @@ -120,7 +120,7 @@ function fixDeps( pkg ) { * This can't be done with pnpm.overrides. * * @param {object} pkg - Dependency package.json contents. - * @returns {object} Modified pkg. + * @return {object} Modified pkg. */ function fixPeerDeps( pkg ) { // Indirect deps that still depend on React <18. @@ -165,9 +165,9 @@ function fixPeerDeps( pkg ) { * Pnpm package hook. * * @see https://pnpm.io/pnpmfile#hooksreadpackagepkg-context-pkg--promisepkg - * @param {object} pkg - Dependency package.json contents. + * @param {object} pkg - Dependency package.json contents. * @param {object} context - Pnpm object of some sort. - * @returns {object} Modified pkg. + * @return {object} Modified pkg. */ function readPackage( pkg, context ) { if ( pkg.name ) { @@ -182,7 +182,7 @@ function readPackage( pkg, context ) { * * @see https://pnpm.io/pnpmfile#hooksafterallresolvedlockfile-context-lockfile--promiselockfile * @param {object} lockfile - Lockfile data. - * @returns {object} Modified lockfile. + * @return {object} Modified lockfile. */ function afterAllResolved( lockfile ) { // If there's only one "importer", it's probably pnpx rather than the monorepo. Don't interfere. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96995a9007a03..16b0f80945e01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,7 +4,7 @@ settings: autoInstallPeers: false excludeLinksFromLockfile: false -pnpmfileChecksum: hogs2xjgnkyiea7znn3abfx4o4 +pnpmfileChecksum: 3fczoaai2pdpha422df6rcexqm importers: @@ -4827,7 +4827,7 @@ importers: version: 6.21.0(eslint@8.57.0)(typescript@5.0.4) '@wordpress/eslint-plugin': specifier: 20.2.0 - version: 20.2.0(mikchdjuqfweuug63xtkjtmioa) + version: 20.2.0(j6slpcl3735cgfqmecli3gsnuy) '@wordpress/jest-console': specifier: 8.5.0 version: 8.5.0(jest@29.7.0) @@ -4865,8 +4865,8 @@ importers: specifier: 5.4.0 version: 5.4.0(eslint@8.57.0) eslint-plugin-jsdoc: - specifier: 46.10.1 - version: 46.10.1(eslint@8.57.0) + specifier: 48.8.3 + version: 48.8.3(eslint@8.57.0) eslint-plugin-jsx-a11y: specifier: 6.8.0 version: 6.8.0(eslint@8.57.0) @@ -5787,8 +5787,8 @@ packages: '@emotion/weak-memoize@0.4.0': resolution: {integrity: sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==} - '@es-joy/jsdoccomment@0.41.0': - resolution: {integrity: sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==} + '@es-joy/jsdoccomment@0.46.0': + resolution: {integrity: sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==} engines: {node: '>=16'} '@esbuild/aix-ppc64@0.21.5': @@ -9634,9 +9634,9 @@ packages: jest: optional: true - eslint-plugin-jsdoc@46.10.1: - resolution: {integrity: sha512-x8wxIpv00Y50NyweDUpa+58ffgSAI5sqe+zcZh33xphD0AVh+1kqr1ombaTRb7Fhpove1zfUuujlX9DWWBP5ag==} - engines: {node: '>=16'} + eslint-plugin-jsdoc@48.8.3: + resolution: {integrity: sha512-AtIvwwW9D17MRkM0Z0y3/xZYaa9mdAvJrkY6fU/HNUwGbmMtHVvK4qRM9CDixGVtfNrQitb8c6zQtdh6cTOvLg==} + engines: {node: '>=18'} peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 @@ -11932,6 +11932,10 @@ packages: parse-diff@0.8.1: resolution: {integrity: sha512-0QG0HqwXCC/zMohOlaxkQmV1igZq1LQ6xsv/ziex6TDbY0GFxr3TDJN+/aHjWH3s2WTysSW3Bhs9Yfh6DOelFA==} + parse-imports@2.1.1: + resolution: {integrity: sha512-TDT4HqzUiTMO1wJRwg/t/hYk8Wdp3iF/ToMIlAoVQfL1Xs/sTxq1dKWSMjMbQmIarfWKymOyly40+zmPHXMqCA==} + engines: {node: '>= 18'} + parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} @@ -13178,6 +13182,9 @@ packages: resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} engines: {node: '>=14.16'} + slashes@3.0.12: + resolution: {integrity: sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==} + slice-ansi@0.0.4: resolution: {integrity: sha512-up04hB2hR92PgjpyU3y/eg91yIBILyjVY26NvvciY3EVVPjybkMszMpXQ9QAkcS3I5rtJBDLoTxxg+qvW8c7rw==} engines: {node: '>=0.10.0'} @@ -13546,6 +13553,10 @@ packages: resolution: {integrity: sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==} engines: {node: ^14.18.0 || >=16.0.0} + synckit@0.9.1: + resolution: {integrity: sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==} + engines: {node: ^14.18.0 || >=16.0.0} + tabbable@5.3.3: resolution: {integrity: sha512-QD9qKY3StfbZqWOPLp0++pOrAVb/HbUi5xCc8cUo4XjP19808oaMiDzn0leBY5mCespIBM0CIZePzZjgzR83kA==} @@ -15557,7 +15568,7 @@ snapshots: '@emotion/weak-memoize@0.4.0': {} - '@es-joy/jsdoccomment@0.41.0': + '@es-joy/jsdoccomment@0.46.0': dependencies: comment-parser: 1.4.1 esquery: 1.6.0 @@ -19202,7 +19213,7 @@ snapshots: dependencies: '@babel/runtime': 7.24.7 - '@wordpress/eslint-plugin@20.2.0(mikchdjuqfweuug63xtkjtmioa)': + '@wordpress/eslint-plugin@20.2.0(j6slpcl3735cgfqmecli3gsnuy)': dependencies: '@babel/core': 7.24.7 '@babel/eslint-parser': 7.24.7(@babel/core@7.24.7)(eslint@8.57.0) @@ -19215,7 +19226,7 @@ snapshots: eslint-config-prettier: 9.1.0(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.0.4))(eslint@8.57.0) eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.0.4))(eslint@8.57.0)(typescript@5.0.4))(eslint@8.57.0)(jest@29.7.0)(typescript@5.0.4) - eslint-plugin-jsdoc: 46.10.1(eslint@8.57.0) + eslint-plugin-jsdoc: 48.8.3(eslint@8.57.0) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0) eslint-plugin-playwright: 0.22.2(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.0)(typescript@5.0.4))(eslint@8.57.0)(typescript@5.0.4))(eslint@8.57.0)(jest@29.7.0)(typescript@5.0.4))(eslint@8.57.0) eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(wp-prettier@3.0.3) @@ -21620,18 +21631,19 @@ snapshots: - supports-color - typescript - eslint-plugin-jsdoc@46.10.1(eslint@8.57.0): + eslint-plugin-jsdoc@48.8.3(eslint@8.57.0): dependencies: - '@es-joy/jsdoccomment': 0.41.0 + '@es-joy/jsdoccomment': 0.46.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 - debug: 4.3.4 + debug: 4.3.6 escape-string-regexp: 4.0.0 eslint: 8.57.0 esquery: 1.6.0 - is-builtin-module: 3.2.1 + parse-imports: 2.1.1 semver: 7.6.3 spdx-expression-parse: 4.0.0 + synckit: 0.9.1 transitivePeerDependencies: - supports-color @@ -24552,6 +24564,11 @@ snapshots: parse-diff@0.8.1: {} + parse-imports@2.1.1: + dependencies: + es-module-lexer: 1.5.4 + slashes: 3.0.12 + parse-json@5.2.0: dependencies: '@babel/code-frame': 7.24.7 @@ -25900,6 +25917,8 @@ snapshots: slash@5.1.0: {} + slashes@3.0.12: {} + slice-ansi@0.0.4: {} smart-buffer@4.2.0: {} @@ -26362,6 +26381,11 @@ snapshots: '@pkgr/core': 0.1.1 tslib: 2.6.3 + synckit@0.9.1: + dependencies: + '@pkgr/core': 0.1.1 + tslib: 2.6.3 + tabbable@5.3.3: {} tannin@1.2.0: diff --git a/projects/github-actions/repo-gardening/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/github-actions/repo-gardening/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/github-actions/repo-gardening/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/github-actions/repo-gardening/src/tasks/add-labels/index.js b/projects/github-actions/repo-gardening/src/tasks/add-labels/index.js index 15b8973901e6d..3b8f90a1863d2 100644 --- a/projects/github-actions/repo-gardening/src/tasks/add-labels/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/add-labels/index.js @@ -11,7 +11,7 @@ const getFiles = require( '../../utils/get-files' ); * - Capitalize. * * @param {string} name - Feature name. - * @returns {string} Cleaned up feature name. + * @return {string} Cleaned up feature name. */ function cleanName( name ) { const name_exceptions = { @@ -51,13 +51,13 @@ function cleanName( name ) { /** * Build a list of labels to add to the issue, based off our file list. * - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {string} owner - Repository owner. - * @param {string} repo - Repository name. - * @param {string} number - PR number. + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {string} owner - Repository owner. + * @param {string} repo - Repository name. + * @param {string} number - PR number. * @param {boolean} isDraft - Whether the pull request is a draft. - * @param {boolean} isRevert - Whether the pull request is a revert. - * @returns {Promise} Promise resolving to an array of keywords we'll search for. + * @param {boolean} isRevert - Whether the pull request is a revert. + * @return {Promise} Promise resolving to an array of keywords we'll search for. */ async function getLabelsToAdd( octokit, owner, repo, number, isDraft, isRevert ) { const keywords = new Set(); diff --git a/projects/github-actions/repo-gardening/src/tasks/check-description/index.js b/projects/github-actions/repo-gardening/src/tasks/check-description/index.js index 5083f92d12ff9..f22452efcd55e 100644 --- a/projects/github-actions/repo-gardening/src/tasks/check-description/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/check-description/index.js @@ -19,7 +19,7 @@ const getLabels = require( '../../utils/labels/get-labels' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasStatusLabels( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -34,7 +34,7 @@ async function hasStatusLabels( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasNeedsReviewLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -49,7 +49,7 @@ async function hasNeedsReviewLabel( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasProgressLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -62,7 +62,7 @@ async function hasProgressLabel( octokit, owner, repo, number ) { * * @param {string} plugin - Plugin name. * @param {object} nextMilestone - Information about next milestone as returnde by GitHub. - * @returns {Promise} Promise resolving to info about the release (code freeze, release date). + * @return {Promise} Promise resolving to info about the release (code freeze, release date). */ async function getMilestoneDates( plugin, nextMilestone ) { let releaseDate = 'none scheduled'; @@ -119,7 +119,7 @@ If you have any questions about the release process, please ask in the #jetpack- * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to info about the next release for that plugin. + * @return {Promise} Promise resolving to info about the next release for that plugin. */ async function buildMilestoneInfo( octokit, owner, repo, number ) { const plugins = await getPluginNames( octokit, owner, repo, number ); @@ -149,7 +149,7 @@ async function buildMilestoneInfo( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function getCheckComment( octokit, owner, repo, number ) { let commentID = 0; @@ -172,10 +172,10 @@ async function getCheckComment( octokit, owner, repo, number ) { /** * Compose a list item with appropriate status check and passed message * - * @param {boolean} isFailure - Boolean condition to determine if check failed. - * @param {string} checkMessage - Sentence describing successful check. - * @param {string} severity - Optional. Check severity. Could be one of `error`, `warning`, `notice` - * @returns {string} - List item with status emoji and a sentence describing check. + * @param {boolean} isFailure - Boolean condition to determine if check failed. + * @param {string} checkMessage - Sentence describing successful check. + * @param {string} severity - Optional. Check severity. Could be one of `error`, `warning`, `notice` + * @return {string} - List item with status emoji and a sentence describing check. */ function statusEntry( isFailure, checkMessage, severity = 'error' ) { const severityMap = { @@ -196,7 +196,7 @@ function statusEntry( isFailure, checkMessage, severity = 'error' ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Array} - list of affected projects without changelog entry + * @return {Array} - list of affected projects without changelog entry */ async function getChangelogEntries( octokit, owner, repo, number ) { const baseDir = getPrWorkspace(); @@ -247,7 +247,7 @@ async function getChangelogEntries( octokit, owner, repo, number ) { * * @param {WebhookPayloadPullRequest} payload - Pull request event payload. * @param {GitHub} octokit - Initialized Octokit REST client. - * @returns {string} List of checks with appropriate status emojis. + * @return {string} List of checks with appropriate status emojis. */ async function getStatusChecks( payload, octokit ) { const { body, number, head, base } = payload.pull_request; @@ -276,7 +276,7 @@ async function getStatusChecks( payload, octokit ) { * Compose a list of checks for the PR * * @param {object} statusChecks - Map of all checks with boolean as a value - * @returns {string} part of the comment with list of checks + * @return {string} part of the comment with list of checks */ function renderStatusChecks( statusChecks ) { // No PR is too small to include a description of why you made a change @@ -321,7 +321,7 @@ function renderStatusChecks( statusChecks ) { * Compose a list of recommendations based on failed checks * * @param {object} statusChecks - Map of all checks with boolean as a value - * @returns {string} part of the comment with recommendations + * @return {string} part of the comment with recommendations */ function renderRecommendations( statusChecks ) { const recommendations = { @@ -366,8 +366,8 @@ Guidelines: [/docs/writing-a-good-changelog-entry.md](https://github.com/Automat * Creates or updates a comment on PR. * * @param {WebhookPayloadPullRequest} payload - Pull request event payload. - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {string} comment - Comment string + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {string} comment - Comment string */ async function postComment( payload, octokit, comment ) { const { number } = payload.pull_request; diff --git a/projects/github-actions/repo-gardening/src/tasks/gather-support-references/index.js b/projects/github-actions/repo-gardening/src/tasks/gather-support-references/index.js index 8575b8b10ffa1..88f01c17879ea 100644 --- a/projects/github-actions/repo-gardening/src/tasks/gather-support-references/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/gather-support-references/index.js @@ -10,7 +10,7 @@ const sendSlackMessage = require( '../../utils/slack/send-slack-message' ); * Search for a previous comment from this task in our issue. * * @param {Array} issueComments - Array of all comments on that issue. - * @returns {Promise} Promise resolving to an object of information about our comment. + * @return {Promise} Promise resolving to an object of information about our comment. */ async function getListComment( issueComments ) { let commentInfo = {}; @@ -45,12 +45,12 @@ async function getListComment( issueComments ) { * - https://wordpress.com/forums/topic/xxx * - https://wordpress.com/xxx/forums/topic/xxx (for non-English forums) * - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {string} owner - Repository owner. - * @param {string} repo - Repository name. - * @param {string} number - Issue number. - * @param {Array} issueComments - Array of all comments on that issue. - * @returns {Promise} Promise resolving to an array. + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {string} owner - Repository owner. + * @param {string} repo - Repository name. + * @param {string} number - Issue number. + * @param {Array} issueComments - Array of all comments on that issue. + * @return {Promise} Promise resolving to an array. */ async function getIssueReferences( octokit, owner, repo, number, issueComments ) { const ticketReferences = []; @@ -110,7 +110,7 @@ async function getIssueReferences( octokit, owner, repo, number, issueComments ) * @param {Set} checkedRefs - Set of support references already checked. * @param {boolean} needsEscalationNote - Whether the issue needs an escalation note. * @param {string} escalationNote - String that indicates an issue was escalated. - * @returns {string} Comment body. + * @return {string} Comment body. */ function buildCommentBody( issueReferences, @@ -144,7 +144,7 @@ ${ issueReferences * @param {WebhookPayloadIssue} payload - Issue event payload. * @param {string} channel - Slack channel ID. * @param {string} message - Basic message (without the formatting). - * @returns {object} Object containing the slack message and its formatting. + * @return {object} Object containing the slack message and its formatting. */ function formatSlackMessage( payload, channel, message ) { const { issue, repository } = payload; @@ -206,7 +206,7 @@ function formatSlackMessage( payload, channel, message ) { * @param {string} commentBody - Previous comment ID. * @param {string} escalationNote - String that indicates an issue was escalated. * @param {WebhookPayloadIssue} payload - Issue event payload. - * @returns {Promise} Was the issue escalated? + * @return {Promise} Was the issue escalated? */ async function checkForEscalation( issueReferences, commentBody, escalationNote, payload ) { // No Slack tokens, we won't be able to escalate. Bail. @@ -251,12 +251,12 @@ async function checkForEscalation( issueReferences, commentBody, escalationNote, * Add or update a label on the issue to indicate a number range of support references, * once it has gathered more than 10 support references. * - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {string} repo - Repository name. - * @param {string} ownerLogin - Owner of the repository. - * @param {number} number - Issue number. + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {string} repo - Repository name. + * @param {string} ownerLogin - Owner of the repository. + * @param {number} number - Issue number. * @param {number} issueReferencesCount - Number of support references gathered in this issue. - * @returns {Promise} + * @return {Promise} */ async function addOrUpdateInteractionCountLabel( octokit, @@ -329,10 +329,10 @@ async function addOrUpdateInteractionCountLabel( /** * Creates or updates a comment on issue. * - * @param {WebhookPayloadIssue} payload - Issue event payload. - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {Array} issueReferences - Array of support references. - * @param {Array} issueComments - Array of all comments on that issue. + * @param {WebhookPayloadIssue} payload - Issue event payload. + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {Array} issueReferences - Array of support references. + * @param {Array} issueComments - Array of all comments on that issue. */ async function createOrUpdateComment( payload, octokit, issueReferences, issueComments ) { const { issue, repository } = payload; @@ -409,11 +409,11 @@ async function createOrUpdateComment( payload, octokit, issueReferences, issueCo /** * Add a label to the issue, if it does not exist yet. * - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {string} ownerLogin - Repository owner login. - * @param {string} repo - Repository name. - * @param {number} number - Issue number. - * @returns {Promise} + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {string} ownerLogin - Repository owner login. + * @param {string} repo - Repository name. + * @param {number} number - Issue number. + * @return {Promise} */ async function addHappinessLabel( octokit, ownerLogin, repo, number ) { const happinessLabel = 'Customer Report'; diff --git a/projects/github-actions/repo-gardening/src/tasks/notify-design/index.js b/projects/github-actions/repo-gardening/src/tasks/notify-design/index.js index b05ab9bf8793d..4e82adc93877b 100644 --- a/projects/github-actions/repo-gardening/src/tasks/notify-design/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/notify-design/index.js @@ -12,7 +12,7 @@ const sendSlackMessage = require( '../../utils/slack/send-slack-message' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasNeedsDesignReviewLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -27,7 +27,7 @@ async function hasNeedsDesignReviewLabel( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasNeedsDesignLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -42,7 +42,7 @@ async function hasNeedsDesignLabel( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasDesignInputRequestedLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); diff --git a/projects/github-actions/repo-gardening/src/tasks/notify-editorial/index.js b/projects/github-actions/repo-gardening/src/tasks/notify-editorial/index.js index a0d1b581fdca4..e94f9478d6447 100644 --- a/projects/github-actions/repo-gardening/src/tasks/notify-editorial/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/notify-editorial/index.js @@ -12,7 +12,7 @@ const sendSlackMessage = require( '../../utils/slack/send-slack-message' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasNeedsCopyReviewLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -27,7 +27,7 @@ async function hasNeedsCopyReviewLabel( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasNeedsCopyLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -42,7 +42,7 @@ async function hasNeedsCopyLabel( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasEditorialInputRequestedLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); diff --git a/projects/github-actions/repo-gardening/src/tasks/reply-to-customers-reminder/index.js b/projects/github-actions/repo-gardening/src/tasks/reply-to-customers-reminder/index.js index 92e8fa995314d..235584bb52718 100644 --- a/projects/github-actions/repo-gardening/src/tasks/reply-to-customers-reminder/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/reply-to-customers-reminder/index.js @@ -14,7 +14,7 @@ const sendSlackMessage = require( '../../utils/slack/send-slack-message' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - Issue number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasHighPriorityLabel( octokit, owner, repo, number ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -28,7 +28,7 @@ async function hasHighPriorityLabel( octokit, owner, repo, number ) { * @param {WebhookPayloadIssue} payload - Issue event payload. * @param {string} channel - Slack channel ID. * @param {string} message - Basic message (without the formatting). - * @returns {object} Object containing the slack message and its formatting. + * @return {object} Object containing the slack message and its formatting. */ function formatSlackMessage( payload, channel, message ) { const { issue, repository } = payload; diff --git a/projects/github-actions/repo-gardening/src/tasks/update-board/index.js b/projects/github-actions/repo-gardening/src/tasks/update-board/index.js index 86a602d3eda63..adaa3f0b85345 100644 --- a/projects/github-actions/repo-gardening/src/tasks/update-board/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/update-board/index.js @@ -20,7 +20,7 @@ const { automatticAssignments } = require( './automattic-label-team-assignments' * @param {string} number - Issue number. * @param {string} action - Action that triggered the event ('opened', 'reopened', 'labeled'). * @param {object} eventLabel - Label that was added to the issue. - * @returns {Promise} Promise resolving to true if the issue has a "Triaged" label. + * @return {Promise} Promise resolving to true if the issue has a "Triaged" label. */ async function hasTriagedLabel( octokit, owner, repo, number, action, eventLabel ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -46,7 +46,7 @@ async function hasTriagedLabel( octokit, owner, repo, number, action, eventLabel * @param {string} number - Issue number. * @param {string} action - Action that triggered the event ('opened', 'reopened', 'labeled'). * @param {object} eventLabel - Label that was added to the issue. - * @returns {Promise} Promise resolving to true if the issue needs a third-party fix. + * @return {Promise} Promise resolving to true if the issue needs a third-party fix. */ async function needsThirdPartyFix( octokit, owner, repo, number, action, eventLabel ) { const labels = await getLabels( octokit, owner, repo, number ); @@ -62,7 +62,7 @@ async function needsThirdPartyFix( octokit, owner, repo, number, action, eventLa * * @param {GitHub} octokit - Initialized Octokit REST client. * @param {string} projectBoardLink - The link to the project board. - * @returns {Promise} - Project board information. + * @return {Promise} - Project board information. */ async function getProjectDetails( octokit, projectBoardLink ) { const projectRegex = @@ -158,7 +158,7 @@ async function getProjectDetails( octokit, projectBoardLink ) { * @param {object} projectInfo - Info about our project board. * @param {string} repoName - The name of the repository. * @param {string} issueId - The ID of the issue. - * @returns {Promise} - The ID of the project item, or an empty string if not found. + * @return {Promise} - The ID of the project item, or an empty string if not found. */ async function getIssueProjectItemId( octokit, projectInfo, repoName, issueId ) { const { ownerName, projectNumber } = projectInfo; @@ -204,7 +204,7 @@ async function getIssueProjectItemId( octokit, projectInfo, repoName, issueId ) * @param {GitHub} octokit - Initialized Octokit REST client. * @param {object} projectInfo - Info about our project board. * @param {string} node_id - The node_id of the Issue. - * @returns {Promise} - Info about the project item id that was created. + * @return {Promise} - Info about the project item id that was created. */ async function addIssueToBoard( octokit, projectInfo, node_id ) { const { projectNodeId } = projectInfo; @@ -244,7 +244,7 @@ async function addIssueToBoard( octokit, projectInfo, node_id ) { * @param {object} projectInfo - Info about our project board. * @param {string} projectItemId - The ID of the project item. * @param {string} priorityText - Priority of our issue (must match an existing column in the project board). - * @returns {Promise} - The new project item id. + * @return {Promise} - The new project item id. */ async function setPriorityField( octokit, projectInfo, projectItemId, priorityText ) { const { @@ -304,7 +304,7 @@ async function setPriorityField( octokit, projectInfo, projectItemId, priorityTe * @param {object} projectInfo - Info about our project board. * @param {string} projectItemId - The ID of the project item. * @param {string} statusText - Status of our issue (must match an existing column in the project board). - * @returns {Promise} - The new project item id. + * @return {Promise} - The new project item id. */ async function setStatusField( octokit, projectInfo, projectItemId, statusText ) { const { @@ -364,7 +364,7 @@ async function setStatusField( octokit, projectInfo, projectItemId, statusText ) * @param {object} projectInfo - Info about our project board. * @param {string} projectItemId - The ID of the project item. * @param {string} team - Team that should be assigned to our issue (must match an existing column in the project board). - * @returns {Promise} - The new project item id. + * @return {Promise} - The new project item id. */ async function setTeamField( octokit, projectInfo, projectItemId, team ) { const { @@ -420,7 +420,7 @@ async function setTeamField( octokit, projectInfo, projectItemId, team ) { * * @param {string} ownerLogin - Repository owner login. * - * @returns {Promise} - Mapping of teams <> labels. + * @return {Promise} - Mapping of teams <> labels. */ async function loadTeamAssignments( ownerLogin ) { // If we're in an Automattic repo, we can use the team assignments file that ships with this action. @@ -460,12 +460,12 @@ async function loadTeamAssignments( ownerLogin ) { * It could be an existing label, * or it could be that it's being added as part of the event that triggers this action. * - * @param {GitHub} octokit - Initialized Octokit REST client. - * @param {object} payload - Issue event payload. - * @param {object} projectInfo - Info about our project board. - * @param {string} projectItemId - The ID of the project item. - * @param {Array} priorityLabels - Array of priority labels. - * @returns {Promise} - The new project item id. + * @param {GitHub} octokit - Initialized Octokit REST client. + * @param {object} payload - Issue event payload. + * @param {object} projectInfo - Info about our project board. + * @param {string} projectItemId - The ID of the project item. + * @param {Array} priorityLabels - Array of priority labels. + * @return {Promise} - The new project item id. */ async function assignTeam( octokit, payload, projectInfo, projectItemId, priorityLabels ) { const { diff --git a/projects/github-actions/repo-gardening/src/tasks/wpcom-commit-reminder/index.js b/projects/github-actions/repo-gardening/src/tasks/wpcom-commit-reminder/index.js index 7a65c4176dc08..470dc3f7c8003 100644 --- a/projects/github-actions/repo-gardening/src/tasks/wpcom-commit-reminder/index.js +++ b/projects/github-actions/repo-gardening/src/tasks/wpcom-commit-reminder/index.js @@ -12,7 +12,7 @@ const getComments = require( '../../utils/get-comments' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to a string. + * @return {Promise} Promise resolving to a string. */ async function getMatticBotComment( octokit, owner, repo, number ) { let commentBody = ''; @@ -39,7 +39,7 @@ async function getMatticBotComment( octokit, owner, repo, number ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasReminderComment( octokit, owner, repo, number ) { debug( `wpcom-commit-reminder: Looking for a previous comment from this task in our PR.` ); diff --git a/projects/github-actions/repo-gardening/src/utils/get-affected-changelogger-projects.js b/projects/github-actions/repo-gardening/src/utils/get-affected-changelogger-projects.js index acc81c33f552a..4a9afeff25735 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-affected-changelogger-projects.js +++ b/projects/github-actions/repo-gardening/src/utils/get-affected-changelogger-projects.js @@ -5,7 +5,7 @@ const getPrWorkspace = require( './get-pr-workspace' ); /** * Returns a list of Projects that use changelogger package * - * @returns {Array} list of changelogger packages + * @return {Array} list of changelogger packages */ function getChangeloggerProjects() { const projects = []; @@ -29,7 +29,7 @@ function getChangeloggerProjects() { * Returns an object with project type and name * * @param {string} file - File path - * @returns {object} Project type and name + * @return {object} Project type and name */ function getProject( file ) { const project = file.match( /projects\/(?[^/]*)\/(?[^/]*)\// ); @@ -47,7 +47,7 @@ function getProject( file ) { * Returns a list of affected projects * * @param {Array} files - List of files - * @returns {Array} List of affected projects + * @return {Array} List of affected projects */ function getAffectedChangeloggerProjects( files ) { const changeloggerProjects = getChangeloggerProjects(); diff --git a/projects/github-actions/repo-gardening/src/utils/get-associated-pull-request.js b/projects/github-actions/repo-gardening/src/utils/get-associated-pull-request.js index 965616f23f52b..7686179d7e646 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-associated-pull-request.js +++ b/projects/github-actions/repo-gardening/src/utils/get-associated-pull-request.js @@ -6,7 +6,7 @@ * cannot be determined. * * @param {WebhookPayloadPushCommit} commit - Commit object. - * @returns {number?} Pull request number, or null if it cannot be determined. + * @return {number?} Pull request number, or null if it cannot be determined. */ function getAssociatedPullRequest( commit ) { const match = commit.message.match( /\(#(\d+)\)$/m ); diff --git a/projects/github-actions/repo-gardening/src/utils/get-comments.js b/projects/github-actions/repo-gardening/src/utils/get-comments.js index 5b263c7c8a1dc..d22055c608b2c 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-comments.js +++ b/projects/github-actions/repo-gardening/src/utils/get-comments.js @@ -11,7 +11,7 @@ const cache = {}; * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - Issue number. - * @returns {Promise} Promise resolving to an array of all comments on that given issue. + * @return {Promise} Promise resolving to an array of all comments on that given issue. */ async function getComments( octokit, owner, repo, number ) { const issueComments = []; diff --git a/projects/github-actions/repo-gardening/src/utils/get-files.js b/projects/github-actions/repo-gardening/src/utils/get-files.js index ed4c0b1b8aa92..7d1430a228175 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-files.js +++ b/projects/github-actions/repo-gardening/src/utils/get-files.js @@ -11,7 +11,7 @@ const cache = {}; * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to an array of all files modified in that PR. + * @return {Promise} Promise resolving to an array of all files modified in that PR. */ async function getFiles( octokit, owner, repo, number ) { const fileList = []; diff --git a/projects/github-actions/repo-gardening/src/utils/get-next-valid-milestone.js b/projects/github-actions/repo-gardening/src/utils/get-next-valid-milestone.js index fd33c24a238b5..1257cdb0571c3 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-next-valid-milestone.js +++ b/projects/github-actions/repo-gardening/src/utils/get-next-valid-milestone.js @@ -12,7 +12,7 @@ const cache = {}; * @param {GitHub} octokit - Initialized Octokit REST client. * @param {string} owner - Repository owner. * @param {string} repo - Repository name. - * @returns {Promise} Promise resolving to an array of all open milestones. + * @return {Promise} Promise resolving to an array of all open milestones. */ async function getOpenMilestones( octokit, owner, repo ) { const milestones = []; @@ -45,7 +45,7 @@ async function getOpenMilestones( octokit, owner, repo ) { * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} plugin - Plugin slug. - * @returns {Promise} Promise resolving to milestone, if exists. + * @return {Promise} Promise resolving to milestone, if exists. */ async function getNextValidMilestone( octokit, owner, repo, plugin = 'jetpack' ) { // Find all valid milestones for the specified plugin. diff --git a/projects/github-actions/repo-gardening/src/utils/get-plugin-names.js b/projects/github-actions/repo-gardening/src/utils/get-plugin-names.js index ad1f1926cd104..7d70da3155df0 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-plugin-names.js +++ b/projects/github-actions/repo-gardening/src/utils/get-plugin-names.js @@ -9,7 +9,7 @@ const getLabels = require( './labels/get-labels' ); * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR / Issue number. - * @returns {Promise} Promise resolving to an array of all the plugins touched by that PR. + * @return {Promise} Promise resolving to an array of all the plugins touched by that PR. */ async function getPluginNames( octokit, owner, repo, number ) { const plugins = []; diff --git a/projects/github-actions/repo-gardening/src/utils/get-pr-workspace.js b/projects/github-actions/repo-gardening/src/utils/get-pr-workspace.js index 2a02aa0c6359a..33c33d0fbd8bf 100644 --- a/projects/github-actions/repo-gardening/src/utils/get-pr-workspace.js +++ b/projects/github-actions/repo-gardening/src/utils/get-pr-workspace.js @@ -1,7 +1,7 @@ /** * Get the path to the PR workspace. * - * @returns {string} Path. + * @return {string} Path. */ function getPrWorkspace() { if ( 'undefined' !== typeof process.env.PR_WORKSPACE ) { diff --git a/projects/github-actions/repo-gardening/src/utils/if-not-closed.js b/projects/github-actions/repo-gardening/src/utils/if-not-closed.js index 7f14c883a7de6..7d54e60eac2ad 100644 --- a/projects/github-actions/repo-gardening/src/utils/if-not-closed.js +++ b/projects/github-actions/repo-gardening/src/utils/if-not-closed.js @@ -7,7 +7,7 @@ const debug = require( './debug' ); * handler only if the PR is not currently closed. * * @param {WPAutomationTask} handler - Original task. - * @returns {WPAutomationTask} Enhanced task. + * @return {WPAutomationTask} Enhanced task. */ function ifNotClosed( handler ) { const newHandler = ( payload, octokit ) => { diff --git a/projects/github-actions/repo-gardening/src/utils/if-not-fork.js b/projects/github-actions/repo-gardening/src/utils/if-not-fork.js index 7ee43ee25024b..dcc860a6b6f01 100644 --- a/projects/github-actions/repo-gardening/src/utils/if-not-fork.js +++ b/projects/github-actions/repo-gardening/src/utils/if-not-fork.js @@ -8,7 +8,7 @@ const debug = require( './debug' ); * pull request event which did not originate from a forked repository. * * @param {WPAutomationTask} handler - Original task. - * @returns {WPAutomationTask} Enhanced task. + * @return {WPAutomationTask} Enhanced task. */ function ifNotFork( handler ) { const newHandler = ( payload, octokit ) => { diff --git a/projects/github-actions/repo-gardening/src/utils/labels/get-labels.js b/projects/github-actions/repo-gardening/src/utils/labels/get-labels.js index 020e7c662f491..ccf297fd20f00 100644 --- a/projects/github-actions/repo-gardening/src/utils/labels/get-labels.js +++ b/projects/github-actions/repo-gardening/src/utils/labels/get-labels.js @@ -11,7 +11,7 @@ const cache = {}; * @param {string} owner - Repository owner. * @param {string} repo - Repository name. * @param {string} number - PR number. - * @returns {Promise} Promise resolving to an array of all labels for that PR. + * @return {Promise} Promise resolving to an array of all labels for that PR. */ async function getLabels( octokit, owner, repo, number ) { const labelList = []; diff --git a/projects/github-actions/repo-gardening/src/utils/labels/has-escalated-label.js b/projects/github-actions/repo-gardening/src/utils/labels/has-escalated-label.js index 1790442144dcd..7f377f2dfa3f6 100644 --- a/projects/github-actions/repo-gardening/src/utils/labels/has-escalated-label.js +++ b/projects/github-actions/repo-gardening/src/utils/labels/has-escalated-label.js @@ -13,7 +13,7 @@ const getLabels = require( './get-labels' ); * @param {string} number - Issue number. * @param {string} action - Action that triggered the event ('opened', 'reopened', 'labeled'). * @param {object} eventLabel - Label that was added to the issue. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasEscalatedLabel( octokit, owner, repo, number, action, eventLabel ) { // Check for an exisiting label first. diff --git a/projects/github-actions/repo-gardening/src/utils/labels/has-priority-labels.js b/projects/github-actions/repo-gardening/src/utils/labels/has-priority-labels.js index bb1d08a3af436..0e4b6d113cbc4 100644 --- a/projects/github-actions/repo-gardening/src/utils/labels/has-priority-labels.js +++ b/projects/github-actions/repo-gardening/src/utils/labels/has-priority-labels.js @@ -13,7 +13,7 @@ const getLabels = require( './get-labels' ); * @param {string} number - Issue number. * @param {string} action - Action that triggered the event ('opened', 'reopened', 'labeled'). * @param {object} eventLabel - Label that was added to the issue. - * @returns {Promise} Promise resolving to an array of Priority labels. + * @return {Promise} Promise resolving to an array of Priority labels. */ async function hasPriorityLabels( octokit, owner, repo, number, action, eventLabel ) { const labels = await getLabels( octokit, owner, repo, number ); diff --git a/projects/github-actions/repo-gardening/src/utils/labels/is-bug.js b/projects/github-actions/repo-gardening/src/utils/labels/is-bug.js index ea92292d9f2e9..35ec1761e2d20 100644 --- a/projects/github-actions/repo-gardening/src/utils/labels/is-bug.js +++ b/projects/github-actions/repo-gardening/src/utils/labels/is-bug.js @@ -13,7 +13,7 @@ const getLabels = require( './get-labels' ); * @param {string} number - Issue number. * @param {string} action - Action that triggered the event ('opened', 'reopened', 'labeled'). * @param {object} eventLabel - Label that was added to the issue. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function isBug( octokit, owner, repo, number, action, eventLabel ) { // If the issue has a "[Type] Bug" label, it's a bug. diff --git a/projects/github-actions/repo-gardening/src/utils/parse-content/find-platforms.js b/projects/github-actions/repo-gardening/src/utils/parse-content/find-platforms.js index fcfa0062f949a..8900ac5369671 100644 --- a/projects/github-actions/repo-gardening/src/utils/parse-content/find-platforms.js +++ b/projects/github-actions/repo-gardening/src/utils/parse-content/find-platforms.js @@ -3,7 +3,7 @@ const debug = require( '../debug' ); * Find platform info, based off issue contents. * * @param {string} body - The issue content. - * @returns {Array} Platforms impacted by issue. + * @return {Array} Platforms impacted by issue. */ function findPlatforms( body ) { const regex = /###\sPlatform\s\(Simple\sand\/or Atomic\)\n\n([a-zA-Z ,-]*)\n\n/gm; diff --git a/projects/github-actions/repo-gardening/src/utils/parse-content/find-plugins.js b/projects/github-actions/repo-gardening/src/utils/parse-content/find-plugins.js index 202c6bed17eda..9bda2f45b5ec8 100644 --- a/projects/github-actions/repo-gardening/src/utils/parse-content/find-plugins.js +++ b/projects/github-actions/repo-gardening/src/utils/parse-content/find-plugins.js @@ -4,7 +4,7 @@ const debug = require( '../debug' ); * Find list of plugins impacted by issue, based off issue contents. * * @param {string} body - The issue content. - * @returns {Array} Plugins concerned by issue. + * @return {Array} Plugins concerned by issue. */ function findPlugins( body ) { const regex = /###\sImpacted\splugin\n\n([a-zA-Z ,]*)\n\n/gm; diff --git a/projects/github-actions/repo-gardening/src/utils/parse-content/find-priority.js b/projects/github-actions/repo-gardening/src/utils/parse-content/find-priority.js index 799fdee83de80..137effa04b940 100644 --- a/projects/github-actions/repo-gardening/src/utils/parse-content/find-priority.js +++ b/projects/github-actions/repo-gardening/src/utils/parse-content/find-priority.js @@ -5,7 +5,7 @@ const debug = require( '../debug' ); * Logic follows this priority matrix: pciE2j-oG-p2 * * @param {string} body - The issue content. - * @returns {string} Priority of issue. + * @return {string} Priority of issue. */ function findPriority( body ) { // Look for priority indicators in body. diff --git a/projects/github-actions/repo-gardening/src/utils/parse-content/has-many-support-references.js b/projects/github-actions/repo-gardening/src/utils/parse-content/has-many-support-references.js index 7839fa5368ea0..b7d74882a51fe 100644 --- a/projects/github-actions/repo-gardening/src/utils/parse-content/has-many-support-references.js +++ b/projects/github-actions/repo-gardening/src/utils/parse-content/has-many-support-references.js @@ -7,7 +7,7 @@ const { getInput } = require( '@actions/core' ); * We only count the number of unanswered support references, since they're the ones we'll need to contact. * * @param {Array} issueComments - Array of all comments on that issue. - * @returns {Promise} Promise resolving to boolean. + * @return {Promise} Promise resolving to boolean. */ async function hasManySupportReferences( issueComments ) { const referencesThreshhold = getInput( 'reply_to_customers_threshold' ); diff --git a/projects/github-actions/repo-gardening/src/utils/slack/format-slack-message.js b/projects/github-actions/repo-gardening/src/utils/slack/format-slack-message.js index eceef0c8f57b6..2bb40b7548256 100644 --- a/projects/github-actions/repo-gardening/src/utils/slack/format-slack-message.js +++ b/projects/github-actions/repo-gardening/src/utils/slack/format-slack-message.js @@ -7,7 +7,7 @@ * @param {WebhookPayloadIssue} payload - Issue event payload. * @param {string} channel - Slack channel ID. * @param {string} message - Basic message (without the formatting). - * @returns {object} Object containing the slack message and its formatting. + * @return {object} Object containing the slack message and its formatting. */ function formatSlackMessage( payload, channel, message ) { const { issue } = payload; diff --git a/projects/github-actions/repo-gardening/src/utils/slack/send-slack-message.js b/projects/github-actions/repo-gardening/src/utils/slack/send-slack-message.js index c5e7f14527709..ad4f771a3cade 100644 --- a/projects/github-actions/repo-gardening/src/utils/slack/send-slack-message.js +++ b/projects/github-actions/repo-gardening/src/utils/slack/send-slack-message.js @@ -10,7 +10,7 @@ const fetch = require( 'node-fetch' ); * @param {string} channel - Slack channel ID. * @param {WebhookPayloadPullRequest|WebhookPayloadIssue} payload - Pull request event payload. * @param {object} customMessageFormat - Custom message formatting. If defined, takes over from message completely. - * @returns {Promise} Promise resolving to a boolean, whether message was successfully posted or not. + * @return {Promise} Promise resolving to a boolean, whether message was successfully posted or not. */ async function sendSlackMessage( message, channel, payload, customMessageFormat = {} ) { const token = getInput( 'slack_token' ); diff --git a/projects/github-actions/required-review/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/github-actions/required-review/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/github-actions/required-review/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/github-actions/required-review/src/main.js b/projects/github-actions/required-review/src/main.js index e9f98dcbcc280..1e730bcbeae04 100644 --- a/projects/github-actions/required-review/src/main.js +++ b/projects/github-actions/required-review/src/main.js @@ -8,7 +8,7 @@ const Requirement = require( './requirement.js' ); /** * Load the requirements yaml file. * - * @returns {Requirement[]} Requirements. + * @return {Requirement[]} Requirements. */ async function getRequirements() { let requirementsString = core.getInput( 'requirements' ); diff --git a/projects/github-actions/required-review/src/paths.js b/projects/github-actions/required-review/src/paths.js index ee81f5dfdc7a4..395b8b791e391 100644 --- a/projects/github-actions/required-review/src/paths.js +++ b/projects/github-actions/required-review/src/paths.js @@ -5,7 +5,7 @@ const { WError } = require( 'error' ); /** * Fetch the paths in the current PR. * - * @returns {string[]} Paths. + * @return {string[]} Paths. */ async function fetchPaths() { const octokit = github.getOctokit( core.getInput( 'token', { required: true } ) ); diff --git a/projects/github-actions/required-review/src/reporter.js b/projects/github-actions/required-review/src/reporter.js index 3554ade44f835..b4f2a932be78d 100644 --- a/projects/github-actions/required-review/src/reporter.js +++ b/projects/github-actions/required-review/src/reporter.js @@ -10,7 +10,7 @@ const STATE_SUCCESS = 'success'; /** * Report a status check to GitHub. * - * @param {string} state - One of the `STATE_*` constants. + * @param {string} state - One of the `STATE_*` constants. * @param {string} description - Description for the status. */ async function status( state, description ) { diff --git a/projects/github-actions/required-review/src/requirement.js b/projects/github-actions/required-review/src/requirement.js index 5d2258fc2caf4..0ed4af3691dc5 100644 --- a/projects/github-actions/required-review/src/requirement.js +++ b/projects/github-actions/required-review/src/requirement.js @@ -9,10 +9,10 @@ class RequirementError extends SError {} /** * Prints a result set, then returns it. * - * @param {string} label - Label for the set. + * @param {string} label - Label for the set. * @param {string[]} teamReviewers - Team members that have reviewed the file. If an empty array, will print `` instead. - * @param {string[]} neededTeams - Teams that have no reviews from it's members. - * @returns {{teamReviewers, neededTeams}} `{teamReviewers, neededTeams}`. + * @param {string[]} neededTeams - Teams that have no reviews from it's members. + * @return {{teamReviewers, neededTeams}} `{teamReviewers, neededTeams}`. */ function printSet( label, teamReviewers, neededTeams ) { core.info( label + ' ' + ( teamReviewers.length ? teamReviewers.join( ', ' ) : '' ) ); @@ -22,10 +22,10 @@ function printSet( label, teamReviewers, neededTeams ) { /** * Build a reviewer team membership filter. * - * @param {object} config - Requirements configuration object being processed. + * @param {object} config - Requirements configuration object being processed. * @param {Array|string|object} teamConfig - Team name, or single-key object with a list of teams/objects, or array of such. - * @param {string} indent - String for indentation. - * @returns {Function} Function to filter an array of reviewers by membership in the team(s). + * @param {string} indent - String for indentation. + * @return {Function} Function to filter an array of reviewers by membership in the team(s). */ function buildReviewerFilter( config, teamConfig, indent ) { if ( typeof teamConfig === 'string' ) { @@ -140,10 +140,10 @@ class Requirement { /** * Constructor. * - * @param {object} config - Object config - * @param {string[]|string} config.paths - Paths this requirement applies to. Either an array of picomatch globs, or the string "unmatched". - * @param {Array} config.teams - Team reviews requirements. - * @param {boolean} config.consume - Whether matched paths should be ignored by later rules. + * @param {object} config - Object config + * @param {string[]|string} config.paths - Paths this requirement applies to. Either an array of picomatch globs, or the string "unmatched". + * @param {Array} config.teams - Team reviews requirements. + * @param {boolean} config.consume - Whether matched paths should be ignored by later rules. */ constructor( config ) { this.name = config.name || 'Unnamed requirement'; @@ -197,12 +197,12 @@ class Requirement { /** * Test whether this requirement applies to the passed paths. * - * @param {string[]} paths - Paths to test against. + * @param {string[]} paths - Paths to test against. * @param {string[]} matchedPaths - Paths that have already been matched. - * @returns {object} _ Results object. - * @returns {boolean} _.applies Whether the requirement applies. - * @returns {string[]} _.matchedPaths New value for `matchedPaths`. - * @returns {string[]} _.paths New value for `paths`. + * @return {object} _ Results object. + * @return {boolean} _.applies Whether the requirement applies. + * @return {string[]} _.matchedPaths New value for `matchedPaths`. + * @return {string[]} _.paths New value for `paths`. */ appliesToPaths( paths, matchedPaths ) { let matches; @@ -239,7 +239,7 @@ class Requirement { * Test whether this requirement is satisfied. * * @param {string[]} reviewers - Reviewers to test against. - * @returns {boolean} Whether the requirement is satisfied. + * @return {boolean} Whether the requirement is satisfied. */ async needsReviewsFrom( reviewers ) { core.info( 'Checking reviewers...' ); diff --git a/projects/github-actions/required-review/src/reviewers.js b/projects/github-actions/required-review/src/reviewers.js index abaf02d2f9359..65c0ed4410d44 100644 --- a/projects/github-actions/required-review/src/reviewers.js +++ b/projects/github-actions/required-review/src/reviewers.js @@ -5,7 +5,7 @@ const { WError } = require( 'error' ); /** * Fetch the reviewers approving the current PR. * - * @returns {string[]} Reviewers. + * @return {string[]} Reviewers. */ async function fetchReviewers() { const octokit = github.getOctokit( core.getInput( 'token', { required: true } ) ); diff --git a/projects/github-actions/required-review/src/team-members.js b/projects/github-actions/required-review/src/team-members.js index 7b9307f2a2e88..d2978a876985a 100644 --- a/projects/github-actions/required-review/src/team-members.js +++ b/projects/github-actions/required-review/src/team-members.js @@ -9,7 +9,7 @@ const cache = {}; * Special case: Names prefixed with @ are considered to be a one-member team with the named GitHub user. * * @param {string} team - GitHub team slug, or @ followed by a GitHub user name. - * @returns {string[]} Team members. + * @return {string[]} Team members. */ async function fetchTeamMembers( team ) { if ( cache[ team ] ) { diff --git a/projects/github-actions/test-results-to-slack/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/github-actions/test-results-to-slack/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/github-actions/test-results-to-slack/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/github-actions/test-results-to-slack/src/github.js b/projects/github-actions/test-results-to-slack/src/github.js index 3ef7e8b76dbbe..23a8d5ae4c7b9 100644 --- a/projects/github-actions/test-results-to-slack/src/github.js +++ b/projects/github-actions/test-results-to-slack/src/github.js @@ -5,7 +5,7 @@ const extras = require( './extra-context' ); * Decides if the current workflow failed * * @param {string} token - GitHub token - * @returns {boolean} Whether it failed. + * @return {boolean} Whether it failed. */ async function isWorkflowFailed( token ) { // eslint-disable-next-line new-cap @@ -37,7 +37,7 @@ async function isWorkflowFailed( token ) { * Creates and returns a run url * * @param {boolean} withAttempt - whether to include the run attempt in the url - * @returns {string} the run url + * @return {string} the run url */ function getRunUrl( withAttempt = true ) { const { serverUrl, runId } = github.context; diff --git a/projects/github-actions/test-results-to-slack/src/message.js b/projects/github-actions/test-results-to-slack/src/message.js index cb15ea9906c1a..171e2179dcef0 100644 --- a/projects/github-actions/test-results-to-slack/src/message.js +++ b/projects/github-actions/test-results-to-slack/src/message.js @@ -17,7 +17,7 @@ const { refType, refName, runAttempt, triggeringActor, repository } = extras; * that can be used later on to find this message and update it or send replies. * * @param {boolean} isFailure - whether the workflow is failed or not - * @returns {object} Notificaton data as described + * @return {object} Notificaton data as described */ async function createMessage( isFailure ) { let target = `for ${ sha }`; @@ -143,7 +143,7 @@ async function createMessage( isFailure ) { * Returns a Slack context block element with a given text. * * @param {string} text - the text of the element - * @returns {object} - the block element + * @return {object} - the block element */ function getTextContextElement( text ) { return { @@ -157,8 +157,8 @@ function getTextContextElement( text ) { * Returns a Slack button element with a given text and url. * * @param {string} text - the text of the button - * @param {string} url - the url of the button - * @returns {object} - the button element + * @param {string} url - the url of the button + * @return {object} - the button element */ function getButton( text, url ) { return { @@ -175,9 +175,9 @@ function getButton( text, url ) { * Creates the message and sends it if the rules are met. * * @param {string} slackToken - the Slack token - * @param {string} ghToken - the GitHub token - * @param {string} channel - the id of the channel to send the message to - * @param {string} username - the username to use when sending the message + * @param {string} ghToken - the GitHub token + * @param {string} channel - the id of the channel to send the message to + * @param {string} username - the username to use when sending the message */ async function sendMessage( slackToken, ghToken, channel, username ) { const client = new WebClient( slackToken ); diff --git a/projects/github-actions/test-results-to-slack/src/playwright.js b/projects/github-actions/test-results-to-slack/src/playwright.js index 084d4eca532e2..75b9a67191ec1 100644 --- a/projects/github-actions/test-results-to-slack/src/playwright.js +++ b/projects/github-actions/test-results-to-slack/src/playwright.js @@ -6,7 +6,7 @@ const { debug } = require( './debug' ); /** * Parses multiple Playwright JSON reports and returns details about the failed tests. * - * @returns {object} an array of Slack blocks with test failure details. + * @return {object} an array of Slack blocks with test failure details. */ function getPlaywrightBlocks() { const blocks = []; @@ -101,7 +101,7 @@ function getPlaywrightBlocks() { /** * Parses multiple Playwright JSON reports and returns their content as an array of objects. * - * @returns {object} an array of Playwright reports. + * @return {object} an array of Playwright reports. */ function getPlaywrightReports() { let parseError = false; @@ -124,7 +124,7 @@ function getPlaywrightReports() { /** * Parses the 'playwright_report_path' input and finds matching files. * - * @returns {Array} an array of matching paths. + * @return {Array} an array of matching paths. */ function getPlaywrightReportsPaths() { const playwrightReportPath = getInput( 'playwright_report_path' ); @@ -146,9 +146,9 @@ function getPlaywrightReportsPaths() { /** * Creates the final path to attachments. * - * @param {string} outputPath - the output root path, as defined in the Playwright report + * @param {string} outputPath - the output root path, as defined in the Playwright report * @param {string} attachmentPath - the original path to the attachment, as defined in the Playwright report - * @returns {string} the final path to the attachment + * @return {string} the final path to the attachment */ function getAttachmentPath( outputPath, attachmentPath ) { const resultsPath = getInput( 'playwright_output_dir' ); @@ -175,7 +175,7 @@ function getAttachmentPath( outputPath, attachmentPath ) { * Flattens the suites in a Playwright report. * * @param {[object]} suites - an array of nested suites from a Playwright test report - * @returns {[object]} an array of flattened suites + * @return {[object]} an array of flattened suites */ function flattenSuites( suites ) { return suites.reduce( ( all, curr ) => { diff --git a/projects/github-actions/test-results-to-slack/src/rules.js b/projects/github-actions/test-results-to-slack/src/rules.js index 6dab25969da8d..7391554db7fe1 100644 --- a/projects/github-actions/test-results-to-slack/src/rules.js +++ b/projects/github-actions/test-results-to-slack/src/rules.js @@ -6,7 +6,7 @@ const extras = require( './extra-context' ); /** * Returns a list o Slack channel ids, based on context and rules configuration. * - * @returns {string[]} an array of channels ids + * @return {string[]} an array of channels ids */ function getChannels() { const channels = []; diff --git a/projects/github-actions/test-results-to-slack/src/slack.js b/projects/github-actions/test-results-to-slack/src/slack.js index 4ec741e4f9924..61e61b51810e5 100644 --- a/projects/github-actions/test-results-to-slack/src/slack.js +++ b/projects/github-actions/test-results-to-slack/src/slack.js @@ -4,10 +4,10 @@ const { debug, error } = require( './debug' ); /** * Sends a Slack message. * - * @param {object} client - Slack client - * @param {boolean} update - if it should update a message. For true, it will update an existing message based on `ts`, false will send a new message. - * @param {object} options - options - * @returns {Promise<*>} the response from the Slack API. In case when multiple messages are sent due to the blocks length the last message response is returned. + * @param {object} client - Slack client + * @param {boolean} update - if it should update a message. For true, it will update an existing message based on `ts`, false will send a new message. + * @param {object} options - options + * @return {Promise<*>} the response from the Slack API. In case when multiple messages are sent due to the blocks length the last message response is returned. */ async function postOrUpdateMessage( client, update, options ) { const { text, blocks = [], channel, username, icon_emoji, ts, thread_ts } = options; @@ -62,9 +62,9 @@ async function postOrUpdateMessage( client, update, options ) { /** * Split an array of blocks into chunks of a given size * - * @param {[object]} blocks - the array to be split - * @param {number} chunkSize - the maximum size of each chunk - * @returns {[object]} the array of chunks + * @param {[object]} blocks - the array to be split + * @param {number} chunkSize - the maximum size of each chunk + * @return {[object]} the array of chunks */ function getBlocksChunksBySize( blocks, chunkSize ) { const chunks = []; @@ -81,8 +81,8 @@ function getBlocksChunksBySize( blocks, chunkSize ) { * the result will be [ [ {type: 'context'}, {type: 'context'} ], [ {type: 'file'} ], [ {type: 'context'} ] ] * * @param {[object]} blocks - the array to be split - * @param {string} type - the type property to use as delimiter - * @returns {[object]} the array of chunks + * @param {string} type - the type property to use as delimiter + * @return {[object]} the array of chunks */ function getBlocksChunksByType( blocks, type ) { const chunks = []; @@ -108,10 +108,10 @@ function getBlocksChunksByType( blocks, type ) { /** * Split an array of blocks into chunks based on a given type property as delimiter and a max size * - * @param {[object]} blocks - the array to be split - * @param {number} maxSize - the maximum size of each chunk - * @param {string} typeDelimiter - the type property to use as delimiter - * @returns {[object]} the array of chunks + * @param {[object]} blocks - the array to be split + * @param {number} maxSize - the maximum size of each chunk + * @param {string} typeDelimiter - the type property to use as delimiter + * @return {[object]} the array of chunks */ function getBlocksChunks( blocks, maxSize, typeDelimiter ) { const chunksByType = getBlocksChunksByType( blocks, typeDelimiter ); @@ -129,10 +129,10 @@ function getBlocksChunks( blocks, maxSize, typeDelimiter ) { /** * Finds and returns a Slack message that contains a given string in its text (not in blocks!) * - * @param {object} client - the Slack client - * @param {string} channelId - the channel id + * @param {object} client - the Slack client + * @param {string} channelId - the channel id * @param {string} identifier - the string to search for in the messages text - * @returns {Promise<*|null>} the message Object + * @return {Promise<*|null>} the message Object */ async function getMessage( client, channelId, identifier ) { debug( `Looking for ${ identifier }` ); diff --git a/projects/github-actions/test-results-to-slack/tests/rules.test.js b/projects/github-actions/test-results-to-slack/tests/rules.test.js index 2e7c6d3fc625a..932737eda70b5 100644 --- a/projects/github-actions/test-results-to-slack/tests/rules.test.js +++ b/projects/github-actions/test-results-to-slack/tests/rules.test.js @@ -43,7 +43,7 @@ describe( 'Notification rules', () => { * Writes the rules object to a temp file and returns the path to that file. * * @param {object} rules - the rules object - * @returns {string|undefined} the path to the temp file + * @return {string|undefined} the path to the temp file */ function writeRules( rules ) { const rulesPath = './tests/ignore'; diff --git a/projects/js-packages/ai-client/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/ai-client/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/ai-client/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/ai-client/src/ask-question/index.ts b/projects/js-packages/ai-client/src/ask-question/index.ts index 4211b66976bc1..bfc49863efbcb 100644 --- a/projects/js-packages/ai-client/src/ask-question/index.ts +++ b/projects/js-packages/ai-client/src/ask-question/index.ts @@ -46,9 +46,9 @@ const debug = debugFactory( 'jetpack-ai-client:ask-question' ); * An asynchronous function that asks a question * and returns an event source with suggestions. * - * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects. - * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: - * @returns {Promise} A promise that resolves to an instance of the SuggestionsEventSource + * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects. + * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: + * @return {Promise} A promise that resolves to an instance of the SuggestionsEventSource * @example * const question = "What is the meaning of life?"; * const options = { diff --git a/projects/js-packages/ai-client/src/ask-question/sync.ts b/projects/js-packages/ai-client/src/ask-question/sync.ts index 4bbbd7f571d6d..b7480c37d8277 100644 --- a/projects/js-packages/ai-client/src/ask-question/sync.ts +++ b/projects/js-packages/ai-client/src/ask-question/sync.ts @@ -19,9 +19,9 @@ const debug = debugFactory( 'jetpack-ai-client:ask-question-sync' ); /** * A function that asks a question without streaming. * - * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects. - * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: postId, feature, model. - * @returns {Promise} - A promise that resolves to an instance of the ResponseData + * @param {PromptProp} question - The question to ask. It can be a simple string or an array of PromptMessageItemProps objects. + * @param {AskQuestionOptionsArgProps} options - An optional object for additional configuration: postId, feature, model. + * @return {Promise} - A promise that resolves to an instance of the ResponseData * @example * const question = "What is the meaning of life?"; * const options = { diff --git a/projects/js-packages/ai-client/src/audio-transcription/index.ts b/projects/js-packages/ai-client/src/audio-transcription/index.ts index e566bcebaabe0..81bc95c5fb276 100644 --- a/projects/js-packages/ai-client/src/audio-transcription/index.ts +++ b/projects/js-packages/ai-client/src/audio-transcription/index.ts @@ -12,10 +12,10 @@ const debug = debugFactory( 'jetpack-ai-client:audio-transcription' ); /** * A function that takes an audio blob and transcribes it. * - * @param {Blob} audio - The audio to be transcribed, from a recording or from a file. - * @param {string} feature - The feature name that is calling the transcription. + * @param {Blob} audio - The audio to be transcribed, from a recording or from a file. + * @param {string} feature - The feature name that is calling the transcription. * @param {AbortSignal} requestAbortSignal - The signal to abort the request. - * @returns {Promise} - The promise of a string containing the transcribed audio. + * @return {Promise} - The promise of a string containing the transcribed audio. */ export default async function transcribeAudio( audio: Blob, diff --git a/projects/js-packages/ai-client/src/components/ai-control/ai-control.tsx b/projects/js-packages/ai-client/src/components/ai-control/ai-control.tsx index 60f4155245ef7..3fdbcb42da5fa 100644 --- a/projects/js-packages/ai-client/src/components/ai-control/ai-control.tsx +++ b/projects/js-packages/ai-client/src/components/ai-control/ai-control.tsx @@ -35,7 +35,7 @@ type AIControlProps = { * Base AIControl component. Contains the main structure of the control component and slots for banner, error, actions and message. * * @param {AIControlProps} props - Component props - * @returns {ReactElement} Rendered component + * @return {ReactElement} Rendered component */ export default function AIControl( { className, diff --git a/projects/js-packages/ai-client/src/components/ai-control/block-ai-control.tsx b/projects/js-packages/ai-client/src/components/ai-control/block-ai-control.tsx index c6d16298e033d..6d25d309e7115 100644 --- a/projects/js-packages/ai-client/src/components/ai-control/block-ai-control.tsx +++ b/projects/js-packages/ai-client/src/components/ai-control/block-ai-control.tsx @@ -53,9 +53,9 @@ const debug = debugFactory( 'jetpack-ai-client:block-ai-control' ); /** * BlockAIControl component. Used by the AI Assistant block, adding logic and components to the base AIControl component. * - * @param {BlockAIControlProps} props - Component props - * @param {React.MutableRefObject} ref - Ref to the component - * @returns {ReactElement} Rendered component + * @param {BlockAIControlProps} props - Component props + * @param {React.MutableRefObject} ref - Ref to the component + * @return {ReactElement} Rendered component */ export function BlockAIControl( { diff --git a/projects/js-packages/ai-client/src/components/ai-control/extension-ai-control.tsx b/projects/js-packages/ai-client/src/components/ai-control/extension-ai-control.tsx index 493f79d084367..2265d77f9aede 100644 --- a/projects/js-packages/ai-client/src/components/ai-control/extension-ai-control.tsx +++ b/projects/js-packages/ai-client/src/components/ai-control/extension-ai-control.tsx @@ -45,9 +45,9 @@ type ExtensionAIControlProps = { /** * ExtensionAIControl component. Used by the AI Assistant inline extensions, adding logic and components to the base AIControl component. * - * @param {ExtensionAIControlProps} props - Component props - * @param {React.MutableRefObject} ref - Ref to the component - * @returns {ReactElement} Rendered component + * @param {ExtensionAIControlProps} props - Component props + * @param {React.MutableRefObject} ref - Ref to the component + * @return {ReactElement} Rendered component */ export function ExtensionAIControl( { diff --git a/projects/js-packages/ai-client/src/components/ai-status-indicator/index.tsx b/projects/js-packages/ai-client/src/components/ai-status-indicator/index.tsx index 613f3e7a3f536..0e60c09983aae 100644 --- a/projects/js-packages/ai-client/src/components/ai-status-indicator/index.tsx +++ b/projects/js-packages/ai-client/src/components/ai-status-indicator/index.tsx @@ -21,7 +21,7 @@ export type AiStatusIndicatorProps = { * AiStatusIndicator component. * * @param {AiStatusIndicatorProps} props - component props. - * @returns {React.ReactElement} - rendered component. + * @return {React.ReactElement} - rendered component. */ export default function AiStatusIndicator( { state }: AiStatusIndicatorProps ): React.ReactElement { return ( diff --git a/projects/js-packages/ai-client/src/components/audio-duration-display/index.tsx b/projects/js-packages/ai-client/src/components/audio-duration-display/index.tsx index b71a0ba07c259..165f2fc7b9f18 100644 --- a/projects/js-packages/ai-client/src/components/audio-duration-display/index.tsx +++ b/projects/js-packages/ai-client/src/components/audio-duration-display/index.tsx @@ -16,7 +16,7 @@ type AudioDurationDisplayProps = { * AudioDurationDisplay component. * * @param {AudioDurationDisplayProps} props - Component props. - * @returns {React.ReactElement} Rendered component. + * @return {React.ReactElement} Rendered component. */ export default function AudioDurationDisplay( { duration, diff --git a/projects/js-packages/ai-client/src/components/audio-duration-display/lib/media.ts b/projects/js-packages/ai-client/src/components/audio-duration-display/lib/media.ts index e1d58320c0565..ddee33a8583d3 100644 --- a/projects/js-packages/ai-client/src/components/audio-duration-display/lib/media.ts +++ b/projects/js-packages/ai-client/src/components/audio-duration-display/lib/media.ts @@ -19,9 +19,9 @@ type FormatTimeOptions = { * Formats the given time in milliseconds into a string with the format HH:MM:SS.DD, * adding hours and minutes only when needed. * - * @param {number} time - The time in milliseconds to format. + * @param {number} time - The time in milliseconds to format. * @param {FormatTimeOptions} options - The arguments. - * @returns {string} The formatted time string. + * @return {string} The formatted time string. * @example * const formattedTime1 = formatTime( 1234567, { addDecimalPart: true } ); // Returns "20:34.56" * const formattedTime2 = formatTime( 45123 ); // Returns "00.45" diff --git a/projects/js-packages/ai-client/src/components/message/index.tsx b/projects/js-packages/ai-client/src/components/message/index.tsx index aa57982800c37..f501b294794f0 100644 --- a/projects/js-packages/ai-client/src/components/message/index.tsx +++ b/projects/js-packages/ai-client/src/components/message/index.tsx @@ -67,7 +67,7 @@ const messageIconsMap = { * React component to render a block message. * * @param {MessageProps} props - Component props. - * @returns {React.ReactElement } Banner component. + * @return {React.ReactElement } Banner component. */ export default function Message( { severity = MESSAGE_SEVERITY_INFO, @@ -99,7 +99,7 @@ export default function Message( { /** * React component to render a guideline message. * - * @returns {React.ReactElement } - Message component. + * @return {React.ReactElement } - Message component. */ export function GuidelineMessage(): React.ReactElement { return ( @@ -118,7 +118,7 @@ export function GuidelineMessage(): React.ReactElement { * React component to render an upgrade message for free tier users * * @param {number} requestsRemaining - Number of requests remaining. - * @returns {React.ReactElement } - Message component. + * @return {React.ReactElement } - Message component. */ export function UpgradeMessage( { requestsRemaining, @@ -157,7 +157,7 @@ export function UpgradeMessage( { * React component to render an error message * * @param {number} requestsRemaining - Number of requests remaining. - * @returns {React.ReactElement } - Message component. + * @return {React.ReactElement } - Message component. */ export function ErrorMessage( { error, diff --git a/projects/js-packages/ai-client/src/data-flow/context.tsx b/projects/js-packages/ai-client/src/data-flow/context.tsx index 427b00cf39f25..500b50532ab37 100644 --- a/projects/js-packages/ai-client/src/data-flow/context.tsx +++ b/projects/js-packages/ai-client/src/data-flow/context.tsx @@ -58,7 +58,7 @@ type AiDataContextProviderProps = { /** * AI Data Context * - * @returns {AiDataContextProps} Context. + * @return {AiDataContextProps} Context. */ export const AiDataContext = createContext< AiDataContextProps | object >( {} ); @@ -66,7 +66,7 @@ export const AiDataContext = createContext< AiDataContextProps | object >( {} ); * AI Data Context Provider * * @param {AiDataContextProviderProps} props - Component props. - * @returns {React.ReactElement} Context provider. + * @return {React.ReactElement} Context provider. * @example * * { children } diff --git a/projects/js-packages/ai-client/src/data-flow/use-ai-context.ts b/projects/js-packages/ai-client/src/data-flow/use-ai-context.ts index 59870c9f3d8d0..dc756272ec8fe 100644 --- a/projects/js-packages/ai-client/src/data-flow/use-ai-context.ts +++ b/projects/js-packages/ai-client/src/data-flow/use-ai-context.ts @@ -41,7 +41,7 @@ export type UseAiContextOptions = { * and to subscribe to the request events (onDone, onSuggestion). * * @param {UseAiContextOptions} options - the hook options. - * @returns {AiDataContextProps} the AI Assistant data context. + * @return {AiDataContextProps} the AI Assistant data context. */ export default function useAiContext( { onDone, diff --git a/projects/js-packages/ai-client/src/data-flow/with-ai-assistant-data.tsx b/projects/js-packages/ai-client/src/data-flow/with-ai-assistant-data.tsx index 7b1065307b179..dfaa105b40b31 100644 --- a/projects/js-packages/ai-client/src/data-flow/with-ai-assistant-data.tsx +++ b/projects/js-packages/ai-client/src/data-flow/with-ai-assistant-data.tsx @@ -15,7 +15,7 @@ import { AiDataContextProvider } from './index.js'; * AI Assistant Data context to the wrapped component. * * @param {React.ReactElement} WrappedComponent - component to wrap. - * @returns {React.ReactElement} Wrapped component, with the AI Assistant Data context. + * @return {React.ReactElement} Wrapped component, with the AI Assistant Data context. */ const withAiDataProvider = createHigherOrderComponent( ( WrappedComponent: React.ComponentType ) => { diff --git a/projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts b/projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts index 8311f22273e9c..febb6252bd110 100644 --- a/projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-ai-suggestions/index.ts @@ -134,7 +134,7 @@ type useAiSuggestionsProps = { * Get the error data for a given error code. * * @param {SuggestionErrorCode} errorCode - The error code. - * @returns {RequestingErrorProps} The error data. + * @return {RequestingErrorProps} The error data. */ export function getErrorData( errorCode: SuggestionErrorCode ): RequestingErrorProps { switch ( errorCode ) { @@ -194,7 +194,7 @@ export function getErrorData( errorCode: SuggestionErrorCode ): RequestingErrorP * Remove the llama artifact from a suggestion. * * @param {string} suggestion - The suggestion. - * @returns {string} The suggestion without the llama artifact. + * @return {string} The suggestion without the llama artifact. */ export function removeLlamaArtifact( suggestion: string ): string { return suggestion.replace( /^<\|start_header_id\|>assistant<\|end_header_id\|>[\n]+/, '' ); @@ -205,7 +205,7 @@ export function removeLlamaArtifact( suggestion: string ): string { * by hitting the query endpoint. * * @param {useAiSuggestionsOptions} options - The options for the hook. - * @returns {useAiSuggestionsProps} The props for the hook. + * @return {useAiSuggestionsProps} The props for the hook. */ export default function useAiSuggestions( { prompt, @@ -230,7 +230,7 @@ export default function useAiSuggestions( { * onSuggestion function handler. * * @param {string} suggestion - The suggestion. - * @returns {void} + * @return {void} */ const handleSuggestion = useCallback( ( event: CustomEvent ) => { @@ -250,7 +250,7 @@ export default function useAiSuggestions( { * onDone function handler. * * @param {string} content - The content. - * @returns {void} + * @return {void} */ const handleDone = useCallback( ( event: CustomEvent ) => { @@ -300,9 +300,9 @@ export default function useAiSuggestions( { /** * Request handler. * - * @param {PromptProp} promptArg - The messages array of the prompt. - * @param {AskQuestionOptionsArgProps} options - The options for the askQuestion request. Uses the hook's askQuestionOptions by default. - * @returns {Promise} The promise. + * @param {PromptProp} promptArg - The messages array of the prompt. + * @param {AskQuestionOptionsArgProps} options - The options for the askQuestion request. Uses the hook's askQuestionOptions by default. + * @return {Promise} The promise. */ const request = useCallback( async ( @@ -352,7 +352,7 @@ export default function useAiSuggestions( { /** * Reset the request state. * - * @returns {void} + * @return {void} */ const reset = useCallback( () => { setRequestingState( 'init' ); @@ -363,7 +363,7 @@ export default function useAiSuggestions( { /** * Close the event source connection. * - * @returns {void} + * @return {void} */ const closeEventSource = useCallback( () => { if ( ! eventSourceRef?.current ) { @@ -400,7 +400,7 @@ export default function useAiSuggestions( { /** * Stop suggestion handler. * - * @returns {void} + * @return {void} */ const stopSuggestion = useCallback( () => { closeEventSource(); diff --git a/projects/js-packages/ai-client/src/hooks/use-audio-transcription/index.ts b/projects/js-packages/ai-client/src/hooks/use-audio-transcription/index.ts index 93ca40d5d4f51..e79b2bb8667b5 100644 --- a/projects/js-packages/ai-client/src/hooks/use-audio-transcription/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-audio-transcription/index.ts @@ -49,7 +49,7 @@ type AudioTranscriptionErrorResponse = { /** * Map error response to a string. * @param {Error | string | AudioTranscriptionErrorResponse} error - The error response from the audio transcription service. - * @returns {string} the translated error message + * @return {string} the translated error message */ const mapErrorResponse = ( error: Error | string | AudioTranscriptionErrorResponse ): string => { if ( typeof error === 'string' ) { @@ -92,7 +92,7 @@ const mapErrorResponse = ( error: Error | string | AudioTranscriptionErrorRespon * A hook to handle audio transcription. * * @param {string} feature - The feature name that is calling the transcription. - * @returns {UseAudioTranscriptionReturn} - Object with properties to get the transcription data. + * @return {UseAudioTranscriptionReturn} - Object with properties to get the transcription data. */ export default function useAudioTranscription( { feature, diff --git a/projects/js-packages/ai-client/src/hooks/use-audio-validation/index.ts b/projects/js-packages/ai-client/src/hooks/use-audio-validation/index.ts index 6c6f6184fe8b8..5fd087143fcfd 100644 --- a/projects/js-packages/ai-client/src/hooks/use-audio-validation/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-audio-validation/index.ts @@ -45,7 +45,7 @@ export type ValidatedAudioInformation = { /** * Hook to handle the validation of an audio file. * - * @returns {UseAudioValidationReturn} - Object with the audio validation state and the function to validate the audio. + * @return {UseAudioValidationReturn} - Object with the audio validation state and the function to validate the audio. */ export default function useAudioValidation(): UseAudioValidationReturn { const [ isValidatingAudio, setIsValidatingAudio ] = useState< boolean >( false ); diff --git a/projects/js-packages/ai-client/src/hooks/use-image-generator/index.ts b/projects/js-packages/ai-client/src/hooks/use-image-generator/index.ts index b5fee88814e53..adee712228821 100644 --- a/projects/js-packages/ai-client/src/hooks/use-image-generator/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-image-generator/index.ts @@ -19,9 +19,9 @@ type ImageGenerationResponse = { /** * Cut the post content on a given lenght so the total length of the prompt is not longer than 4000 characters. - * @param {string} content - the content to be truncated + * @param {string} content - the content to be truncated * @param {number} currentPromptLength - the length of the prompt already in use - * @returns {string} a truncated version of the content respecting the prompt length limit + * @return {string} a truncated version of the content respecting the prompt length limit */ const truncateContent = ( content: string, currentPromptLength: number ): string => { const maxLength = 4000; @@ -35,8 +35,8 @@ const truncateContent = ( content: string, currentPromptLength: number ): string /** * Create the prompt string based on the provided context. * @param {string} postContent - the content of the post - * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated. - * @returns {string} the prompt string + * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated. + * @return {string} the prompt string */ const getDalleImageGenerationPrompt = ( postContent: string, userPrompt?: string ): string => { /** @@ -89,8 +89,8 @@ This is the post content: /** * Create the Stable Diffusion pre-processing prompt based on the provided context. * @param {string} postContent - the content of the post. - * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated. - * @returns {string} the prompt string to be fed to the AI Assistant model. + * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated. + * @return {string} the prompt string to be fed to the AI Assistant model. */ const getStableDiffusionPreProcessingPrompt = ( postContent: string, @@ -134,9 +134,9 @@ Return just the prompt, without comments. The content is: /** * Uses the Jetpack AI query endpoint to produce a prompt for the stable diffusion model. * @param {string} postContent - the content of the post. - * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated - * @param {string} feature - the feature to be used for the image generation. - * @returns {string} the prompt string to be used on stable diffusion image generation. + * @param {string} userPrompt - the user prompt for the image generation, if provided. Max length is 1000 characters, will be truncated + * @param {string} feature - the feature to be used for the image generation. + * @return {string} the prompt string to be used on stable diffusion image generation. */ const getStableDiffusionImageGenerationPrompt = async ( postContent: string, diff --git a/projects/js-packages/ai-client/src/hooks/use-media-recording/index.ts b/projects/js-packages/ai-client/src/hooks/use-media-recording/index.ts index ca63d35de8707..ae8a688e59ece 100644 --- a/projects/js-packages/ai-client/src/hooks/use-media-recording/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-media-recording/index.ts @@ -84,7 +84,7 @@ type MediaRecorderEvent = { * react custom hook to handle media recording. * * @param {UseMediaRecordingProps} props - The props - * @returns {UseMediaRecordingReturn} The media recorder instance + * @return {UseMediaRecordingReturn} The media recorder instance */ export default function useMediaRecording( { onDone, @@ -118,7 +118,7 @@ export default function useMediaRecording( { /** * Get the recorded blob. * - * @returns {Blob} The recorded blob + * @return {Blob} The recorded blob */ function getBlob() { if ( MediaRecorder.isTypeSupported( MEDIA_TYPE_MP4_MP4A ) ) { @@ -265,7 +265,7 @@ export default function useMediaRecording( { * `stop` event listener for the media recorder instance. * Happens after the last `dataavailable` event. * - * @returns {void} + * @return {void} */ function onStopListener(): void { const lastBlob = getBlob(); @@ -293,7 +293,7 @@ export default function useMediaRecording( { * `dataavailable` event listener for the media recorder instance. * * @param {MediaRecorderEvent} event - The event object - * @returns {void} + * @return {void} */ function onDataAvailableListener( event: MediaRecorderEvent ): void { const { data } = event; diff --git a/projects/js-packages/ai-client/src/hooks/use-save-to-media-library/index.ts b/projects/js-packages/ai-client/src/hooks/use-save-to-media-library/index.ts index 88abbceeb94f2..24685ff2a8f73 100644 --- a/projects/js-packages/ai-client/src/hooks/use-save-to-media-library/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-save-to-media-library/index.ts @@ -15,7 +15,7 @@ const debug = debugFactory( 'ai-client:save-to-media-library' ); /** * Hook to save an image to the media library. * - * @returns {object} Object with the loading state and the function to save the image to the media library. + * @return {object} Object with the loading state and the function to save the image to the media library. */ export default function useSaveToMediaLibrary() { const [ isLoading, setIsLoading ] = useState( false ); diff --git a/projects/js-packages/ai-client/src/hooks/use-transcription-post-processing/index.ts b/projects/js-packages/ai-client/src/hooks/use-transcription-post-processing/index.ts index 7aeee850b7e2e..48b47f0a1dfe8 100644 --- a/projects/js-packages/ai-client/src/hooks/use-transcription-post-processing/index.ts +++ b/projects/js-packages/ai-client/src/hooks/use-transcription-post-processing/index.ts @@ -42,7 +42,7 @@ export type UseTranscriptionPostProcessingProps = { * A hook to handle transcription post-processing. * * @param {string} feature - The feature name that is calling the post-processing actions. - * @returns {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results. + * @return {UseTranscriptionPostProcessingReturn} - Object with properties to get the post-processing results. */ export default function useTranscriptionPostProcessing( { feature, diff --git a/projects/js-packages/ai-client/src/icons/stories/index.stories.tsx b/projects/js-packages/ai-client/src/icons/stories/index.stories.tsx index 44e9e998c4d4b..eaf9c4d31feff 100644 --- a/projects/js-packages/ai-client/src/icons/stories/index.stories.tsx +++ b/projects/js-packages/ai-client/src/icons/stories/index.stories.tsx @@ -27,7 +27,7 @@ const meta: AIControlStoryMeta = { /** * Icons story components. * - * @returns {object} - story component + * @return {object} - story component */ function IconsStory() { return ( diff --git a/projects/js-packages/ai-client/src/jwt/index.ts b/projects/js-packages/ai-client/src/jwt/index.ts index 3c55ab247033f..eaa463ca5a281 100644 --- a/projects/js-packages/ai-client/src/jwt/index.ts +++ b/projects/js-packages/ai-client/src/jwt/index.ts @@ -37,7 +37,7 @@ const JWT_TOKEN_EXPIRATION_TIME = 2 * 60 * 1000; // 2 minutes * Request a token from the Jetpack site. * * @param {RequestTokenOptions} options - Options - * @returns {Promise} The token and the blogId + * @return {Promise} The token and the blogId */ export default async function requestJwt( { apiNonce, diff --git a/projects/js-packages/ai-client/src/libs/markdown/html-to-markdown.ts b/projects/js-packages/ai-client/src/libs/markdown/html-to-markdown.ts index c37f19510b07f..b0cd910dd0a17 100644 --- a/projects/js-packages/ai-client/src/libs/markdown/html-to-markdown.ts +++ b/projects/js-packages/ai-client/src/libs/markdown/html-to-markdown.ts @@ -61,7 +61,7 @@ export default class HTMLToMarkdown { * Renders HTML from Markdown content with specified processing rules. * @param {object} options - The options to use when rendering the Markdown content * @param {string} options.content - The HTML content to render - * @returns {string} The rendered Markdown content + * @return {string} The rendered Markdown content */ render( { content }: { content: string } ): string { const rendered = this.turndownService.turndown( content ); diff --git a/projects/js-packages/ai-client/src/libs/markdown/markdown-to-html.ts b/projects/js-packages/ai-client/src/libs/markdown/markdown-to-html.ts index 54924cbce4ff6..cf51a5f006f25 100644 --- a/projects/js-packages/ai-client/src/libs/markdown/markdown-to-html.ts +++ b/projects/js-packages/ai-client/src/libs/markdown/markdown-to-html.ts @@ -96,11 +96,11 @@ export default class MarkdownToHTML { /** * Renders HTML from Markdown content with specified processing rules. - * @param {object} options - The options to use when rendering the HTML content - * @param {string} options.content - The Markdown content to render - * @param {string} options.rules - The rules to apply to the rendered content + * @param {object} options - The options to use when rendering the HTML content + * @param {string} options.content - The Markdown content to render + * @param {string} options.rules - The rules to apply to the rendered content * @param {boolean} options.extension - Whether to apply the extension-specific rules - * @returns {string} The rendered HTML content + * @return {string} The rendered HTML content */ render( { content, diff --git a/projects/js-packages/ai-client/src/logo-generator/lib/logo-storage.ts b/projects/js-packages/ai-client/src/logo-generator/lib/logo-storage.ts index 2607f3597e7d6..1649b99b71424 100644 --- a/projects/js-packages/ai-client/src/logo-generator/lib/logo-storage.ts +++ b/projects/js-packages/ai-client/src/logo-generator/lib/logo-storage.ts @@ -10,13 +10,13 @@ const MAX_LOGOS = 10; /** * Add an entry to the site's logo history. * - * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage - * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID - * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo + * @param {SaveToStorageProps} saveToStorageProps - The properties to save to storage + * @param {SaveToStorageProps.siteId} saveToStorageProps.siteId - The site ID + * @param {SaveToStorageProps.url} saveToStorageProps.url - The URL of the logo * @param {SaveToStorageProps.description} saveToStorageProps.description - The description of the logo, based on the prompt used to generate it - * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend + * @param {SaveToStorageProps.mediaId} saveToStorageProps.mediaId - The media ID of the logo on the backend * - * @returns {Logo} The logo that was saved + * @return {Logo} The logo that was saved */ export function stashLogo( { siteId, url, description, mediaId }: SaveToStorageProps ) { const storedContent = getSiteLogoHistory( siteId ); @@ -40,12 +40,12 @@ export function stashLogo( { siteId, url, description, mediaId }: SaveToStorageP /** * Update an entry in the site's logo history. * - * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage - * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID - * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update - * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo + * @param {UpdateInStorageProps} updateInStorageProps - The properties to update in storage + * @param {UpdateInStorageProps.siteId} updateInStorageProps.siteId - The site ID + * @param {UpdateInStorageProps.url} updateInStorageProps.url - The URL of the logo to update + * @param {UpdateInStorageProps.newUrl} updateInStorageProps.newUrl - The new URL of the logo * @param {UpdateInStorageProps.mediaId} updateInStorageProps.mediaId - The new media ID of the logo - * @returns {Logo} The logo that was updated + * @return {Logo} The logo that was updated */ export function updateLogo( { siteId, url, newUrl, mediaId }: UpdateInStorageProps ) { const storedContent = getSiteLogoHistory( siteId ); @@ -69,7 +69,7 @@ export function updateLogo( { siteId, url, newUrl, mediaId }: UpdateInStoragePro * Get the logo history for a site. * * @param {string} siteId - The site ID to get the logo history for - * @returns {Logo[]} The logo history for the site + * @return {Logo[]} The logo history for the site */ export function getSiteLogoHistory( siteId: string ) { const storedString = localStorage.getItem( `logo-history-${ siteId }` ); @@ -104,8 +104,8 @@ export function getSiteLogoHistory( siteId: string ) { /** * Check if the logo history for a site is empty. * - * @param {string }siteId - The site ID to check the logo history for - * @returns {boolean} Whether the logo history for the site is empty + * @param {string } siteId - The site ID to check the logo history for + * @return {boolean} Whether the logo history for the site is empty */ export function isLogoHistoryEmpty( siteId: string ) { const storedContent = getSiteLogoHistory( siteId ); @@ -116,10 +116,10 @@ export function isLogoHistoryEmpty( siteId: string ) { /** * Remove an entry from the site's logo history. * - * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage - * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID + * @param {RemoveFromStorageProps} removeFromStorageProps - The properties to remove from storage + * @param {RemoveFromStorageProps.siteId} removeFromStorageProps.siteId - The site ID * @param {RemoveFromStorageProps.mediaId} removeFromStorageProps.mediaId - The media ID of the logo to remove - * @returns {void} + * @return {void} */ export function removeLogo( { siteId, mediaId }: RemoveFromStorageProps ) { const storedContent = getSiteLogoHistory( siteId ); @@ -137,7 +137,7 @@ export function removeLogo( { siteId, mediaId }: RemoveFromStorageProps ) { * Clear deleted media from the site's logo history, checking if the media still exists on the backend. * * @param {string} siteId - The site ID to clear deleted media for - * @returns {Promise} + * @return {Promise} */ export async function clearDeletedMedia( siteId: string ) { const storedContent = getSiteLogoHistory( siteId ); diff --git a/projects/js-packages/ai-client/src/logo-generator/lib/media-exists.ts b/projects/js-packages/ai-client/src/logo-generator/lib/media-exists.ts index 9df5950e1f6a2..483025cac8368 100644 --- a/projects/js-packages/ai-client/src/logo-generator/lib/media-exists.ts +++ b/projects/js-packages/ai-client/src/logo-generator/lib/media-exists.ts @@ -10,9 +10,9 @@ import type { CheckMediaProps } from '../types.js'; /** * Uses the media information to confirm it exists or not on the server. * - * @param {CheckMediaProps} checkMediaProps - the media details to check + * @param {CheckMediaProps} checkMediaProps - the media details to check * @param {CheckMediaProps.mediaId} checkMediaProps.mediaId - the id of the media to check - * @returns {Promise} - true if the media exists, false otherwise + * @return {Promise} - true if the media exists, false otherwise */ export async function mediaExists( { mediaId }: CheckMediaProps ): Promise< boolean > { const id = Number( mediaId ); diff --git a/projects/js-packages/ai-client/src/logo-generator/lib/set-site-logo.ts b/projects/js-packages/ai-client/src/logo-generator/lib/set-site-logo.ts index a677c74137c70..d95cbd89c20a6 100644 --- a/projects/js-packages/ai-client/src/logo-generator/lib/set-site-logo.ts +++ b/projects/js-packages/ai-client/src/logo-generator/lib/set-site-logo.ts @@ -10,10 +10,10 @@ import type { SetSiteLogoProps, SetSiteLogoResponseProps } from '../types.js'; /** * Set the site logo using a backend request. * - * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo - * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID + * @param {SetSiteLogoProps} setSiteLogoProps - The properties to set the site logo + * @param {SetSiteLogoProps.siteId} setSiteLogoProps.siteId - The site ID * @param {SetSiteLogoProps.imageId} setSiteLogoProps.imageId - The image ID to set as the site logo - * @returns {Promise} The response from the request + * @return {Promise} The response from the request */ export async function setSiteLogo( { siteId, imageId }: SetSiteLogoProps ) { const body = { diff --git a/projects/js-packages/ai-client/src/logo-generator/lib/wpcom-limited-request.ts b/projects/js-packages/ai-client/src/logo-generator/lib/wpcom-limited-request.ts index fbfc67c167e36..9ed6d13bbb3fd 100644 --- a/projects/js-packages/ai-client/src/logo-generator/lib/wpcom-limited-request.ts +++ b/projects/js-packages/ai-client/src/logo-generator/lib/wpcom-limited-request.ts @@ -13,7 +13,7 @@ let concurrentCounter = 0; /** * Concurrency-limited request to wpcom-proxy-request. * @param { object } params - The request params, as expected by apiFetch. - * @returns { Promise } The response. + * @return { Promise } The response. * @throws { Error } If there are too many concurrent requests. */ export default async function wpcomLimitedRequest< T >( params: object ): Promise< T > { diff --git a/projects/js-packages/ai-client/src/logo-generator/store/actions.ts b/projects/js-packages/ai-client/src/logo-generator/store/actions.ts index a166edf0b3939..40d0f91e9577b 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/actions.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/actions.ts @@ -41,7 +41,7 @@ import type { SiteDetails } from '../types.js'; * Map the response from the `sites/$site/ai-assistant-feature` * endpoint to the AI Assistant feature props. * @param { AiAssistantFeatureEndpointResponseProps } response - The response from the endpoint. - * @returns { AiFeatureProps } The AI Assistant feature props. + * @return { AiFeatureProps } The AI Assistant feature props. */ export function mapAiFeatureResponseToAiFeatureProps( response: AiAssistantFeatureEndpointResponseProps @@ -77,7 +77,7 @@ const actions = { /** * Thunk action to fetch the AI Assistant feature from the API. - * @returns {Function} The thunk action. + * @return {Function} The thunk action. */ fetchAiAssistantFeature() { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -106,7 +106,7 @@ const actions = { * This thunk action is used to increase * the requests count for the current usage period. * @param {number} count - The number of requests to increase. Default is 1. - * @returns {Function} The thunk action. + * @return {Function} The thunk action. */ increaseAiAssistantRequestsCount( count: number = 1 ) { // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts b/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts index 50db694226385..2b073c252cde2 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/reducer.ts @@ -40,28 +40,28 @@ import type { SiteDetails } from '../types.js'; /** * Reducer for the Logo Generator store. * - * @param {LogoGeneratorStateProp} state - The current state - * @param {object} action - The action to apply, as described by the properties below - * @param {string} action.type - The action type - * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state - * @param {number} action.count - The number of requests to increase the counter by - * @param {boolean} action.requireUpgrade - Whether an upgrade is required - * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled - * @param {SiteDetails} action.siteDetails - The site details - * @param {number} action.selectedLogoIndex - The selected logo index - * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library - * @param {boolean} action.isApplyingLogo - Whether a logo is being applied - * @param {object} action.logo - The logo to save, as described by the properties below - * @param {string} action.logo.url - The logo URL - * @param {string} action.logo.description - The logo description - * @param {number} action.mediaId - The media ID from backend - * @param {string} action.url - The URL to save - * @param {boolean} action.isRequestingImage - Whether an image is being requested - * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested - * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history - * @param {RequestError} action.error - The error to set - * @param {string} action.context - The context where the tool is being used - * @returns {LogoGeneratorStateProp} The new state + * @param {LogoGeneratorStateProp} state - The current state + * @param {object} action - The action to apply, as described by the properties below + * @param {string} action.type - The action type + * @param {AiFeatureStateProps} action.feature - The AI Assistant feature state + * @param {number} action.count - The number of requests to increase the counter by + * @param {boolean} action.requireUpgrade - Whether an upgrade is required + * @param {boolean} action.tierPlansEnabled - Whether tier plans are enabled + * @param {SiteDetails} action.siteDetails - The site details + * @param {number} action.selectedLogoIndex - The selected logo index + * @param {boolean} action.isSavingLogoToLibrary - Whether a logo is being saved to the library + * @param {boolean} action.isApplyingLogo - Whether a logo is being applied + * @param {object} action.logo - The logo to save, as described by the properties below + * @param {string} action.logo.url - The logo URL + * @param {string} action.logo.description - The logo description + * @param {number} action.mediaId - The media ID from backend + * @param {string} action.url - The URL to save + * @param {boolean} action.isRequestingImage - Whether an image is being requested + * @param {boolean} action.isEnhancingPrompt - Whether a prompt enhancement is being requested + * @param {Array< { url: string; description: string; mediaId?: number } >} action.history - The logo history + * @param {RequestError} action.error - The error to set + * @param {string} action.context - The context where the tool is being used + * @return {LogoGeneratorStateProp} The new state */ export default function reducer( state = INITIAL_STATE, diff --git a/projects/js-packages/ai-client/src/logo-generator/store/selectors.ts b/projects/js-packages/ai-client/src/logo-generator/store/selectors.ts index c9445b73ab635..a642d636e95dd 100644 --- a/projects/js-packages/ai-client/src/logo-generator/store/selectors.ts +++ b/projects/js-packages/ai-client/src/logo-generator/store/selectors.ts @@ -9,7 +9,7 @@ const selectors = { /** * Return the AI Assistant feature. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {Partial} The AI Assistant feature data. + * @return {Partial} The AI Assistant feature data. */ getAiAssistantFeature( state: LogoGeneratorStateProp ): Partial< AiFeatureProps > { // Clean up the _meta property. @@ -21,8 +21,8 @@ const selectors = { /** * Return the site details. - * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {Partial | undefined} The site details. + * @param {LogoGeneratorStateProp} state - The app state tree. + * @return {Partial | undefined} The site details. */ getSiteDetails( state: LogoGeneratorStateProp ): Partial< SiteDetails > | undefined { return state.siteDetails; @@ -31,7 +31,7 @@ const selectors = { /** * Get the isRequesting flag for the AI Assistant feature. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isRequesting flag. + * @return {boolean} The isRequesting flag. */ getIsRequestingAiAssistantFeature( state: LogoGeneratorStateProp ): boolean { return state.features.aiAssistantFeature?._meta?.isRequesting ?? false; @@ -40,7 +40,7 @@ const selectors = { /** * Get the logos history. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {Array} The logos history array. + * @return {Array} The logos history array. */ getLogos( state: LogoGeneratorStateProp ): Array< Logo > { return state.history ?? []; @@ -49,7 +49,7 @@ const selectors = { /** * Get the selected logo index. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {number | null} The selected logo index. + * @return {number | null} The selected logo index. */ getSelectedLogoIndex( state: LogoGeneratorStateProp ): number | null { return state.selectedLogoIndex ?? null; @@ -58,7 +58,7 @@ const selectors = { /** * Get the selected logo. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {Logo} The selected logo. + * @return {Logo} The selected logo. */ getSelectedLogo( state: LogoGeneratorStateProp ): Logo { return state.history?.[ state.selectedLogoIndex ] ?? null; @@ -67,7 +67,7 @@ const selectors = { /** * Get the isSavingToLibrary flag. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isSavingToLibrary flag. + * @return {boolean} The isSavingToLibrary flag. */ getIsSavingLogoToLibrary( state: LogoGeneratorStateProp ): boolean { return state._meta?.isSavingLogoToLibrary ?? false; @@ -76,7 +76,7 @@ const selectors = { /** * Get the isApplyingLogo flag. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isApplyingLogo flag. + * @return {boolean} The isApplyingLogo flag. */ getIsApplyingLogo( state: LogoGeneratorStateProp ): boolean { return state._meta?.isApplyingLogo ?? false; @@ -85,7 +85,7 @@ const selectors = { /** * Get the isEnhancingPrompt flag. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isEnhancingPrompt flag. + * @return {boolean} The isEnhancingPrompt flag. */ getIsEnhancingPrompt( state: LogoGeneratorStateProp ): boolean { return state._meta?.isEnhancingPrompt ?? false; @@ -94,7 +94,7 @@ const selectors = { /** * Get the isRequestingImage flag. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isRequestingImage flag. + * @return {boolean} The isRequestingImage flag. */ getIsRequestingImage( state: LogoGeneratorStateProp ): boolean { return state._meta?.isRequestingImage ?? false; @@ -103,7 +103,7 @@ const selectors = { /** * Get an aggregated isBusy flag, based on the loading states of the app. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The isBusy flag. + * @return {boolean} The isBusy flag. */ getIsBusy( state: LogoGeneratorStateProp ): boolean { return ( @@ -117,7 +117,7 @@ const selectors = { /** * Get the requireUpgrade value from aiAssistantFeature * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {boolean} The requireUpgrade flag. + * @return {boolean} The requireUpgrade flag. */ getRequireUpgrade( state: LogoGeneratorStateProp ): boolean { const feature = state.features.aiAssistantFeature; @@ -137,7 +137,7 @@ const selectors = { /** * Get the featureFetchError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The featureFetchError value. + * @return {RequestError} The featureFetchError value. */ getFeatureFetchError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.featureFetchError ?? null; @@ -146,7 +146,7 @@ const selectors = { /** * Get the firstLogoPromptFetchError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The firstLogoPromptFetchError value. + * @return {RequestError} The firstLogoPromptFetchError value. */ getFirstLogoPromptFetchError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.firstLogoPromptFetchError ?? null; @@ -155,7 +155,7 @@ const selectors = { /** * Get the enhancePromptFetchError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The enhancePromptFetchError value. + * @return {RequestError} The enhancePromptFetchError value. */ getEnhancePromptFetchError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.enhancePromptFetchError ?? null; @@ -164,7 +164,7 @@ const selectors = { /** * Get the logoFetchError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The logoFetchError value. + * @return {RequestError} The logoFetchError value. */ getLogoFetchError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.logoFetchError ?? null; @@ -173,7 +173,7 @@ const selectors = { /** * Get the saveToLibraryError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The saveToLibraryError value. + * @return {RequestError} The saveToLibraryError value. */ getSaveToLibraryError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.saveToLibraryError ?? null; @@ -182,7 +182,7 @@ const selectors = { /** * Get the logoUpdateError value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {RequestError} The logoUpdateError value. + * @return {RequestError} The logoUpdateError value. */ getLogoUpdateError( state: LogoGeneratorStateProp ): RequestError { return state._meta?.logoUpdateError ?? null; @@ -191,7 +191,7 @@ const selectors = { /** * Get the context value. * @param {LogoGeneratorStateProp} state - The app state tree. - * @returns {string} The context value. + * @return {string} The context value. */ getContext( state: LogoGeneratorStateProp ): string { return state._meta?.context ?? ''; diff --git a/projects/js-packages/ai-client/src/suggestions-event-source/index.ts b/projects/js-packages/ai-client/src/suggestions-event-source/index.ts index 30b31d7877a00..f923ef3cf4b9e 100644 --- a/projects/js-packages/ai-client/src/suggestions-event-source/index.ts +++ b/projects/js-packages/ai-client/src/suggestions-event-source/index.ts @@ -53,7 +53,7 @@ const debug = debugFactory( 'jetpack-ai-client:suggestions-event-source' ); * when the stream is closed. * It also emits a 'suggestion' event with the full suggestion received so far * - * @returns {EventSource} The event source + * @return {EventSource} The event source * @fires SuggestionsEventSource#suggestion - The full suggestion has been received so far * @fires SuggestionsEventSource#message - A message has been received * @fires SuggestionsEventSource#chunk - A chunk of data has been received diff --git a/projects/js-packages/analytics/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/analytics/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/analytics/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/analytics/index.jsx b/projects/js-packages/analytics/index.jsx index 2bc8048be4be3..df28a7aec6b08 100644 --- a/projects/js-packages/analytics/index.jsx +++ b/projects/js-packages/analytics/index.jsx @@ -19,8 +19,8 @@ window.ga.l = +new Date(); * Build a query string * * @param {string} group - the group - * @param {string} name - the name - * @returns {string} - the uricomponent + * @param {string} name - the name + * @return {string} - the uricomponent */ function buildQuerystring( group, name ) { let uriComponent = ''; @@ -42,8 +42,8 @@ function buildQuerystring( group, name ) { * Build a query string with no prefix * * @param {string} group - the group - * @param {string} name - the name - * @returns {string} - the uricomponent + * @param {string} name - the name + * @return {string} - the uricomponent */ function buildQuerystringNoPrefix( group, name ) { let uriComponent = ''; diff --git a/projects/js-packages/analytics/package.json b/projects/js-packages/analytics/package.json index 0ff3d743a8ccb..5a3fd3d74e676 100644 --- a/projects/js-packages/analytics/package.json +++ b/projects/js-packages/analytics/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-analytics", - "version": "0.1.29", + "version": "0.1.30-alpha", "description": "Jetpack Analytics Package", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/analytics/#readme", "bugs": { diff --git a/projects/js-packages/api/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/api/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/api/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/api/index.jsx b/projects/js-packages/api/index.jsx index af426f0f0f36d..8233d0ba8a616 100644 --- a/projects/js-packages/api/index.jsx +++ b/projects/js-packages/api/index.jsx @@ -5,7 +5,7 @@ import { addQueryArgs } from '@wordpress/url'; * Helps create new custom error classes to better notify upper layers. * * @param {string} name - the Error name that will be availble in Error.name - * @returns {Error} a new custom error class. + * @return {Error} a new custom error class. */ function createCustomError( name ) { class CustomError extends Error { @@ -26,7 +26,7 @@ export const FetchNetworkError = createCustomError( 'FetchNetworkError' ); /** * Create a Jetpack Rest Api Client * - * @param {string} root - The API root + * @param {string} root - The API root * @param {string} nonce - The API Nonce */ function JetpackRestApiClient( root, nonce ) { @@ -550,7 +550,7 @@ function JetpackRestApiClient( root, nonce ) { * The default callback to add a cachebuster parameter to route * * @param {string} route - the route - * @returns {string} - the route with the cachebuster appended + * @return {string} - the route with the cachebuster appended */ function addCacheBuster( route ) { const parts = route.split( '?' ), @@ -565,9 +565,9 @@ function JetpackRestApiClient( root, nonce ) { /** * Generate a request promise for the route and params. Automatically adds a cachebuster. * - * @param {string} route - the route + * @param {string} route - the route * @param {object} params - the params - * @returns {Promise} - the http request promise + * @return {Promise} - the http request promise */ function getRequest( route, params ) { return fetch( cacheBusterCallback( route ), params ); @@ -576,10 +576,10 @@ function JetpackRestApiClient( root, nonce ) { /** * Generate a POST request promise for the route and params. Automatically adds a cachebuster. * - * @param {string} route - the route + * @param {string} route - the route * @param {object} params - the params - * @param {string} body - the body - * @returns {Promise} - the http response promise + * @param {string} body - the body + * @return {Promise} - the http response promise */ function postRequest( route, params, body ) { return fetch( route, Object.assign( {}, params, body ) ).catch( catchNetworkErrors ); @@ -589,7 +589,7 @@ function JetpackRestApiClient( root, nonce ) { * Returns the stats data URL for the given date range * * @param {string} range - the range - * @returns {string} - the stats URL + * @return {string} - the stats URL */ function statsDataUrl( range ) { let url = `${ apiRoot }jetpack/v4/module/stats/data`; @@ -605,7 +605,7 @@ function JetpackRestApiClient( root, nonce ) { * Returns stats data if possible, otherwise an empty object * * @param {object} statsData - the stats data or error - * @returns {object} - the handled stats data + * @return {object} - the handled stats data */ function handleStatsResponseError( statsData ) { // If we get a .response property, it means that .com's response is errory. @@ -628,7 +628,7 @@ export default restApi; * Check the status of the response. Throw an error if it was not OK * * @param {Response} response - the API response - * @returns {Promise} - a promise to return the parsed JSON body as an object + * @return {Promise} - a promise to return the parsed JSON body as an object */ function checkStatus( response ) { // Regular success responses @@ -660,7 +660,7 @@ function checkStatus( response ) { * Parse the JSON response * * @param {Response} response - the response object - * @returns {Promise} - promise to return the parsed json object + * @return {Promise} - promise to return the parsed json object */ function parseJsonResponse( response ) { return response.json().catch( e => catchJsonParseError( e, response.redirected, response.url ) ); @@ -669,9 +669,9 @@ function parseJsonResponse( response ) { /** * Throw appropriate exception given an API error * - * @param {Error} e - the error + * @param {Error} e - the error * @param {boolean} redirected - are we being redirected? - * @param {string} url - the URL that returned the error + * @param {string} url - the URL that returned the error */ function catchJsonParseError( e, redirected, url ) { const err = redirected ? new JsonParseAfterRedirectError( url ) : new JsonParseError(); diff --git a/projects/js-packages/api/package.json b/projects/js-packages/api/package.json index ccf9f545b98e9..421769f1d7159 100644 --- a/projects/js-packages/api/package.json +++ b/projects/js-packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-api", - "version": "0.17.10", + "version": "0.17.11-alpha", "description": "Jetpack Api Package", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/api/#readme", "bugs": { diff --git a/projects/js-packages/boost-score-api/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/boost-score-api/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/boost-score-api/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/boost-score-api/package.json b/projects/js-packages/boost-score-api/package.json index 61e7b51d5f606..184c57c3e42b0 100644 --- a/projects/js-packages/boost-score-api/package.json +++ b/projects/js-packages/boost-score-api/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-boost-score-api", - "version": "0.1.34", + "version": "0.1.35-alpha", "description": "A package to get the Jetpack Boost score of a site", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/boost-score-api/#readme", "bugs": { diff --git a/projects/js-packages/boost-score-api/src/api.ts b/projects/js-packages/boost-score-api/src/api.ts index 9244aca3ee9ed..8b8c2bd80c974 100644 --- a/projects/js-packages/boost-score-api/src/api.ts +++ b/projects/js-packages/boost-score-api/src/api.ts @@ -8,7 +8,7 @@ import type { JSONObject } from './utils/json-object-type'; * * @param {string} path - The path to the endpoint. * @param {string} root - The root URL to use. - * @returns {string} - The full URL. + * @return {string} - The full URL. */ function getEndpointUrl( path: string, root: string ): string { return root + JETPACK_BOOST_REST_NAMESPACE + JETPACK_BOOST_REST_PREFIX + path; @@ -17,12 +17,12 @@ function getEndpointUrl( path: string, root: string ): string { /** * Send a request to the Boost REST API. * - * @param {string} method - The HTTP method to use. - * @param {string} root - The root URL to use. - * @param {string} path - The path to the endpoint. - * @param {null | JSONObject} body - The body of the request. - * @param {string} nonce - The nonce to use. - * @returns {Promise} - The response. + * @param {string} method - The HTTP method to use. + * @param {string} root - The root URL to use. + * @param {string} path - The path to the endpoint. + * @param {null | JSONObject} body - The body of the request. + * @param {string} nonce - The nonce to use. + * @return {Promise} - The response. */ async function sendRequest( method: string, @@ -79,12 +79,12 @@ async function sendRequest( /** * Make a request to the Boost REST API. * - * @param {string} method - The HTTP method to use. - * @param {string} root - The root URL to use. - * @param {string} path - The path to the endpoint. - * @param {null | JSONObject} body - The body of the request. - * @param {string} nonce - The nonce to use. - * @returns {Promise} - The response. + * @param {string} method - The HTTP method to use. + * @param {string} root - The root URL to use. + * @param {string} path - The path to the endpoint. + * @param {null | JSONObject} body - The body of the request. + * @param {string} nonce - The nonce to use. + * @return {Promise} - The response. */ async function makeRequest< T = JSONObject >( method: string, @@ -123,10 +123,10 @@ async function makeRequest< T = JSONObject >( /** * Make a GET request to the Boost REST API. * - * @param {string} root - The root URL to use. - * @param {string} path - The path to the endpoint. + * @param {string} root - The root URL to use. + * @param {string} path - The path to the endpoint. * @param {string} nonce - The nonce to use. - * @returns {Promise} - The response. + * @return {Promise} - The response. */ function get< T = JSONObject >( root: string, path: string, nonce: string ): Promise< T > { return makeRequest< T >( 'get', root, path, null, nonce ); @@ -135,11 +135,11 @@ function get< T = JSONObject >( root: string, path: string, nonce: string ): Pro /** * Make a POST request to the Boost REST API. * - * @param {string} root - The root URL to use. - * @param {string} path - The path to the endpoint. - * @param {null | JSONObject} body - The body of the request. - * @param {string} nonce - The nonce to use. - * @returns {Promise} - The response. + * @param {string} root - The root URL to use. + * @param {string} path - The path to the endpoint. + * @param {null | JSONObject} body - The body of the request. + * @param {string} nonce - The nonce to use. + * @return {Promise} - The response. */ function post< T = JSONObject >( root: string, diff --git a/projects/js-packages/boost-score-api/src/index.ts b/projects/js-packages/boost-score-api/src/index.ts index 0ee22a6c02e98..3643140838ee4 100644 --- a/projects/js-packages/boost-score-api/src/index.ts +++ b/projects/js-packages/boost-score-api/src/index.ts @@ -66,11 +66,11 @@ type ParsedApiResponse = { * Kick off a request to generate speed scores for this site. Will automatically * poll for a response until the task is done, returning a SpeedScores object. * - * @param {boolean} force - Force regenerate speed scores. - * @param {string} rootUrl - Root URL for the HTTP request. - * @param {string} siteUrl - URL of the site. - * @param {string} nonce - Nonce to use for authentication. - * @returns {SpeedScoresSet} Speed scores returned by the server. + * @param {boolean} force - Force regenerate speed scores. + * @param {string} rootUrl - Root URL for the HTTP request. + * @param {string} siteUrl - URL of the site. + * @param {string} nonce - Nonce to use for authentication. + * @return {SpeedScoresSet} Speed scores returned by the server. */ export async function requestSpeedScores( force = false, @@ -103,8 +103,8 @@ export async function requestSpeedScores( * * @param {string} rootUrl - Root URL for the HTTP request. * @param {string} siteUrl - URL of the site. - * @param {string} nonce - Nonce to use for authentication. - * @returns {SpeedHistoryResponse} Speed score history returned by the server. + * @param {string} nonce - Nonce to use for authentication. + * @return {SpeedHistoryResponse} Speed score history returned by the server. */ export async function requestSpeedScoresHistory( rootUrl: string, @@ -128,7 +128,7 @@ export async function requestSpeedScoresHistory( * scores (if ready), and a status (success|pending|error). * * @param {JSONObject} response - API response to parse - * @returns {ParsedApiResponse} API response, processed. + * @return {ParsedApiResponse} API response, processed. */ function parseResponse( response: JSONObject ): ParsedApiResponse { // Handle an explicit error @@ -181,8 +181,8 @@ function parseResponse( response: JSONObject ): ParsedApiResponse { * * @param {string} rootUrl - Root URL of the site to request metrics for * @param {string} siteUrl - Site URL to request metrics for - * @param {string} nonce - Nonce to use for authentication - * @returns {SpeedScoresSet} Speed scores returned by the server. + * @param {string} nonce - Nonce to use for authentication + * @return {SpeedScoresSet} Speed scores returned by the server. */ async function pollRequest( rootUrl: string, @@ -211,7 +211,7 @@ async function pollRequest( * * @param {number} mobile - Mobile speed score * @param {number} desktop - Desktop speed score - * @returns {string} letter score + * @return {string} letter score */ export function getScoreLetter( mobile: number, desktop: number ): string { const sum = mobile + desktop; @@ -240,7 +240,7 @@ export function getScoreLetter( mobile: number, desktop: number ): string { * The message varies depending on the results of the speed scores so lets modify this * * @param {SpeedScoresSet} scores - Speed scores returned by the server. - * @returns {boolean} true if scores changed. + * @return {boolean} true if scores changed. */ export function didScoresChange( scores: SpeedScoresSet ): boolean { const current = scores.current; @@ -265,7 +265,7 @@ export function didScoresChange( scores: SpeedScoresSet ): boolean { * Determine the change in scores to pass through to other functions. * * @param {SpeedScoresSet} scores - Speed scores returned by the server. - * @returns {number} - The change in scores in percentage. + * @return {number} - The change in scores in percentage. */ export function getScoreMovementPercentage( scores: SpeedScoresSet ): number { const current = scores.current; @@ -286,7 +286,7 @@ export function getScoreMovementPercentage( scores: SpeedScoresSet ): number { * Determine the number of days since the last timestamp. * * @param {number} timestamp - the timestamp returned by the server. - * @returns {number} - The number of days. + * @return {number} - The number of days. */ export function calculateDaysSince( timestamp: number ): number { // Create Date objects for the provided timestamp and the current date diff --git a/projects/js-packages/boost-score-api/src/utils/cast-to-number.ts b/projects/js-packages/boost-score-api/src/utils/cast-to-number.ts index f2875e148b002..c8149f60715ef 100644 --- a/projects/js-packages/boost-score-api/src/utils/cast-to-number.ts +++ b/projects/js-packages/boost-score-api/src/utils/cast-to-number.ts @@ -6,7 +6,7 @@ * @template DefaultType * @param {*} value - External value to process as a number * @param {DefaultType} defaultValue - Default value to return if not a number. - * @returns {number | DefaultType} value as a number, of defaultValue. + * @return {number | DefaultType} value as a number, of defaultValue. */ export function castToNumber< DefaultType = number >( value: unknown, diff --git a/projects/js-packages/boost-score-api/src/utils/cast-to-string.ts b/projects/js-packages/boost-score-api/src/utils/cast-to-string.ts index d9b1dec4afe67..0ecc4c417741d 100644 --- a/projects/js-packages/boost-score-api/src/utils/cast-to-string.ts +++ b/projects/js-packages/boost-score-api/src/utils/cast-to-string.ts @@ -6,7 +6,7 @@ * @template DefaultType * @param {*} value - External value to process as a string * @param {DefaultType} defaultValue - Default value to return if not a string - * @returns {string | DefaultType} value as a string, of defaultValue. + * @return {string | DefaultType} value as a string, of defaultValue. */ export function castToString< DefaultType = undefined >( value: unknown, diff --git a/projects/js-packages/boost-score-api/src/utils/json-types.ts b/projects/js-packages/boost-score-api/src/utils/json-types.ts index 030378a9ec417..78356a0bdc884 100644 --- a/projects/js-packages/boost-score-api/src/utils/json-types.ts +++ b/projects/js-packages/boost-score-api/src/utils/json-types.ts @@ -14,7 +14,7 @@ export type JSONValue = string | number | boolean | JSONObject | JSONArray | nul * Returns true if the given JSONValue is a JSONObject. * * @param {JSONValue} value - Value to check. - * @returns {boolean} True if the given value is a JSONObject. + * @return {boolean} True if the given value is a JSONObject. */ export function isJsonObject( value: JSONValue ): value is JSONObject { return !! value && value instanceof Object && ! ( value instanceof Array ); @@ -25,7 +25,7 @@ export function isJsonObject( value: JSONValue ): value is JSONObject { * Sure, you could use x instanceof Array but this is shorter and more consistent. * * @param {JSONValue} value - Value to check. - * @returns {boolean} True if the given value is a JSONArray. + * @return {boolean} True if the given value is a JSONArray. */ export function isJsonArray( value: JSONValue ): value is JSONArray { return value instanceof Array; diff --git a/projects/js-packages/boost-score-api/src/utils/poll-promise.ts b/projects/js-packages/boost-score-api/src/utils/poll-promise.ts index efe56bfe451e9..8c75352efe45e 100644 --- a/projects/js-packages/boost-score-api/src/utils/poll-promise.ts +++ b/projects/js-packages/boost-score-api/src/utils/poll-promise.ts @@ -22,7 +22,7 @@ type PollPromiseArgs< RetType = void > = { * @param {number} obj.timeout - Milliseconds before rejecting w/ a timeout * @param {Function} obj.callback - Callback to call every ms. * @param {string} obj.timeoutError - Message to throw on timeout. - * @returns {Promise< RetType >} - A promise which resolves to the value resolved() inside callback. + * @return {Promise< RetType >} - A promise which resolves to the value resolved() inside callback. */ export default async function pollPromise< RetType = void >( { interval, diff --git a/projects/js-packages/boost-score-api/src/utils/standardize-error.ts b/projects/js-packages/boost-score-api/src/utils/standardize-error.ts index f075723d0ba20..d1a9aa9ff0215 100644 --- a/projects/js-packages/boost-score-api/src/utils/standardize-error.ts +++ b/projects/js-packages/boost-score-api/src/utils/standardize-error.ts @@ -6,7 +6,7 @@ import type { JSONValue } from './json-types'; * * @param {*} data - Any thrown error data to interpret as an Error (or subclass) * @param {JSONValue|Error} defaultMessage - A default message to throw if no sensible error can be found. - * @returns {Error} the data guaranteed to be an Error or subclass thereof. + * @return {Error} the data guaranteed to be an Error or subclass thereof. */ export function standardizeError( data: JSONValue | Error, defaultMessage?: string ): Error { if ( data instanceof Error ) { diff --git a/projects/js-packages/components/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/components/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/components/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/components/components/action-button/index.jsx b/projects/js-packages/components/components/action-button/index.jsx index f7f37245760ee..42d366eaf2fa0 100644 --- a/projects/js-packages/components/components/action-button/index.jsx +++ b/projects/js-packages/components/components/action-button/index.jsx @@ -20,7 +20,7 @@ import styles from './style.module.scss'; * It is useful to async actions when the user has to wait the result of a request or process. * * @param {object} props - The properties. - * @returns {React.Component} The `ActionButton` component. + * @return {React.Component} The `ActionButton` component. */ const ActionButton = props => { const { diff --git a/projects/js-packages/components/components/admin-page/index.tsx b/projects/js-packages/components/components/admin-page/index.tsx index 480070cd31ace..8ce477b8d9d21 100644 --- a/projects/js-packages/components/components/admin-page/index.tsx +++ b/projects/js-packages/components/components/admin-page/index.tsx @@ -14,7 +14,7 @@ import type React from 'react'; * All content must be passed as children wrapped in as many elements as needed. * * @param {AdminPageProps} props - Component properties. - * @returns {React.ReactNode} AdminPage component. + * @return {React.ReactNode} AdminPage component. */ const AdminPage: React.FC< AdminPageProps > = ( { children, diff --git a/projects/js-packages/components/components/admin-section/basic/index.tsx b/projects/js-packages/components/components/admin-section/basic/index.tsx index 4e721e209858c..73789f8f7dadc 100644 --- a/projects/js-packages/components/components/admin-section/basic/index.tsx +++ b/projects/js-packages/components/components/admin-section/basic/index.tsx @@ -6,7 +6,7 @@ import type { AdminSectionBaseProps } from '../types'; * This is the wrapper component to build sections within your admin page. * * @param {AdminSectionBaseProps} props - Component properties. - * @returns {React.ReactNode} AdminSection component. + * @return {React.ReactNode} AdminSection component. */ const AdminSection: React.FC< AdminSectionBaseProps > = ( { children } ) => { return
{ children }
; diff --git a/projects/js-packages/components/components/admin-section/hero/index.tsx b/projects/js-packages/components/components/admin-section/hero/index.tsx index a794068fd1440..201e4a28bb17f 100644 --- a/projects/js-packages/components/components/admin-section/hero/index.tsx +++ b/projects/js-packages/components/components/admin-section/hero/index.tsx @@ -6,7 +6,7 @@ import type { AdminSectionBaseProps } from '../types'; * The wrapper component for a Hero Section to be used in admin pages. * * @param {AdminSectionBaseProps} props - Component properties. - * @returns {React.Component} AdminSectionHero component. + * @return {React.Component} AdminSectionHero component. */ const AdminSectionHero: React.FC< AdminSectionBaseProps > = ( { children } ) => { return
{ children }
; diff --git a/projects/js-packages/components/components/alert/index.tsx b/projects/js-packages/components/components/alert/index.tsx index 1a98b7c5014e2..527d5937fcbce 100644 --- a/projects/js-packages/components/components/alert/index.tsx +++ b/projects/js-packages/components/components/alert/index.tsx @@ -35,12 +35,12 @@ const getIconByLevel = ( level: AlertProps[ 'level' ] ) => { /** * Alert component * - * @param {object} props - The component properties. - * @param {string} props.level - The alert level: error, warning, info, success. - * @param {boolean} props.showIcon - Whether to show the alert icon. - * @param {string} props.className - The wrapper class name. - * @param {React.Component} props.children - The alert content. - * @returns {React.ReactElement} The `Alert` component. + * @param {object} props - The component properties. + * @param {string} props.level - The alert level: error, warning, info, success. + * @param {boolean} props.showIcon - Whether to show the alert icon. + * @param {string} props.className - The wrapper class name. + * @param {React.Component} props.children - The alert content. + * @return {React.ReactElement} The `Alert` component. */ const Alert: React.FC< AlertProps > = ( { level = 'warning', diff --git a/projects/js-packages/components/components/automattic-byline-logo/index.tsx b/projects/js-packages/components/components/automattic-byline-logo/index.tsx index 797f732ae8265..caff7fa9ef853 100644 --- a/projects/js-packages/components/components/automattic-byline-logo/index.tsx +++ b/projects/js-packages/components/components/automattic-byline-logo/index.tsx @@ -7,7 +7,7 @@ import { AutomatticBylineLogoProps } from './types'; * Automattic "By line" Logo component. * * @param {AutomatticBylineLogoProps} props - Component properties. - * @returns {React.ReactNode} AutomatticBylineLogo component. + * @return {React.ReactNode} AutomatticBylineLogo component. */ const AutomatticBylineLogo: React.FC< AutomatticBylineLogoProps > = ( { title = __( 'An Automattic Airline', 'jetpack' ), diff --git a/projects/js-packages/components/components/automattic-for-agencies-logo/index.tsx b/projects/js-packages/components/components/automattic-for-agencies-logo/index.tsx index 949ef24c7a5f2..549681a341994 100644 --- a/projects/js-packages/components/components/automattic-for-agencies-logo/index.tsx +++ b/projects/js-packages/components/components/automattic-for-agencies-logo/index.tsx @@ -4,9 +4,9 @@ import React from 'react'; /** * Automattic for Agencies Logo component * - * @param {object} props - Component props - * @param {string} props.color - Color code for the logo text - * @returns {React.ReactElement} Component template + * @param {object} props - Component props + * @param {string} props.color - Color code for the logo text + * @return {React.ReactElement} Component template */ export default function AutomatticForAgenciesLogo( { color = '#FFFFFF', diff --git a/projects/js-packages/components/components/automattic-icon-logo/index.tsx b/projects/js-packages/components/components/automattic-icon-logo/index.tsx index 5f1b63ffdcbce..9ea7bf77080fd 100644 --- a/projects/js-packages/components/components/automattic-icon-logo/index.tsx +++ b/projects/js-packages/components/components/automattic-icon-logo/index.tsx @@ -4,10 +4,10 @@ import React from 'react'; /** * Automattic Icon Logo component * - * @param {object} props - Component props - * @param {string} props.innerColor - Color code for the line in the middle of the logo. - * @param {string} props.outerColor - Color code for the logo's outer - * @returns {React.ReactElement} Component template + * @param {object} props - Component props + * @param {string} props.innerColor - Color code for the line in the middle of the logo. + * @param {string} props.outerColor - Color code for the logo's outer + * @return {React.ReactElement} Component template */ export default function AutomatticIconLogo( { innerColor = '#00A3E0', diff --git a/projects/js-packages/components/components/boost-score-graph/day-highlight-plugin.ts b/projects/js-packages/components/components/boost-score-graph/day-highlight-plugin.ts index 3a879cd71b99e..50b0f6317ce58 100644 --- a/projects/js-packages/components/components/boost-score-graph/day-highlight-plugin.ts +++ b/projects/js-packages/components/components/boost-score-graph/day-highlight-plugin.ts @@ -3,7 +3,7 @@ import uPlot from 'uplot'; /** * Definition of the column highlight plugin. * - * @returns {object} The uPlot plugin object with hooks. + * @return {object} The uPlot plugin object with hooks. */ export function dayHighlightPlugin() { let overEl, highlightEl; diff --git a/projects/js-packages/components/components/boost-score-graph/get-date-format.ts b/projects/js-packages/components/components/boost-score-graph/get-date-format.ts index 6970cc544c60d..2af4a2ff823a2 100644 --- a/projects/js-packages/components/components/boost-score-graph/get-date-format.ts +++ b/projects/js-packages/components/components/boost-score-graph/get-date-format.ts @@ -4,10 +4,10 @@ const MONTH_FORMAT = 'short'; /** * Returns a formatted date based on the provided template and locale. * - * @param {string} template - The template used to format the date. - * @param {Date} date - The date object to be formatted. + * @param {string} template - The template used to format the date. + * @param {Date} date - The date object to be formatted. * @param {string} [locale='en'] - The locale code specifying the language and region to be used for formatting. Default 'en'. - * @returns {string} The formatted date as a string. + * @return {string} The formatted date as a string. */ export default function getDateFormat( template: string, date: Date, locale = 'en' ): string { let newDayMonthFormat; diff --git a/projects/js-packages/components/components/boost-score-graph/index.tsx b/projects/js-packages/components/components/boost-score-graph/index.tsx index ecb580e983a88..be5e81cc8b8b6 100644 --- a/projects/js-packages/components/components/boost-score-graph/index.tsx +++ b/projects/js-packages/components/components/boost-score-graph/index.tsx @@ -40,11 +40,11 @@ export type ScoreGraphAlignedData = [ /** * BoostScoreGraph component composed by the chart and the legend. * - * @param {BoostScoreGraphProps} props - The props object for the BoostScoreGraph component. - * @param {string} props.title - Title for the chart. - * @param {Period[]} props.periods - The periods to display in the chart. - * @param {boolean} [props.isLoading=false] - Whether the component is in a loading state. - * @returns {React.ReactElement} The JSX element representing the BoostScoreGraph component, or null if loading. + * @param {BoostScoreGraphProps} props - The props object for the BoostScoreGraph component. + * @param {string} props.title - Title for the chart. + * @param {Period[]} props.periods - The periods to display in the chart. + * @param {boolean} [props.isLoading=false] - Whether the component is in a loading state. + * @return {React.ReactElement} The JSX element representing the BoostScoreGraph component, or null if loading. */ export const BoostScoreGraph: FunctionComponent< BoostScoreGraphProps > = ( { periods = [], diff --git a/projects/js-packages/components/components/boost-score-graph/tooltips-plugin.ts b/projects/js-packages/components/components/boost-score-graph/tooltips-plugin.ts index 5d0dbfe45fa88..c6dfb97d2e7e6 100644 --- a/projects/js-packages/components/components/boost-score-graph/tooltips-plugin.ts +++ b/projects/js-packages/components/components/boost-score-graph/tooltips-plugin.ts @@ -7,7 +7,7 @@ import { Period } from '.'; * Custom tooltips plugin for uPlot. * * @param {Period[]} periods - The periods to display in the tooltip. - * @returns {object} The uPlot plugin object with hooks. + * @return {object} The uPlot plugin object with hooks. */ export function tooltipsPlugin( periods ) { const reactRoot = document.createElement( 'div' ); @@ -17,7 +17,7 @@ export function tooltipsPlugin( periods ) { /** * Initializes the tooltips plugin. * - * @param {uPlot} u - The uPlot instance. + * @param {uPlot} u - The uPlot instance. * @param {object} _opts - Options for the uPlot instance. */ function init( u: uPlot, _opts: object ) { diff --git a/projects/js-packages/components/components/boost-score-graph/uplot-line-chart.tsx b/projects/js-packages/components/components/boost-score-graph/uplot-line-chart.tsx index ce451ade39ad8..86908cb4137b5 100644 --- a/projects/js-packages/components/components/boost-score-graph/uplot-line-chart.tsx +++ b/projects/js-packages/components/components/boost-score-graph/uplot-line-chart.tsx @@ -33,7 +33,7 @@ interface UplotChartProps { * * @param {string} label - The label for the series. * @param {number} score - The last score for the series. - * @returns {object} The series information object. + * @return {object} The series information object. */ function createSerieInfo( label: string, score ) { const { spline } = uPlot.paths; @@ -67,9 +67,9 @@ function createSerieInfo( label: string, score ) { /** * Get the color value based on the score. * - * @param {number} score - The score to get the color for. + * @param {number} score - The score to get the color for. * @param {string} opacity - Whether to return a transparent color. - * @returns {string} The color value. + * @return {string} The color value. */ function getColor( score: number, opacity = 'FF' ) { let color = '#D63638'; // bad @@ -86,11 +86,11 @@ function getColor( score: number, opacity = 'FF' ) { /** * UplotLineChart component. * - * @param {object} props - The props object for the UplotLineChart component. - * @param {{ startDate: number, endDate: number }} props.range - The date range of the chart. - * @param {Period[]} props.periods - The periods to display in the chart. - * @param {Annotation[]} props.annotations - The annotations to display in the chart. - * @returns {React.Element} The JSX element representing the UplotLineChart component. + * @param {object} props - The props object for the UplotLineChart component. + * @param {{ startDate: number, endDate: number }} props.range - The date range of the chart. + * @param {Period[]} props.periods - The periods to display in the chart. + * @param {Annotation[]} props.annotations - The annotations to display in the chart. + * @return {React.Element} The JSX element representing the UplotLineChart component. */ export default function UplotLineChart( { range, periods, annotations = [] }: UplotChartProps ) { const uplot = useRef< uPlot | null >( null ); diff --git a/projects/js-packages/components/components/boost-score-graph/use-boost-score-transform.ts b/projects/js-packages/components/components/boost-score-graph/use-boost-score-transform.ts index 2a04490bcf9d4..e75383aa6d81a 100644 --- a/projects/js-packages/components/components/boost-score-graph/use-boost-score-transform.ts +++ b/projects/js-packages/components/components/boost-score-graph/use-boost-score-transform.ts @@ -18,7 +18,7 @@ const getPeriodDimension = function ( key: string, periods: Period[] ) { * Transforms an array of periods into an array of arrays, where the first array is the timestamps, and the rest are the values for each key * * @param {Period[]} periods - Array of periods to transform - * @returns {ScoreGraphAlignedData | []} - Array of arrays, where the first array is the timestamps, and the rest are the values for each key + * @return {ScoreGraphAlignedData | []} - Array of arrays, where the first array is the timestamps, and the rest are the values for each key */ export function useBoostScoreTransform( periods: Period[] ): ScoreGraphAlignedData | [] { return useMemo( () => { diff --git a/projects/js-packages/components/components/boost-score-graph/use-resize.ts b/projects/js-packages/components/components/boost-score-graph/use-resize.ts index d94e6e019fe50..c491ebfe1a996 100644 --- a/projects/js-packages/components/components/boost-score-graph/use-resize.ts +++ b/projects/js-packages/components/components/boost-score-graph/use-resize.ts @@ -7,7 +7,7 @@ const THROTTLE_DURATION = 400; // in ms /** * Custom hook to handle resizing of uPlot charts. * - * @param {React.RefObject} uplotRef - The ref object for the uPlot instance. + * @param {React.RefObject} uplotRef - The ref object for the uPlot instance. * @param {React.RefObject} containerRef - The ref object for the container div. */ export default function useResize( diff --git a/projects/js-packages/components/components/button/index.tsx b/projects/js-packages/components/components/button/index.tsx index 101c600900512..d7f0e608c5a81 100644 --- a/projects/js-packages/components/components/button/index.tsx +++ b/projects/js-packages/components/components/button/index.tsx @@ -16,7 +16,7 @@ import type { ButtonProps } from './types'; * Button component * * @param {ButtonProps} props - Component Props - * @returns {React.ReactNode} Rendered button + * @return {React.ReactNode} Rendered button */ const Button = forwardRef< HTMLInputElement, ButtonProps >( ( props, ref ) => { const { diff --git a/projects/js-packages/components/components/chip/index.tsx b/projects/js-packages/components/components/chip/index.tsx index d122347e44a7f..6684927495182 100644 --- a/projects/js-packages/components/components/chip/index.tsx +++ b/projects/js-packages/components/components/chip/index.tsx @@ -10,10 +10,10 @@ type ChipProps = { /** * Chip component * - * @param {object} props - The component properties. - * @param {string} props.type - The type new or info - * @param {string} props.text - Chip text - * @returns {React.ReactElement} The `Chip` component. + * @param {object} props - The component properties. + * @param {string} props.type - The type new or info + * @param {string} props.text - Chip text + * @return {React.ReactElement} The `Chip` component. */ const Chip: React.FC< ChipProps > = ( { type = 'info', text } ) => { const classes = clsx( styles.chip, styles[ `is-${ type }` ] ); diff --git a/projects/js-packages/components/components/decorative-card/index.tsx b/projects/js-packages/components/components/decorative-card/index.tsx index b1ddf205d8c05..921364592b7d8 100644 --- a/projects/js-packages/components/components/decorative-card/index.tsx +++ b/projects/js-packages/components/components/decorative-card/index.tsx @@ -6,7 +6,7 @@ import './style.scss'; * A decorative card used in the disconnection flow. * * @param {DecorativeCardProps} props - The properties. - * @returns {React.ReactNode} - The DecorativeCard component. + * @return {React.ReactNode} - The DecorativeCard component. */ const DecorativeCard: React.FC< DecorativeCardProps > = ( { diff --git a/projects/js-packages/components/components/dialog/index.tsx b/projects/js-packages/components/components/dialog/index.tsx index 847f3677c9bb5..521266875ea3e 100644 --- a/projects/js-packages/components/components/dialog/index.tsx +++ b/projects/js-packages/components/components/dialog/index.tsx @@ -16,12 +16,12 @@ type DialogProps = { /** * Dialog component. * - * @param {object} props - React component props. - * @param {React.ReactNode} props.primary - Primary-section content. - * @param {React.ReactNode} props.secondary - Secondary-section content. - * @param {boolean} props.isTwoSections - Handle two sections layout when true. - * @param {object} props.containerProps - Props to pass to the container component. - * @returns {React.ReactNode} Rendered dialog + * @param {object} props - React component props. + * @param {React.ReactNode} props.primary - Primary-section content. + * @param {React.ReactNode} props.secondary - Secondary-section content. + * @param {boolean} props.isTwoSections - Handle two sections layout when true. + * @param {object} props.containerProps - Props to pass to the container component. + * @return {React.ReactNode} Rendered dialog */ const Dialog: React.FC< DialogProps > = ( { primary, diff --git a/projects/js-packages/components/components/donut-meter/index.tsx b/projects/js-packages/components/components/donut-meter/index.tsx index 4eaf0a309037b..7911bce0d58a8 100644 --- a/projects/js-packages/components/components/donut-meter/index.tsx +++ b/projects/js-packages/components/components/donut-meter/index.tsx @@ -72,7 +72,7 @@ const getAdaptiveType = ( percentage: number ) => { * Generate record meter donut bar * * @param {DonutMeterProps} props - Props - * @returns {React.ReactElement} - JSX element + * @return {React.ReactElement} - JSX element */ const DonutMeter: React.FC< DonutMeterProps > = ( { className = '', diff --git a/projects/js-packages/components/components/global-notices/global-notices.tsx b/projects/js-packages/components/components/global-notices/global-notices.tsx index b3c694858e3df..0125aeb4ac7e8 100644 --- a/projects/js-packages/components/components/global-notices/global-notices.tsx +++ b/projects/js-packages/components/components/global-notices/global-notices.tsx @@ -11,7 +11,7 @@ export type GlobalNoticesProps = { * * @param {GlobalNoticesProps} props - Component props. * - * @returns {import('react').ReactNode} The rendered notices list. + * @return {import('react').ReactNode} The rendered notices list. */ export function GlobalNotices( { maxVisibleNotices = 3 }: GlobalNoticesProps ) { const { getNotices, removeNotice } = useGlobalNotices(); diff --git a/projects/js-packages/components/components/global-notices/use-global-notices.ts b/projects/js-packages/components/components/global-notices/use-global-notices.ts index 333ef0a5fcce6..4f924117bec0d 100644 --- a/projects/js-packages/components/components/global-notices/use-global-notices.ts +++ b/projects/js-packages/components/components/global-notices/use-global-notices.ts @@ -9,7 +9,7 @@ export type TGlobalNotices = ReturnType< NoticesStore[ 'getActions' ] > & /** * The global notices hook. * - * @returns {TGlobalNotices} The global notices selectors and actions. + * @return {TGlobalNotices} The global notices selectors and actions. */ export function useGlobalNotices(): TGlobalNotices { const actionCreators = useDispatch( noticesStore ); diff --git a/projects/js-packages/components/components/icon-tooltip/index.tsx b/projects/js-packages/components/components/icon-tooltip/index.tsx index 584da8b429490..c64b6e74309dd 100644 --- a/projects/js-packages/components/components/icon-tooltip/index.tsx +++ b/projects/js-packages/components/components/icon-tooltip/index.tsx @@ -24,7 +24,7 @@ const placementsToPositions = ( placement: Placement ): Position => { * Generate Icon Tooltip * * @param {IconTooltipProps} props - Props - * @returns {React.ReactElement} - JSX element + * @return {React.ReactElement} - JSX element */ const IconTooltip: React.FC< IconTooltipProps > = ( { className = '', diff --git a/projects/js-packages/components/components/icons/index.tsx b/projects/js-packages/components/components/icons/index.tsx index 1e77dd87e8808..a390b8a3a3f6f 100644 --- a/projects/js-packages/components/components/icons/index.tsx +++ b/projects/js-packages/components/components/icons/index.tsx @@ -9,7 +9,7 @@ import type React from 'react'; * Icon Wrapper component. * * @param {BaseIconProps} props - Component props. - * @returns {React.ReactNode} Icon Wrapper component. + * @return {React.ReactNode} Icon Wrapper component. */ const IconWrapper: React.FC< BaseIconProps > = ( { className, @@ -264,8 +264,8 @@ export type IconSlug = keyof IconsMap; /** * Return icon component by slug. * - * @param {string} slug - Icon slug. - * @returns {React.ComponentType} Icon component. + * @param {string} slug - Icon slug. + * @return {React.ComponentType} Icon component. */ export function getIconBySlug< Slug extends IconSlug >( slug: Slug ): IconsMap[ Slug ] { if ( ! iconsMap[ slug ] ) { diff --git a/projects/js-packages/components/components/icons/stories/index.stories.tsx b/projects/js-packages/components/components/icons/stories/index.stories.tsx index 4a7f3047bd5cb..c772ad86def3d 100644 --- a/projects/js-packages/components/components/icons/stories/index.stories.tsx +++ b/projects/js-packages/components/components/icons/stories/index.stories.tsx @@ -26,7 +26,7 @@ const sizes = [ /** * Icons story components. * - * @returns {object} - story component + * @return {object} - story component */ function IconsStory() { return ( diff --git a/projects/js-packages/components/components/indeterminate-progress-bar/index.tsx b/projects/js-packages/components/components/indeterminate-progress-bar/index.tsx index ea3a182cee505..2ac01bbba8f3b 100644 --- a/projects/js-packages/components/components/indeterminate-progress-bar/index.tsx +++ b/projects/js-packages/components/components/indeterminate-progress-bar/index.tsx @@ -14,7 +14,7 @@ import type React from 'react'; * Indeterminate Progress Bar component * * @param {IndeterminateProgressBarProps} props - Component props. - * @returns {React.ReactNode} - IndeterminateProgressBar react component. + * @return {React.ReactNode} - IndeterminateProgressBar react component. */ const IndeterminateProgressBar: React.FC< IndeterminateProgressBarProps > = ( { className } ) => { return ( diff --git a/projects/js-packages/components/components/jetpack-footer/index.tsx b/projects/js-packages/components/components/jetpack-footer/index.tsx index 3a4c2572fefc9..41b41ad0ae251 100644 --- a/projects/js-packages/components/components/jetpack-footer/index.tsx +++ b/projects/js-packages/components/components/jetpack-footer/index.tsx @@ -32,7 +32,7 @@ const ExternalIcon: React.FC = () => ( * JetpackFooter component displays a tiny Jetpack logo with the product name on the left and the Automattic Airline "by line" on the right. * * @param {JetpackFooterProps} props - Component properties. - * @returns {React.ReactNode} JetpackFooter component. + * @return {React.ReactNode} JetpackFooter component. */ const JetpackFooter: React.FC< JetpackFooterProps > = ( { moduleName = __( 'Jetpack', 'jetpack' ), diff --git a/projects/js-packages/components/components/layout/col/index.tsx b/projects/js-packages/components/components/layout/col/index.tsx index ecaf0e725e3e6..3dce2c691678c 100644 --- a/projects/js-packages/components/components/layout/col/index.tsx +++ b/projects/js-packages/components/components/layout/col/index.tsx @@ -11,8 +11,8 @@ const lgCols = Number( styles.lgCols ); /** * The basic Col component. * - * @param {ColProps} props - Component properties. - * @returns {React.ReactElement} Col component. + * @param {ColProps} props - Component properties. + * @return {React.ReactElement} Col component. */ const Col: React.FC< ColProps > = props => { const { children, tagName = 'div', className } = props; diff --git a/projects/js-packages/components/components/layout/container/index.tsx b/projects/js-packages/components/components/layout/container/index.tsx index 00c22cef79005..630df333a9656 100644 --- a/projects/js-packages/components/components/layout/container/index.tsx +++ b/projects/js-packages/components/components/layout/container/index.tsx @@ -8,7 +8,7 @@ import type React from 'react'; * JP Container * * @param {ContainerProps} props - Component properties. - * @returns {React.ReactElement} Container component. + * @return {React.ReactElement} Container component. */ const Container: React.FC< ContainerProps > = ( { children, diff --git a/projects/js-packages/components/components/layout/use-breakpoint-match/index.ts b/projects/js-packages/components/components/layout/use-breakpoint-match/index.ts index 48a33160066b3..a2733eb075034 100644 --- a/projects/js-packages/components/components/layout/use-breakpoint-match/index.ts +++ b/projects/js-packages/components/components/layout/use-breakpoint-match/index.ts @@ -39,9 +39,9 @@ const getMediaByOperator = ( /** * Hook to match if current viewport is equal, greater or less than expected breakpoint * - * @param {(Breakpoints | Array< Breakpoints >)} breakpointToMatch - An single breakpoint or list of breakpoints to match. - * @param {(Operators | Array< Operators >)} operatorToMatch - An single operator or list of them. It should follow the same sequence than breakpoints. - * @returns {Array} - List of matches, following breakpoints sequence. + * @param {(Breakpoints | Array< Breakpoints >)} breakpointToMatch - An single breakpoint or list of breakpoints to match. + * @param {(Operators | Array< Operators >)} operatorToMatch - An single operator or list of them. It should follow the same sequence than breakpoints. + * @return {Array} - List of matches, following breakpoints sequence. * @example * * ```es6 diff --git a/projects/js-packages/components/components/notice/index.tsx b/projects/js-packages/components/components/notice/index.tsx index b0406544b7022..5e0786d541c77 100644 --- a/projects/js-packages/components/components/notice/index.tsx +++ b/projects/js-packages/components/components/notice/index.tsx @@ -41,14 +41,14 @@ const getIconByLevel = ( level: NoticeProps[ 'level' ] ) => { /** * Notice component * - * @param {object} props - The component properties. - * @param {string} props.level - The notice level: error, warning, info, success. - * @param {boolean} props.hideCloseButton - Whether to hide the close button. - * @param {Function} props.onClose - The function to call when the close button is clicked. - * @param {string} props.title - The title of the notice. - * @param {React.ReactNode[]} props.actions - Actions to show across the bottom of the bar. - * @param {React.Component} props.children - The notice content. - * @returns {React.ReactElement} The `Notice` component. + * @param {object} props - The component properties. + * @param {string} props.level - The notice level: error, warning, info, success. + * @param {boolean} props.hideCloseButton - Whether to hide the close button. + * @param {Function} props.onClose - The function to call when the close button is clicked. + * @param {string} props.title - The title of the notice. + * @param {React.ReactNode[]} props.actions - Actions to show across the bottom of the bar. + * @param {React.Component} props.children - The notice content. + * @return {React.ReactElement} The `Notice` component. */ const Notice: React.FC< NoticeProps > = ( { level = 'info', diff --git a/projects/js-packages/components/components/number-format/index.ts b/projects/js-packages/components/components/number-format/index.ts index 076fb6a30ae48..aee89d2f666b3 100644 --- a/projects/js-packages/components/components/number-format/index.ts +++ b/projects/js-packages/components/components/number-format/index.ts @@ -3,9 +3,9 @@ import { getUserLocale } from '../../lib/locale'; /** * Format a number using the locale in use by the user viewing the page. * - * @param {number} number - The number to format. + * @param {number} number - The number to format. * @param {Intl.NumberFormatOptions} options - The format options - * @returns {string} Formatted number. + * @return {string} Formatted number. */ const numberFormat = ( number: number, options: Intl.NumberFormatOptions = {} ): string => { const locale = getUserLocale(); diff --git a/projects/js-packages/components/components/number-slider/index.tsx b/projects/js-packages/components/components/number-slider/index.tsx index d391851b454f7..47e854b8bfcdd 100644 --- a/projects/js-packages/components/components/number-slider/index.tsx +++ b/projects/js-packages/components/components/number-slider/index.tsx @@ -9,7 +9,7 @@ import './style.scss'; * More support from the original ReactSlider component: https://zillow.github.io/react-slider/ * * @param {NumberSliderProps} props - Props - * @returns {React.ReactElement} - JSX element + * @return {React.ReactElement} - JSX element */ const NumberSlider: React.FC< NumberSliderProps > = ( { className, diff --git a/projects/js-packages/components/components/pricing-card/index.tsx b/projects/js-packages/components/components/pricing-card/index.tsx index 781e4d8370857..b7a64766a50ec 100644 --- a/projects/js-packages/components/components/pricing-card/index.tsx +++ b/projects/js-packages/components/components/pricing-card/index.tsx @@ -15,7 +15,7 @@ import './style.scss'; * doesn't exist. * * @param {CurrencyObject} currencyObject -- A currency object returned from `getCurrencyObject`. - * @returns {boolean} Whether or not to display the price decimal part. + * @return {boolean} Whether or not to display the price decimal part. */ const showPriceDecimals = ( currencyObject: CurrencyObject ): boolean => { return currencyObject.fraction.indexOf( '00' ) === -1; @@ -25,7 +25,7 @@ const showPriceDecimals = ( currencyObject: CurrencyObject ): boolean => { * The Pricing card component. * * @param {PricingCardProps} props -- The component props. - * @returns {React.ReactNode} The rendered component. + * @return {React.ReactNode} The rendered component. */ const PricingCard: React.FC< PricingCardProps > = ( { currencyCode = 'USD', diff --git a/projects/js-packages/components/components/product-offer/icons-card.tsx b/projects/js-packages/components/components/product-offer/icons-card.tsx index b997b03e2e002..a2e26a824f6ad 100644 --- a/projects/js-packages/components/components/product-offer/icons-card.tsx +++ b/projects/js-packages/components/components/product-offer/icons-card.tsx @@ -8,8 +8,8 @@ import { IconsCardProps } from './types'; * Icons composition for a bundle product, * based on the list of supported products. * - * @param {IconsCardProps} props - Component props. - * @returns {React.ReactNode} Bundle product icons react component. + * @param {IconsCardProps} props - Component props. + * @return {React.ReactNode} Bundle product icons react component. */ export const IconsCard: React.FC< IconsCardProps > = ( { products, icon, size = 24 } ) => { if ( icon ) { diff --git a/projects/js-packages/components/components/product-offer/index.tsx b/projects/js-packages/components/components/product-offer/index.tsx index 8875381796d27..86744cd0ea22d 100644 --- a/projects/js-packages/components/components/product-offer/index.tsx +++ b/projects/js-packages/components/components/product-offer/index.tsx @@ -16,7 +16,7 @@ import type React from 'react'; * Product Detail component. * * @param {ProductOfferProps} props - Component props. - * @returns {React.ReactNode} - ProductOffer react component. + * @return {React.ReactNode} - ProductOffer react component. */ const ProductOffer: React.FC< ProductOfferProps > = ( { addProductUrl, diff --git a/projects/js-packages/components/components/product-offer/product-offer-header.tsx b/projects/js-packages/components/components/product-offer/product-offer-header.tsx index fd8873b2bb454..141e315578de2 100644 --- a/projects/js-packages/components/components/product-offer/product-offer-header.tsx +++ b/projects/js-packages/components/components/product-offer/product-offer-header.tsx @@ -9,7 +9,7 @@ import type React from 'react'; * Product Detail Card Header component. * * @param {ProductOfferHeaderProps} props - Component props. - * @returns {React.ReactNode} ProductOfferHeader react component. + * @return {React.ReactNode} ProductOfferHeader react component. */ export const ProductOfferHeader: React.FC< ProductOfferHeaderProps > = ( { title = __( 'Popular upgrade', 'jetpack' ), diff --git a/projects/js-packages/components/components/product-price/index.tsx b/projects/js-packages/components/components/product-price/index.tsx index 211cc06709a1b..edfbf6a6fa0ff 100644 --- a/projects/js-packages/components/components/product-price/index.tsx +++ b/projects/js-packages/components/components/product-price/index.tsx @@ -16,7 +16,7 @@ import type React from 'react'; * React component to render the price. * * @param {ProductPriceProps} props - Component props. - * @returns {React.ReactNode} Price react component. + * @return {React.ReactNode} Price react component. */ const ProductPrice: React.FC< ProductPriceProps > = ( { price, diff --git a/projects/js-packages/components/components/product-price/price.tsx b/projects/js-packages/components/components/product-price/price.tsx index fcfae78050707..1e70ac8666417 100644 --- a/projects/js-packages/components/components/product-price/price.tsx +++ b/projects/js-packages/components/components/product-price/price.tsx @@ -8,8 +8,8 @@ import type React from 'react'; /** * React component to render a Price composition. * - * @param {PriceProps} props - Component props. - * @returns {React.ReactNode} -Price react component. + * @param {PriceProps} props - Component props. + * @return {React.ReactNode} -Price react component. */ export const Price: React.FC< PriceProps > = ( { value, currency, isOff, hidePriceFraction } ) => { const classNames = clsx( styles.price, 'product-price_price', { diff --git a/projects/js-packages/components/components/progress-bar/index.tsx b/projects/js-packages/components/components/progress-bar/index.tsx index fa530c4103128..879d1c6175de8 100644 --- a/projects/js-packages/components/components/progress-bar/index.tsx +++ b/projects/js-packages/components/components/progress-bar/index.tsx @@ -13,7 +13,7 @@ import type React from 'react'; * Progress Bar component * * @param {ProgressBarProps} props - Component props. - * @returns {React.ReactNode} - ProgressBar react component. + * @return {React.ReactNode} - ProgressBar react component. */ const ProgressBar: React.FC< ProgressBarProps > = ( { className, diff --git a/projects/js-packages/components/components/qr-code/index.tsx b/projects/js-packages/components/components/qr-code/index.tsx index 24f27a78466c2..08ac1263a01eb 100644 --- a/projects/js-packages/components/components/qr-code/index.tsx +++ b/projects/js-packages/components/components/qr-code/index.tsx @@ -49,7 +49,7 @@ export type QRCodeProps = { * Renders a QR Code. * * @param {QRCodeProps} props - Component props - * @returns {React.ReactNode} - React component. + * @return {React.ReactNode} - React component. */ const QRCode: React.FC< QRCodeProps > = ( { value = 'https://jetpack.com', diff --git a/projects/js-packages/components/components/record-meter-bar/index.tsx b/projects/js-packages/components/components/record-meter-bar/index.tsx index 1eb1d8b5771f0..8bf072645a6af 100644 --- a/projects/js-packages/components/components/record-meter-bar/index.tsx +++ b/projects/js-packages/components/components/record-meter-bar/index.tsx @@ -63,7 +63,7 @@ export type RecordMeterBarProps = { * Generate Record Meter bar * * @param {RecordMeterBarProps} props - Props - * @returns {React.ReactElement} - JSX element + * @return {React.ReactElement} - JSX element */ const RecordMeterBar: React.FC< RecordMeterBarProps > = ( { totalCount, diff --git a/projects/js-packages/components/components/stat-card/index.tsx b/projects/js-packages/components/components/stat-card/index.tsx index 93db43246d695..b6854dc02f37e 100644 --- a/projects/js-packages/components/components/stat-card/index.tsx +++ b/projects/js-packages/components/components/stat-card/index.tsx @@ -16,7 +16,7 @@ import type React from 'react'; * StatCard component * * @param {StatCardProps} props - Component props. - * @returns {React.ReactNode} - StatCard react component. + * @return {React.ReactNode} - StatCard react component. */ const StatCard = ( { className, icon, label, value, variant = 'square' }: StatCardProps ) => { const formattedValue = numberFormat( value ); diff --git a/projects/js-packages/components/components/text/index.tsx b/projects/js-packages/components/components/text/index.tsx index 0ff935397873b..139bc422f5a9f 100644 --- a/projects/js-packages/components/components/text/index.tsx +++ b/projects/js-packages/components/components/text/index.tsx @@ -8,7 +8,7 @@ import type { H3Props, TextProps, TitleProps } from './types'; * Text component. * * @param {TextProps} props - Component props. - * @returns {React.ReactElement} - JSX.Element + * @return {React.ReactElement} - JSX.Element */ const Text = forwardRef< HTMLElement, TextProps >( ( { variant = 'body', children, component, className, ...componentProps }, ref ) => { @@ -45,8 +45,8 @@ export default Text; /** * Heading component - Medium size. * - * @param {TextProps} props - Component props. - * @returns {React.ReactElement} - JSX.Element + * @param {TextProps} props - Component props. + * @return {React.ReactElement} - JSX.Element */ export const H2: React.FC< TextProps > = ( { children, ...componentProps } ) => ( @@ -57,8 +57,8 @@ export const H2: React.FC< TextProps > = ( { children, ...componentProps } ) => /** * Heading component - Small size, * - * @param {H3Props} props - Component props. - * @returns {React.ReactElement} - JSX.Element + * @param {H3Props} props - Component props. + * @return {React.ReactElement} - JSX.Element */ export const H3: React.FC< H3Props > = ( { children, weight = 'bold', ...componentProps } ) => { const variant = `headline-small${ @@ -75,8 +75,8 @@ export const H3: React.FC< H3Props > = ( { children, weight = 'bold', ...compone /** * Title component, based on Text component. * - * @param {TitleProps} props - Component props. - * @returns {React.ReactElement} - JSX.Element + * @param {TitleProps} props - Component props. + * @return {React.ReactElement} - JSX.Element */ export const Title: React.FC< TitleProps > = ( { children, diff --git a/projects/js-packages/components/components/text/stories/headings.index.stories.tsx b/projects/js-packages/components/components/text/stories/headings.index.stories.tsx index ad1998f24958e..362c6a6afdeaf 100644 --- a/projects/js-packages/components/components/text/stories/headings.index.stories.tsx +++ b/projects/js-packages/components/components/text/stories/headings.index.stories.tsx @@ -22,9 +22,9 @@ export default { /** * Helper component to create a the story. * - * @param {object} props - Component props. + * @param {object} props - Component props. * @param {React.Component} props.children - Icon component children. - * @returns {React.Component} Text component instance. + * @return {React.Component} Text component instance. */ function Instance( { children } ) { return ( diff --git a/projects/js-packages/components/components/theme-provider/index.tsx b/projects/js-packages/components/components/theme-provider/index.tsx index 8da3e546b4603..109c74b597423 100644 --- a/projects/js-packages/components/components/theme-provider/index.tsx +++ b/projects/js-packages/components/components/theme-provider/index.tsx @@ -111,8 +111,8 @@ const setup = ( root: HTMLElement, id: string, withGlobalStyles?: boolean ) => { /** * ThemeProvider React component. * - * @param {ThemeProviderProps} props - Component properties. - * @returns {React.ReactNode} ThemeProvider component. + * @param {ThemeProviderProps} props - Component properties. + * @return {React.ReactNode} ThemeProvider component. */ const ThemeProvider: React.FC< ThemeProviderProps > = ( { children = null, diff --git a/projects/js-packages/components/components/theme-provider/stories/index.stories.tsx b/projects/js-packages/components/components/theme-provider/stories/index.stories.tsx index 42c37f49bb076..b5e3eec6a4c93 100644 --- a/projects/js-packages/components/components/theme-provider/stories/index.stories.tsx +++ b/projects/js-packages/components/components/theme-provider/stories/index.stories.tsx @@ -11,8 +11,8 @@ import type { StoryFn, Meta } from '@storybook/react'; * (c) 2019 Chris Ferdinandi, MIT License, https://gomakethings.com * Derived from work by Brian Suda, https://24ways.org/2010/calculating-color-contrast/ * - * @param {string} hexcolor - hexcolor value - * @returns {string} The contrasting color (black or white) + * @param {string} hexcolor - hexcolor value + * @return {string} The contrasting color (black or white) */ function getContrast( hexcolor ) { // If a leading # is provided, remove it diff --git a/projects/js-packages/components/components/upsell-banner/index.tsx b/projects/js-packages/components/components/upsell-banner/index.tsx index d81f095a27a64..ed57683e62d51 100644 --- a/projects/js-packages/components/components/upsell-banner/index.tsx +++ b/projects/js-packages/components/components/upsell-banner/index.tsx @@ -13,7 +13,7 @@ import './style.scss'; * - The secondary CTA is the first button, at the left position. * * @param {UpsellBannerProps} props - Component props. - * @returns {React.ReactNode} - UpsellBanner component. + * @return {React.ReactNode} - UpsellBanner component. */ const UpsellBanner: React.FC< UpsellBannerProps > = props => { const { diff --git a/projects/js-packages/components/lib/locale/index.ts b/projects/js-packages/components/lib/locale/index.ts index 5aa4252885817..7afd53da19bd8 100644 --- a/projects/js-packages/components/lib/locale/index.ts +++ b/projects/js-packages/components/lib/locale/index.ts @@ -4,7 +4,7 @@ import { getSettings } from '@wordpress/date'; * Clean up WP locale so it matches the format expected by browsers. * * @param {string} locale - Locale given by WordPress. - * @returns {string} Browser-formatted locale. + * @return {string} Browser-formatted locale. */ export const cleanLocale = ( locale: string ) => { const regex = /^([a-z]{2,3})(_[a-z]{2}|_[a-z][a-z0-9]{4,7})?(?:_.*)?$/i; @@ -30,7 +30,7 @@ declare const global: typeof globalThis; /** * Current user locale, or browser locale as fallback. * - * @returns {string} Formatted user locale (e.g. `en-US` or `fr-FR`). + * @return {string} Formatted user locale (e.g. `en-US` or `fr-FR`). */ export const getUserLocale = () => { const { diff --git a/projects/js-packages/components/tools/get-product-checkout-url/index.ts b/projects/js-packages/components/tools/get-product-checkout-url/index.ts index bb124fcd4c6ae..b6ae1e6f0c645 100644 --- a/projects/js-packages/components/tools/get-product-checkout-url/index.ts +++ b/projects/js-packages/components/tools/get-product-checkout-url/index.ts @@ -1,11 +1,11 @@ /** * Return the checkout URL for the given product. * - * @param {string} productSlug - wpcom product slug. - * @param {string} siteSuffix - Site suffix - * @param {string} redirectUrl - Redirect URL used to define redirect_to + * @param {string} productSlug - wpcom product slug. + * @param {string} siteSuffix - Site suffix + * @param {string} redirectUrl - Redirect URL used to define redirect_to * @param {boolean} isUserConnected - True when the user is connected Jetpack - * @returns {string} The Calypso checkout URL + * @return {string} The Calypso checkout URL */ export default function getProductCheckoutUrl( productSlug: string, diff --git a/projects/js-packages/components/tools/get-site-admin-url/index.ts b/projects/js-packages/components/tools/get-site-admin-url/index.ts index 9a7079805ecfe..5c64a95d84f51 100644 --- a/projects/js-packages/components/tools/get-site-admin-url/index.ts +++ b/projects/js-packages/components/tools/get-site-admin-url/index.ts @@ -1,7 +1,7 @@ /** * Returns the site admin URL. * - * @returns {?string} The site admin URL or null if not available. + * @return {?string} The site admin URL or null if not available. */ export default function getSiteAdminUrl() { return ( diff --git a/projects/js-packages/components/tools/jp-redirect/index.ts b/projects/js-packages/components/tools/jp-redirect/index.ts index 3f13f524d776b..c2033c2e63343 100644 --- a/projects/js-packages/components/tools/jp-redirect/index.ts +++ b/projects/js-packages/components/tools/jp-redirect/index.ts @@ -12,13 +12,13 @@ import { GetRedirectUrlArgs, QueryVars } from './types'; * Note: if using full URL, query parameters and anchor must be passed in args. Any querystring of url fragment in the URL will be discarded. * * @since 0.2.0 - * @param {string} source - The URL handler registered in the server or the full destination URL (starting with https://). - * @param {GetRedirectUrlArgs} args - Additional arguments to build the url. - * This is not a complete list as any argument passed here - * will be sent to as a query parameter to the Redirect server. - * These parameters will not necessarily be passed over to the final destination URL. - * If you want to add a parameter to the final destination URL, use the `query` argument. - * @returns {string} The redirect URL + * @param {string} source - The URL handler registered in the server or the full destination URL (starting with https://). + * @param {GetRedirectUrlArgs} args - Additional arguments to build the url. + * This is not a complete list as any argument passed here + * will be sent to as a query parameter to the Redirect server. + * These parameters will not necessarily be passed over to the final destination URL. + * If you want to add a parameter to the final destination URL, use the `query` argument. + * @return {string} The redirect URL */ export default function getRedirectUrl( source: string, args: GetRedirectUrlArgs = {} ) { const queryVars: QueryVars = {}; diff --git a/projects/js-packages/components/tools/pricing-utils/index.ts b/projects/js-packages/components/tools/pricing-utils/index.ts index e5424468d872e..7802a679686d1 100644 --- a/projects/js-packages/components/tools/pricing-utils/index.ts +++ b/projects/js-packages/components/tools/pricing-utils/index.ts @@ -4,7 +4,7 @@ import { IntroOffer } from './types'; * Returns whether an Introductory Offer is a first month trial * * @param {IntroOffer} introOffer - an intro offer object - * @returns {boolean} Whether it's a first month trial or not + * @return {boolean} Whether it's a first month trial or not */ export function isFirstMonthTrial( introOffer: IntroOffer ): boolean { return introOffer?.interval_count === 1 && introOffer?.interval_unit === 'month'; diff --git a/projects/js-packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/connection/components/connect-button/index.jsx b/projects/js-packages/connection/components/connect-button/index.jsx index d9744f72abdec..0529e4ae1e189 100644 --- a/projects/js-packages/connection/components/connect-button/index.jsx +++ b/projects/js-packages/connection/components/connect-button/index.jsx @@ -8,7 +8,7 @@ import useConnection from '../use-connection'; * The RNA connection component. * * @param {object} props -- The properties. - * @returns {React.Component} The RNA connection component. + * @return {React.Component} The RNA connection component. */ const ConnectButton = props => { const { diff --git a/projects/js-packages/connection/components/connect-screen/required-plan/index.jsx b/projects/js-packages/connection/components/connect-screen/required-plan/index.jsx index d25f8c46c45d3..f6a20a8cb7baa 100644 --- a/projects/js-packages/connection/components/connect-screen/required-plan/index.jsx +++ b/projects/js-packages/connection/components/connect-screen/required-plan/index.jsx @@ -9,7 +9,7 @@ import ConnectScreenRequiredPlanVisual from './visual'; * The Connection Screen Visual component for consumers that require a Plan. * * @param {object} props -- The properties. - * @returns {React.Component} The `ConnectScreenForRequiredPlan` component. + * @return {React.Component} The `ConnectScreenForRequiredPlan` component. */ const ConnectScreenRequiredPlan = props => { const { diff --git a/projects/js-packages/connection/components/connect-screen/required-plan/visual.jsx b/projects/js-packages/connection/components/connect-screen/required-plan/visual.jsx index 571014204f6c6..5d300d879612d 100644 --- a/projects/js-packages/connection/components/connect-screen/required-plan/visual.jsx +++ b/projects/js-packages/connection/components/connect-screen/required-plan/visual.jsx @@ -19,7 +19,7 @@ const debug = debugFactory( 'jetpack:connection:ConnectScreenRequiredPlanVisual' * The Connection Screen Visual component for consumers that require a Plan. * * @param {object} props -- The properties. - * @returns {React.Component} The `ConnectScreenRequiredPlanVisual` component. + * @return {React.Component} The `ConnectScreenRequiredPlanVisual` component. */ const ConnectScreenRequiredPlanVisual = props => { const { diff --git a/projects/js-packages/connection/components/connect-user/index.jsx b/projects/js-packages/connection/components/connect-user/index.jsx index 72062b0ac465a..f1c84d3d5558a 100644 --- a/projects/js-packages/connection/components/connect-user/index.jsx +++ b/projects/js-packages/connection/components/connect-user/index.jsx @@ -5,12 +5,12 @@ import { useState, useEffect } from 'react'; /** * The user connection component. * - * @param {object} props -- The properties. + * @param {object} props -- The properties. * @param {Function} props.redirectFunc -- The redirect function (`window.location.assign()` by default). - * @param {string} props.connectUrl -- The authorization URL (no-iframe). - * @param {string} props.redirectUri -- The redirect admin URI. - * @param {string} props.from -- Where the connection request is coming from. - * @returns {null} -- Nothing to return. + * @param {string} props.connectUrl -- The authorization URL (no-iframe). + * @param {string} props.redirectUri -- The redirect admin URI. + * @param {string} props.from -- Where the connection request is coming from. + * @return {null} -- Nothing to return. */ const ConnectUser = props => { const { diff --git a/projects/js-packages/connection/components/connected-plugins/index.jsx b/projects/js-packages/connection/components/connected-plugins/index.jsx index 043f1910387ca..cee45bf838644 100644 --- a/projects/js-packages/connection/components/connected-plugins/index.jsx +++ b/projects/js-packages/connection/components/connected-plugins/index.jsx @@ -7,7 +7,7 @@ import DisconnectCard from '../disconnect-card'; * Render a list of connected plugins. * * @param {object} props - The properties - * @returns {React.Component} - The ConnectedPlugins React component + * @return {React.Component} - The ConnectedPlugins React component */ const ConnectedPlugins = props => { diff --git a/projects/js-packages/connection/components/connection-error-notice/index.jsx b/projects/js-packages/connection/components/connection-error-notice/index.jsx index 5e3acc883d1d8..5ad05369eb6cf 100644 --- a/projects/js-packages/connection/components/connection-error-notice/index.jsx +++ b/projects/js-packages/connection/components/connection-error-notice/index.jsx @@ -9,7 +9,7 @@ import styles from './styles.module.scss'; * The RNA Connection Error Notice component. * * @param {object} props -- The properties. - * @returns {React.Component} The `ConnectionErrorNotice` component. + * @return {React.Component} The `ConnectionErrorNotice` component. */ const ConnectionErrorNotice = props => { const { message, isRestoringConnection, restoreConnectionCallback, restoreConnectionError } = diff --git a/projects/js-packages/connection/components/disconnect-card/index.jsx b/projects/js-packages/connection/components/disconnect-card/index.jsx index 8ceedd6f1dcf8..580462b3f937e 100644 --- a/projects/js-packages/connection/components/disconnect-card/index.jsx +++ b/projects/js-packages/connection/components/disconnect-card/index.jsx @@ -8,7 +8,7 @@ import './style.scss'; * Used in the disconnection flow. * * @param {object} props - The Properties. - * @returns {React.Component} DisconnectCard - The disconnect card component. + * @return {React.Component} DisconnectCard - The disconnect card component. */ const DisconnectCard = props => { const { title, value, description } = props; diff --git a/projects/js-packages/connection/components/disconnect-dialog/index.jsx b/projects/js-packages/connection/components/disconnect-dialog/index.jsx index 61e2f4901a122..80f7656ef4f38 100644 --- a/projects/js-packages/connection/components/disconnect-dialog/index.jsx +++ b/projects/js-packages/connection/components/disconnect-dialog/index.jsx @@ -15,7 +15,7 @@ import StepThankYou from './steps/step-thank-you'; * The RNA Disconnect Dialog component. * * @param {object} props -- The properties. - * @returns {React.Component} The `DisconnectDialog` component. + * @return {React.Component} The `DisconnectDialog` component. */ const DisconnectDialog = props => { const [ isDisconnecting, setIsDisconnecting ] = useState( false ); @@ -302,7 +302,7 @@ const DisconnectDialog = props => { /** * Determine what step to show based on the current state * - * @returns { React.Component|undefined } - component for current step + * @return { React.Component|undefined } - component for current step */ const getCurrentStep = () => { if ( ! isDisconnected ) { diff --git a/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect-confirm.jsx b/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect-confirm.jsx index 1e89a88185f3b..6acda014f9fb1 100644 --- a/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect-confirm.jsx +++ b/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect-confirm.jsx @@ -11,7 +11,7 @@ import disconnectImage from '../images/disconnect-confirm.jpg'; * Will only show option to provide feedback if the canProvideFeedback prop is true. * * @param {object} props - The properties. - * @returns {React.Component} - StepDisconnectConfirm Component + * @return {React.Component} - StepDisconnectConfirm Component */ const StepDisconnectConfirm = props => { const { onExit, canProvideFeedback, onProvideFeedback } = props; diff --git a/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect.jsx b/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect.jsx index 4bbbe95017b65..03f91f659a808 100644 --- a/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect.jsx +++ b/projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect.jsx @@ -10,7 +10,7 @@ import ConnectedPlugins from '../../connected-plugins'; * Disconnect step in disconnection flow. * * @param {object} props - The properties. - * @returns {React.Component} - The StepDisconnect component + * @return {React.Component} - The StepDisconnect component */ const StepDisconnect = props => { const { @@ -66,7 +66,7 @@ const StepDisconnect = props => { /** * Render the disconnect button, allows for some variance based on context. * - * @returns {React.Component} - Button used for disconnect. + * @return {React.Component} - Button used for disconnect. */ const renderDisconnectButton = () => { let buttonText = __( 'Disconnect', 'jetpack' ); @@ -93,7 +93,7 @@ const StepDisconnect = props => { * Show some fallback output if there are no connected plugins to show and no passed disconnect component. * This is a more generic message about disconnecting Jetpack. * - * @returns {React.ElementType|undefined} - Fallback message for when there are no connected plugins or passed components to show. + * @return {React.ElementType|undefined} - Fallback message for when there are no connected plugins or passed components to show. */ const renderFallbackOutput = () => { const hasOtherConnectedPlugins = diff --git a/projects/js-packages/connection/components/disconnect-dialog/steps/step-survey.jsx b/projects/js-packages/connection/components/disconnect-dialog/steps/step-survey.jsx index 4c88f86e600a0..61a7f26342c3e 100644 --- a/projects/js-packages/connection/components/disconnect-dialog/steps/step-survey.jsx +++ b/projects/js-packages/connection/components/disconnect-dialog/steps/step-survey.jsx @@ -10,7 +10,7 @@ import DisconnectSurvey from '../../disconnect-survey'; * Show the survey step and allow the user to select a response. * * @param {object} props - The properties. - * @returns {React.Component} The StepSurvey Component + * @return {React.Component} The StepSurvey Component */ const StepSurvey = props => { const { onExit, onFeedBackProvided, isSubmittingFeedback } = props; diff --git a/projects/js-packages/connection/components/disconnect-dialog/steps/step-thank-you.jsx b/projects/js-packages/connection/components/disconnect-dialog/steps/step-thank-you.jsx index 229342c9d1b21..33a90c58067e3 100644 --- a/projects/js-packages/connection/components/disconnect-dialog/steps/step-thank-you.jsx +++ b/projects/js-packages/connection/components/disconnect-dialog/steps/step-thank-you.jsx @@ -10,7 +10,7 @@ import disconnectImage from '../images/disconnect-thanks.jpg'; * Show the "thank you" step following survey submission * * @param {object} props - The properties. - * @returns {React.Component} - The StepThankYou Component + * @return {React.Component} - The StepThankYou Component */ const StepThankYou = props => { const { onExit } = props; diff --git a/projects/js-packages/connection/components/disconnect-survey/index.jsx b/projects/js-packages/connection/components/disconnect-survey/index.jsx index 413bf117555d0..be1f25faea11e 100644 --- a/projects/js-packages/connection/components/disconnect-survey/index.jsx +++ b/projects/js-packages/connection/components/disconnect-survey/index.jsx @@ -8,7 +8,7 @@ import SurveyChoice from './survey-choice'; * Handles showing the disconnect survey. * * @param {object} props - The component props. - * @returns {React.Component} - DisconnectSurvey component. + * @return {React.Component} - DisconnectSurvey component. */ const DisconnectSurvey = props => { const { onSubmit, isSubmittingFeedback } = props; @@ -68,8 +68,8 @@ const DisconnectSurvey = props => { /** * Checks to see if an option is the currently selected option, returns a css class name if it matches. * - * @param {string} optionId - ID of the option to check for. - * @returns {string} - The "selected" class if this option is currently selected. + * @param {string} optionId - ID of the option to check for. + * @return {string} - The "selected" class if this option is currently selected. */ const selectedClass = optionId => { if ( optionId === selectedAnswer ) { @@ -83,7 +83,7 @@ const DisconnectSurvey = props => { * Event handler for keyboard events on the answer blocks. * * @param {string} answerId - The slug of the answer that has been selected. - * @param {object} e - Keydown event. + * @param {object} e - Keydown event. */ const handleAnswerKeyDown = useCallback( ( answerId, e ) => { @@ -102,7 +102,7 @@ const DisconnectSurvey = props => { /** * Show all the survey options from the options array. * - * @returns {React.ElementType []} - Mapped array of rendered survey options. + * @return {React.ElementType []} - Mapped array of rendered survey options. */ const renderOptions = () => { return options.map( option => { @@ -123,7 +123,7 @@ const DisconnectSurvey = props => { * Show the custom input survey option. * Contains an input field for a custom response. * - * @returns {React.ElementType} - The custom survey option with an input field. + * @return {React.ElementType} - The custom survey option with an input field. */ const renderCustomOption = () => { return ( diff --git a/projects/js-packages/connection/components/disconnect-survey/survey-choice.jsx b/projects/js-packages/connection/components/disconnect-survey/survey-choice.jsx index 21ed1430d7ec4..1a4d3cf801074 100644 --- a/projects/js-packages/connection/components/disconnect-survey/survey-choice.jsx +++ b/projects/js-packages/connection/components/disconnect-survey/survey-choice.jsx @@ -5,12 +5,12 @@ import './_jp-connect_disconnect-survey-card.scss'; /** * SurveyChoice - Present one choice in the survey. * - * @param {string} props.id - The ID/slug string of the survey option - * @param {Function} props.onClick - Event handler for clicking on the survey option. - * @param {Function} props.onKeydown - Event handler for pressing a key on the survey option. - * @param {React.ElementType} props.children - Any passed elements as children to this component. - * @param {string} props.className - A class name to apply to the survey choice. - * @returns {React.Component} SurveyChoice - The SurveyChoice component. + * @param {string} props.id - The ID/slug string of the survey option + * @param {Function} props.onClick - Event handler for clicking on the survey option. + * @param {Function} props.onKeydown - Event handler for pressing a key on the survey option. + * @param {React.ElementType} props.children - Any passed elements as children to this component. + * @param {string} props.className - A class name to apply to the survey choice. + * @return {React.Component} SurveyChoice - The SurveyChoice component. */ const SurveyChoice = props => { diff --git a/projects/js-packages/connection/components/in-place-connection/index.jsx b/projects/js-packages/connection/components/in-place-connection/index.jsx index 158ce822f0758..b57ae6cfa778c 100644 --- a/projects/js-packages/connection/components/in-place-connection/index.jsx +++ b/projects/js-packages/connection/components/in-place-connection/index.jsx @@ -7,18 +7,18 @@ import './style.scss'; /** * The in-place connection component. * - * @param {object} props -- The properties. - * @param {string} props.title -- Element title. - * @param {boolean} props.isLoading -- Whether the element is still loading. - * @param {string|number} props.width -- Iframe width. - * @param {string|number} props.height -- Iframe height. - * @param {boolean} props.displayTOS -- Whether the site has connection owner connected. - * @param {boolean} props.scrollToIframe -- Whether we need to auto-scroll the window upon element rendering. - * @param {string} props.connectUrl -- The connection URL. - * @param {Function} props.onComplete -- The callback to be called upon complete of the connection process. - * @param {Function} props.onThirdPartyCookiesBlocked -- The callback to be called if third-party cookies are disabled. - * @param {string} props.location -- Component location identifier passed to WP.com. - * @returns {React.Component} The in-place connection component. + * @param {object} props -- The properties. + * @param {string} props.title -- Element title. + * @param {boolean} props.isLoading -- Whether the element is still loading. + * @param {string|number} props.width -- Iframe width. + * @param {string|number} props.height -- Iframe height. + * @param {boolean} props.displayTOS -- Whether the site has connection owner connected. + * @param {boolean} props.scrollToIframe -- Whether we need to auto-scroll the window upon element rendering. + * @param {string} props.connectUrl -- The connection URL. + * @param {Function} props.onComplete -- The callback to be called upon complete of the connection process. + * @param {Function} props.onThirdPartyCookiesBlocked -- The callback to be called if third-party cookies are disabled. + * @param {string} props.location -- Component location identifier passed to WP.com. + * @return {React.Component} The in-place connection component. */ const InPlaceConnection = props => { const { diff --git a/projects/js-packages/connection/components/manage-connection-dialog/index.jsx b/projects/js-packages/connection/components/manage-connection-dialog/index.jsx index 87470fc22961f..a24771d625017 100644 --- a/projects/js-packages/connection/components/manage-connection-dialog/index.jsx +++ b/projects/js-packages/connection/components/manage-connection-dialog/index.jsx @@ -19,7 +19,7 @@ import './style.scss'; * The RNA Manage Connection Dialog component. * * @param {object} props -- The properties. - * @returns {React.JSX} The `ManageConnectionDialog` component. + * @return {React.JSX} The `ManageConnectionDialog` component. */ const ManageConnectionDialog = props => { const { diff --git a/projects/js-packages/connection/components/use-connection/index.jsx b/projects/js-packages/connection/components/use-connection/index.jsx index e18e713db1452..d77757bb3c057 100644 --- a/projects/js-packages/connection/components/use-connection/index.jsx +++ b/projects/js-packages/connection/components/use-connection/index.jsx @@ -41,7 +41,7 @@ export default ( { /** * User register process handler. * - * @returns {Promise} - Promise which resolves when the product status is activated. + * @return {Promise} - Promise which resolves when the product status is activated. */ const handleConnectUser = () => { if ( ! skipUserConnection ) { @@ -64,7 +64,7 @@ export default ( { * the site was successfully registered. * * @param {Event} [e] - Event that dispatched handleRegisterSite - * @returns {Promise} Promise when running the registration process. Otherwise, nothing. + * @return {Promise} Promise when running the registration process. Otherwise, nothing. */ const handleRegisterSite = e => { e && e.preventDefault(); diff --git a/projects/js-packages/connection/helpers/get-calypso-origin.ts b/projects/js-packages/connection/helpers/get-calypso-origin.ts index 84171a1c0ed1a..3946bc4c3f509 100644 --- a/projects/js-packages/connection/helpers/get-calypso-origin.ts +++ b/projects/js-packages/connection/helpers/get-calypso-origin.ts @@ -3,7 +3,7 @@ import { getScriptData } from '@automattic/jetpack-script-data'; /** * Get the Calypso origin based on the development environment. * - * @returns {string} The Calypso url origin. + * @return {string} The Calypso url origin. */ export default function getCalypsoOrigin() { const calypsoEnv = ( diff --git a/projects/js-packages/connection/hooks/use-connection-error-notice/index.jsx b/projects/js-packages/connection/hooks/use-connection-error-notice/index.jsx index 5f85997cef8fd..82b78fe298926 100644 --- a/projects/js-packages/connection/hooks/use-connection-error-notice/index.jsx +++ b/projects/js-packages/connection/hooks/use-connection-error-notice/index.jsx @@ -7,7 +7,7 @@ import useRestoreConnection from '../../hooks/use-restore-connection/index.jsx'; * Returns a ConnectionErrorNotice component and the conditional flag on whether * to render the component or not. * - * @returns {object} - The hook data. + * @return {object} - The hook data. */ export default function useConnectionErrorNotice() { const { connectionErrors } = useConnection( {} ); diff --git a/projects/js-packages/connection/hooks/use-product-checkout-workflow/index.jsx b/projects/js-packages/connection/hooks/use-product-checkout-workflow/index.jsx index 87bb103c68c88..1462a9d9584d2 100644 --- a/projects/js-packages/connection/hooks/use-product-checkout-workflow/index.jsx +++ b/projects/js-packages/connection/hooks/use-product-checkout-workflow/index.jsx @@ -22,17 +22,17 @@ const defaultAdminUrl = * Custom hook that performs the needed steps * to concrete the checkout workflow. * - * @param {object} props - The props passed to the hook. - * @param {string} props.productSlug - The WordPress product slug. - * @param {string} props.redirectUrl - The URI to redirect to after checkout. - * @param {string} [props.siteSuffix] - The site suffix. - * @param {string} [props.adminUrl] - The site wp-admin url. - * @param {boolean} props.connectAfterCheckout - Whether or not to conect after checkout if not connected (default false - connect before). + * @param {object} props - The props passed to the hook. + * @param {string} props.productSlug - The WordPress product slug. + * @param {string} props.redirectUrl - The URI to redirect to after checkout. + * @param {string} [props.siteSuffix] - The site suffix. + * @param {string} [props.adminUrl] - The site wp-admin url. + * @param {boolean} props.connectAfterCheckout - Whether or not to conect after checkout if not connected (default false - connect before). * @param {Function} props.siteProductAvailabilityHandler - The function used to check whether the site already has the requested product. This will be checked after registration and the checkout page will be skipped if the promise returned resloves true. * @param {Function} props.from - The plugin slug initiated the flow. - * @param {number} [props.quantity] - The quantity of the product to purchase. - * @param {boolean} [props.useBlogIdSuffix] - Use blog ID instead of site suffix in the checkout URL. - * @returns {Function} The useEffect hook. + * @param {number} [props.quantity] - The quantity of the product to purchase. + * @param {boolean} [props.useBlogIdSuffix] - Use blog ID instead of site suffix in the checkout URL. + * @return {Function} The useEffect hook. */ export default function useProductCheckoutWorkflow( { productSlug, @@ -152,9 +152,9 @@ export default function useProductCheckoutWorkflow( { /** * Handler to run the checkout workflow. * - * @param {Event} [event] - Event that dispatched run + * @param {Event} [event] - Event that dispatched run * @param {string} redirect - A possible redirect URL to go to after the checkout - * @returns {void} Nothing. + * @return {void} Nothing. */ const run = ( event, redirect = null ) => { event && event.preventDefault(); diff --git a/projects/js-packages/connection/hooks/use-restore-connection/index.jsx b/projects/js-packages/connection/hooks/use-restore-connection/index.jsx index f43048a5bdd58..dac3fd2be2920 100644 --- a/projects/js-packages/connection/hooks/use-restore-connection/index.jsx +++ b/projects/js-packages/connection/hooks/use-restore-connection/index.jsx @@ -11,7 +11,7 @@ const { apiRoot, apiNonce } = * Restore connection hook. * It will initiate an API request attempting to restore the connection, or reconnect if it cannot be restored. * - * @returns {object} - The hook data. + * @return {object} - The hook data. */ export default function useRestoreConnection() { const [ isRestoringConnection, setIsRestoringConnection ] = useState( false ); @@ -25,7 +25,7 @@ export default function useRestoreConnection() { * Initiate connection restore. * * @param {boolean} autoReconnectUser - If user connection needs to be reestablished, automatically initiate the flow. - * @returns {Promise} - The API request promise. + * @return {Promise} - The API request promise. */ const restoreConnection = ( autoReconnectUser = true ) => { setIsRestoringConnection( true ); diff --git a/projects/js-packages/connection/state/actions.jsx b/projects/js-packages/connection/state/actions.jsx index 40f0c7a87d093..4286a4b7642b9 100644 --- a/projects/js-packages/connection/state/actions.jsx +++ b/projects/js-packages/connection/state/actions.jsx @@ -72,11 +72,11 @@ const setIsOfflineMode = isOfflineMode => { /** * Connect site with wp.com user * - * @param {object} Object - contains from and redirectFunc - * @param {string} Object.from - Value that represents the redirect origin - * @param {Function} Object.redirectFunc - A function to handle the redirect, defaults to location.assign - * @param {string} [Object.redirectUri] - A URI that the user will be redirected to - * @yields {object} Action object that will be yielded + * @param {object} Object - contains from and redirectFunc + * @param {string} Object.from - Value that represents the redirect origin + * @param {Function} Object.redirectFunc - A function to handle the redirect, defaults to location.assign + * @param {string} [Object.redirectUri] - A URI that the user will be redirected to + * @yield {object} Action object that will be yielded */ function* connectUser( { from, redirectFunc, redirectUri } = {} ) { yield setUserIsConnecting( true ); @@ -87,12 +87,12 @@ function* connectUser( { from, redirectFunc, redirectUri } = {} ) { * * Register an site into jetpack * - * @param {object} Object - contains registrationNonce and redirectUri + * @param {object} Object - contains registrationNonce and redirectUri * @param {string} Object.registrationNonce - Registration nonce - * @param {string} Object.redirectUri - URI that user will be redirected - * @param {string} [Object.from] - Value that represents the origin of the request (optional) - * @yields {object} Action object that will be yielded - * @returns {Promise} Resolved or rejected value of registerSite + * @param {string} Object.redirectUri - URI that user will be redirected + * @param {string} [Object.from] - Value that represents the origin of the request (optional) + * @yield {object} Action object that will be yielded + * @return {Promise} Resolved or rejected value of registerSite */ function* registerSite( { registrationNonce, redirectUri, from = '' } ) { yield clearRegistrationError(); @@ -114,7 +114,7 @@ function* registerSite( { registrationNonce, redirectUri, from = '' } ) { /** * Side effect action which will fetch a new list of connectedPlugins from the server * - * @returns {Promise} - Promise which resolves when the product status is activated. + * @return {Promise} - Promise which resolves when the product status is activated. */ const refreshConnectedPlugins = () => diff --git a/projects/js-packages/connection/state/selectors.jsx b/projects/js-packages/connection/state/selectors.jsx index cee4a8bada01c..40948292abc62 100644 --- a/projects/js-packages/connection/state/selectors.jsx +++ b/projects/js-packages/connection/state/selectors.jsx @@ -12,7 +12,7 @@ const connectionSelectors = { * Checks whether the store is fetching the connection status from the server * * @deprecated since 0.14.0 - * @returns {boolean} Is the store is fetching the connection status from the server? + * @return {boolean} Is the store is fetching the connection status from the server? */ getConnectionStatusIsFetching: () => false, getSiteIsRegistering: state => state.siteIsRegistering || false, diff --git a/projects/js-packages/critical-css-gen/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/critical-css-gen/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/critical-css-gen/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/critical-css-gen/src/browser-interface-playwright.ts b/projects/js-packages/critical-css-gen/src/browser-interface-playwright.ts index 8355608d7945e..f0da79687a6a7 100644 --- a/projects/js-packages/critical-css-gen/src/browser-interface-playwright.ts +++ b/projects/js-packages/critical-css-gen/src/browser-interface-playwright.ts @@ -16,7 +16,7 @@ export class BrowserInterfacePlaywright extends BrowserInterface { * Creates a new BrowserInterfacePlaywright instance. * * @param {BrowserContext} context - The playwright browser context to work with. - * @param {string[]} urls - Array of urls to evaluate. The reason we are taking this as an argument is because we want to load all of them in parallel. + * @param {string[]} urls - Array of urls to evaluate. The reason we are taking this as an argument is because we want to load all of them in parallel. */ constructor( private context: BrowserContext, @@ -40,7 +40,7 @@ export class BrowserInterfacePlaywright extends BrowserInterface { * * @param {BrowserContext} context - Browser context to use. * @param {string[]} urls - Array of urls to open. - * @returns {Promise< TabsByUrl >} Promise resolving to the browser context. + * @return {Promise< TabsByUrl >} Promise resolving to the browser context. */ private async openUrls( context: BrowserContext, urls: string[] ): Promise< void > { this.tabs = await objectPromiseAll< Tab >( @@ -56,7 +56,7 @@ export class BrowserInterfacePlaywright extends BrowserInterface { * * @param {BrowserContext} browserContext - Browser context to use. * @param {string} url - Url to open. - * @returns {Promise} Promise resolving to the page instance. + * @return {Promise} Promise resolving to the page instance. */ private async newTab( browserContext: BrowserContext, url: string ): Promise< Tab > { const tab = { @@ -111,7 +111,7 @@ export class BrowserInterfacePlaywright extends BrowserInterface { * @param {string} url - URL to fetch. * @param {object} options - Fetch options. * @param {string} _role - 'css' or 'html' indicating what kind of thing is being fetched. - * @returns {Promise} A promise that resolves to the fetch response. + * @return {Promise} A promise that resolves to the fetch response. */ async fetch( url: string, options: FetchOptions, _role: 'css' | 'html' ) { return fetch( url, options ); diff --git a/projects/js-packages/critical-css-gen/src/browser-interface.ts b/projects/js-packages/critical-css-gen/src/browser-interface.ts index a8393827258b2..4633b4c37d44b 100644 --- a/projects/js-packages/critical-css-gen/src/browser-interface.ts +++ b/projects/js-packages/critical-css-gen/src/browser-interface.ts @@ -40,9 +40,9 @@ export class BrowserInterface { * Context-specific wrapper for fetch; uses window.fetch in browsers, or a * node library when using Puppeteer. * - * @param {string} _url - The URL to fetch - * @param {FetchOptions} _options - Fetch options - * @param {'css' | 'html'} _role - Role of the fetch operation + * @param {string} _url - The URL to fetch + * @param {FetchOptions} _options - Fetch options + * @param {'css' | 'html'} _role - Role of the fetch operation */ async fetch( _url: string, @@ -80,9 +80,9 @@ export class BrowserInterface { /** * Get all internal styles as a combined string from the window. * - * @param {object} wrappedArgs - Object containing the inner window. + * @param {object} wrappedArgs - Object containing the inner window. * @param {Window} wrappedArgs.innerWindow - Window inside the browser interface. - * @returns {string} Combined internal styles as a string. + * @return {string} Combined internal styles as a string. */ static innerGetInternalStyles( { innerWindow } ): string { innerWindow = null === innerWindow ? window : innerWindow; @@ -99,11 +99,11 @@ export class BrowserInterface { * for easy querySelector calling (values), return an array of selectors which match * _any_ element on the page. * - * @param {object} wrappedArgs - Object containing the inner window and arguments. + * @param {object} wrappedArgs - Object containing the inner window and arguments. * @param {Window} wrappedArgs.innerWindow - Window inside the browser interface. * @param {Object[]} wrappedArgs.args - Array of arguments. - * {Object} wrappedArgs.args[selectors] - Map containing selectors (object keys), and simplified versions for easy matching (values). - * @returns {string[]} Array of selectors matching above-the-fold elements. + * {Object} wrappedArgs.args[selectors] - Map containing selectors (object keys), and simplified versions for easy matching (values). + * @return {string[]} Array of selectors matching above-the-fold elements. */ public static innerFindMatchingSelectors( { innerWindow, args: [ selectors ] } ) { innerWindow = null === innerWindow ? window : innerWindow; @@ -122,12 +122,12 @@ export class BrowserInterface { * for easy querySelector calling (values), return an array of selectors which match * any above-the-fold element on the page. * - * @param {object} wrappedArgs - Object containing the inner window and arguments. + * @param {object} wrappedArgs - Object containing the inner window and arguments. * @param {Window} wrappedArgs.innerWindow - Window inside the browser interface. * @param {Object[]} wrappedArgs.args - Array of arguments. - * {Object} wrappedArgs.args[selectors] - Map containing selectors (object keys), and simplified versions for easy matching (values). - * {string[]} wrappedArgs.args[pageSelectors] - String array containing selectors that appear anywhere on this page (as returned by innerFindMatchingSelectors) - should be a subset of keys in selectors. - * @returns {string[]} Array of selectors matching above-the-fold elements. + * {Object} wrappedArgs.args[selectors] - Map containing selectors (object keys), and simplified versions for easy matching (values). + * {string[]} wrappedArgs.args[pageSelectors] - String array containing selectors that appear anywhere on this page (as returned by innerFindMatchingSelectors) - should be a subset of keys in selectors. + * @return {string[]} Array of selectors matching above-the-fold elements. */ public static innerFindAboveFoldSelectors( { innerWindow, diff --git a/projects/js-packages/critical-css-gen/src/css-file-set.ts b/projects/js-packages/critical-css-gen/src/css-file-set.ts index 924a32ef70600..6a18e2eb37b18 100644 --- a/projects/js-packages/critical-css-gen/src/css-file-set.ts +++ b/projects/js-packages/critical-css-gen/src/css-file-set.ts @@ -103,7 +103,7 @@ export class CSSFileSet { * Collates an object describing the selectors found in the CSS files in this set, and which * HTML page URLs include them (via CSS files) * - * @returns {object} - An object with selector text keys, each containing a Set of page URLs (strings) + * @return {object} - An object with selector text keys, each containing a Set of page URLs (strings) */ collateSelectorPages(): { [ selector: string ]: Set< string > } { const selectors = {}; @@ -138,7 +138,7 @@ export class CSSFileSet { * set of selectors that are worth keeping. (i.e.: appear above the fold). * * @param {Set} usefulSelectors - Set of selectors to keep. - * @returns {StyleAST[]} Array of pruned StyleAST objects. + * @return {StyleAST[]} Array of pruned StyleAST objects. */ prunedAsts( usefulSelectors: Set< string > ): StyleAST[] { // Perform basic pruning. @@ -256,7 +256,7 @@ export class CSSFileSet { /** * Returns a list of errors that occurred while fetching or parsing these CSS files. * - * @returns {Error[]} - List of errors that occurred. + * @return {Error[]} - List of errors that occurred. */ getErrors() { return this.errors; diff --git a/projects/js-packages/critical-css-gen/src/generate-critical-css.ts b/projects/js-packages/critical-css-gen/src/generate-critical-css.ts index d11436f015f47..432172192a14a 100644 --- a/projects/js-packages/critical-css-gen/src/generate-critical-css.ts +++ b/projects/js-packages/critical-css-gen/src/generate-critical-css.ts @@ -18,7 +18,7 @@ const noop = () => { * @param {BrowserInterface} browserInterface - interface to access pages * @param {string[]} urls - list of URLs to scan for CSS files * @param {number} maxPages - number of pages to process at most - * @returns {Array} - Two member array; CSSFileSet, and an object containing errors that occurred at each URL. + * @return {Array} - Two member array; CSSFileSet, and an object containing errors that occurred at each URL. */ async function collateCssFiles( browserInterface: BrowserInterface, @@ -80,7 +80,7 @@ async function collateCssFiles( * @param {number} param.maxPages - Maximum number of pages to process * @param {Function} param.updateProgress - Update progress callback function * - * @returns {Set} - List of above the fold selectors. + * @return {Set} - List of above the fold selectors. */ async function getAboveFoldSelectors( { browserInterface, @@ -142,15 +142,15 @@ async function getAboveFoldSelectors( { /** * Generates critical CSS for the given URLs and viewports. * - * @param {object} root0 - The options object + * @param {object} root0 - The options object * @param {BrowserInterface} root0.browserInterface - Interface to interact with the browser - * @param {Function} root0.progressCallback - Optional callback function to report progress - * @param {string[]} root0.urls - Array of URLs to generate critical CSS for - * @param {Viewport[]} root0.viewports - Array of viewport sizes to consider - * @param {FilterSpec} root0.filters - Optional filters to apply to the CSS - * @param {number} root0.successRatio - Ratio of successful URLs required (default: 1) - * @param {number} root0.maxPages - Maximum number of pages to process (default: 10) - * @returns {Promise<[string, Error[]]>} A promise that resolves to an array containing the critical CSS string and an array of errors. + * @param {Function} root0.progressCallback - Optional callback function to report progress + * @param {string[]} root0.urls - Array of URLs to generate critical CSS for + * @param {Viewport[]} root0.viewports - Array of viewport sizes to consider + * @param {FilterSpec} root0.filters - Optional filters to apply to the CSS + * @param {number} root0.successRatio - Ratio of successful URLs required (default: 1) + * @param {number} root0.maxPages - Maximum number of pages to process (default: 10) + * @return {Promise<[string, Error[]]>} A promise that resolves to an array containing the critical CSS string and an array of errors. */ export async function generateCriticalCSS( { browserInterface, diff --git a/projects/js-packages/critical-css-gen/src/ignored-pseudo-elements.ts b/projects/js-packages/critical-css-gen/src/ignored-pseudo-elements.ts index c68947883212f..082eebe86cc25 100644 --- a/projects/js-packages/critical-css-gen/src/ignored-pseudo-elements.ts +++ b/projects/js-packages/critical-css-gen/src/ignored-pseudo-elements.ts @@ -14,7 +14,7 @@ let removePseudoElementRegex: RegExp; * Builds a RegExp for finding pseudo elements that should be ignored while matching * elements that are above the fold. * - * @returns {RegExp} A RegExp to use when removing unwanted pseudo elements. + * @return {RegExp} A RegExp to use when removing unwanted pseudo elements. */ function getRemovePseudoElementRegex(): RegExp { if ( removePseudoElementRegex ) { @@ -32,7 +32,7 @@ function getRemovePseudoElementRegex(): RegExp { * * @param {string} selector - selector to filter. * - * @returns {string} selector with ignored pseudo elements removed. + * @return {string} selector with ignored pseudo elements removed. */ export function removeIgnoredPseudoElements( selector: string ): string { return selector.replace( getRemovePseudoElementRegex(), '' ).trim(); diff --git a/projects/js-packages/critical-css-gen/src/minify-css.ts b/projects/js-packages/critical-css-gen/src/minify-css.ts index ed6032121ac0c..eebce4b9cc86f 100644 --- a/projects/js-packages/critical-css-gen/src/minify-css.ts +++ b/projects/js-packages/critical-css-gen/src/minify-css.ts @@ -8,7 +8,7 @@ import CleanCSS from 'clean-css'; * * @param {string} css - CSS to minify. * - * @returns {[ string, string[] ]} - Minified CSS and a list of errors returned. + * @return {[ string, string[] ]} - Minified CSS and a list of errors returned. */ export function minifyCss( css: string ): [ string, string[] ] { const result = new CleanCSS().minify( css ); diff --git a/projects/js-packages/critical-css-gen/src/object-promise-all.ts b/projects/js-packages/critical-css-gen/src/object-promise-all.ts index 016cc07f3a49c..78da9541de643 100644 --- a/projects/js-packages/critical-css-gen/src/object-promise-all.ts +++ b/projects/js-packages/critical-css-gen/src/object-promise-all.ts @@ -3,7 +3,7 @@ * Roughly equivalent of Promise.all, but applies to an object. * * @param {object} object - containing promises to resolve - * @returns {object} - Promise which resolves to an object containing resultant values + * @return {object} - Promise which resolves to an object containing resultant values */ export async function objectPromiseAll< ValueType >( object: { [ key: string ]: Promise< ValueType >; diff --git a/projects/js-packages/critical-css-gen/src/style-ast.ts b/projects/js-packages/critical-css-gen/src/style-ast.ts index bde637e0dc4e0..191ca798b2d03 100644 --- a/projects/js-packages/critical-css-gen/src/style-ast.ts +++ b/projects/js-packages/critical-css-gen/src/style-ast.ts @@ -18,7 +18,7 @@ const excludedProperties = [ /** * Checks if the given node is a CSS declaration. * @param {csstree.CssNode} node - The CSS node to check. - * @returns {boolean} True if the node is a CSS declaration, false otherwise. + * @return {boolean} True if the node is a CSS declaration, false otherwise. */ function isDeclaration( node: csstree.CssNode ): node is csstree.Declaration { return node.type === 'Declaration'; @@ -27,7 +27,7 @@ function isDeclaration( node: csstree.CssNode ): node is csstree.Declaration { /** * Checks if the given node has an empty child list. * @param {csstree.CssNode} node - The CSS node to check. - * @returns {boolean} True if the node has an empty child list, false otherwise. + * @return {boolean} True if the node has an empty child list, false otherwise. */ function hasEmptyChildList( node: csstree.CssNode ): boolean { if ( 'children' in node && node.children instanceof csstree.List ) { @@ -84,7 +84,7 @@ export class StyleAST { * * @param {Set< string >} criticalSelectors - Set of selectors to keep in the new AST. * - * @returns {StyleAST} - New AST with pruned contents. + * @return {StyleAST} - New AST with pruned contents. */ pruned( criticalSelectors: Set< string > ): StyleAST { const clone = new StyleAST( this.css, csstree.clone( this.ast ), this.errors ); @@ -103,7 +103,7 @@ export class StyleAST { * Given an AST node, returns the original text it was compiled from in the source CSS. * * @param {object} node - Node from the AST. - * @returns {string} original text the node was compiled from. + * @return {string} original text the node was compiled from. */ originalText( node: csstree.CssNode ): string { if ( node.loc && node.loc.start && node.loc.end ) { @@ -168,7 +168,7 @@ export class StyleAST { * that were removed. * * @param {Set< string >} usedVariables - Set of used variables to keep. - * @returns {number} variables pruned. + * @return {number} variables pruned. */ pruneUnusedVariables( usedVariables: Set< string > ): number { let pruned = 0; @@ -197,7 +197,7 @@ export class StyleAST { /** * Find all variables that are used and return them as a Set. - * @returns {Set< string >} Set of used variables. + * @return {Set< string >} Set of used variables. */ getUsedVariables(): Set< string > { const usedVariables = new Set< string >(); @@ -291,7 +291,7 @@ export class StyleAST { * Returns true if the given CSS rule object relates to animation keyframes. * * @param {csstree.WalkContext} rule - CSS rule. - * @returns {boolean} True if the rule is a keyframe rule, false otherwise. + * @return {boolean} True if the rule is a keyframe rule, false otherwise. */ static isKeyframeRule( rule: csstree.WalkContext ): boolean { return ( rule.atrule && csstree.keyword( rule.atrule.name ).basename === 'keyframes' ) || false; @@ -473,7 +473,7 @@ export class StyleAST { /** * Returns a count of the rules in this Style AST. * - * @returns {number} rules in this AST. + * @return {number} rules in this AST. */ ruleCount(): number { let rules = 0; @@ -491,7 +491,7 @@ export class StyleAST { /** * Returns a list of font families that are used by any rule in this AST. * - * @returns {Set} Set of used fonts. + * @return {Set} Set of used fonts. */ getUsedFontFamilies(): Set< string > { const fontFamilies = new Set< string >(); @@ -525,7 +525,7 @@ export class StyleAST { * string types if present. * * @param {csstree.CssNode} node - AST node. - * @returns {string} The value of the node as a string. + * @return {string} The value of the node as a string. */ static readValue( node: csstree.CssNode ): string { if ( node.type === 'String' && stringPattern.test( node.value ) ) { @@ -544,7 +544,7 @@ export class StyleAST { * * @param {object} mediaQueryNode - Media Query AST node to examine. * - * @returns {boolean} true if the media query is relevant to screens. + * @return {boolean} true if the media query is relevant to screens. */ static isUsefulMediaQuery( mediaQueryNode: csstree.MediaQuery ): boolean { // Find media types. @@ -587,7 +587,7 @@ export class StyleAST { /** * Returns this AST converted to CSS. * - * @returns {string} this AST represented in CSS. + * @return {string} this AST represented in CSS. */ toCSS(): string { return csstree.generate( this.ast ); @@ -598,7 +598,7 @@ export class StyleAST { * * @param {string} css - CSS to parse. * - * @returns {StyleAST} new parse AST based on the CSS. + * @return {StyleAST} new parse AST based on the CSS. */ static parse( css: string ): StyleAST { const errors: Error[] = []; diff --git a/projects/js-packages/critical-css-gen/tests/lib/mock-fetch.js b/projects/js-packages/critical-css-gen/tests/lib/mock-fetch.js index d09fc397d0316..50f55a82d53f8 100644 --- a/projects/js-packages/critical-css-gen/tests/lib/mock-fetch.js +++ b/projects/js-packages/critical-css-gen/tests/lib/mock-fetch.js @@ -5,7 +5,7 @@ const { dataDirectory } = require( './data-directory.js' ); * Mocked out version of node-fetch; allows fetching local resources from the data directory. * * @param {string} url - to fetch. - * @returns {Promise} - A Promise that resolves to an object with 'ok' and 'text' properties. + * @return {Promise} - A Promise that resolves to an object with 'ok' and 'text' properties. */ const mockFetch = async url => { return new Promise( ( resolve, reject ) => { diff --git a/projects/js-packages/eslint-changed/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/eslint-changed/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/eslint-changed/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/eslint-changed/src/cli.js b/projects/js-packages/eslint-changed/src/cli.js index 1ab88f0fd489f..fc23ced57c25d 100755 --- a/projects/js-packages/eslint-changed/src/cli.js +++ b/projects/js-packages/eslint-changed/src/cli.js @@ -14,7 +14,7 @@ const APP_VERSION = '2.0.9-alpha'; * Call `.parseAsync()` to run. * * @param {object} [process] - Process object. Needs at least a `cwd()` method and an `env` property. - * @returns {Command} Commander instance. + * @return {Command} Commander instance. */ export function createProgram( process = global.process ) { const program = new Command(); @@ -72,8 +72,8 @@ export function createProgram( process = global.process ) { /** * Main method. * - * @param {object} process - Process object. - * @param {object} argv - Command line options. + * @param {object} process - Process object. + * @param {object} argv - Command line options. * @param {Command} program - Commander instance. */ async function main( process, argv, program ) { @@ -108,7 +108,7 @@ async function main( process, argv, program ) { * Get files from a diff. * * @param {Array} diff - Diff array from `parse-diff`. - * @returns {string[]} File name strings. + * @return {string[]} File name strings. */ function getFilesFromDiff( diff ) { let files = diff.map( x => x.to ); @@ -128,9 +128,9 @@ async function main( process, argv, program ) { /** * Spawn a command, exiting if it fails. * - * @param {string} cmd - Command to execute. + * @param {string} cmd - Command to execute. * @param {string[]} cmdArgs - Arguments to the command. - * @returns {string} Command output. + * @return {string} Command output. */ function doCmd( cmd, cmdArgs ) { const res = spawnSync( cmd, cmdArgs, spawnOpt ); diff --git a/projects/js-packages/eslint-changed/tests/cli.test.js b/projects/js-packages/eslint-changed/tests/cli.test.js index 2ef4d711ff41c..572623a1ae0bc 100644 --- a/projects/js-packages/eslint-changed/tests/cli.test.js +++ b/projects/js-packages/eslint-changed/tests/cli.test.js @@ -16,9 +16,9 @@ describe( 'bin/eslint-changed.js', () => { /** * Run eslint-changed. * - * @param {string[]} args - Arguments to pass. - * @param {object} [options] - Process options. - * @returns {object} data - Process data. + * @param {string[]} args - Arguments to pass. + * @param {object} [options] - Process options. + * @return {object} data - Process data. */ async function runEslintChanged( args, options = {} ) { const proc = { @@ -330,12 +330,12 @@ describe( 'bin/eslint-changed.js', () => { * * The path is stored in `tmpdir`. * - * @param {object[]} branches - An array of branches to create. - * @param {string} [branches.name] - Name of the branch. - * @param {string} [branches.parent] - Name of the parent branch. If omitted, the parent is the previous entry in the array. Must be omitted in the first entry. - * @param {Object} branches.files - Files to modify, and their contents (or null to delete the file). - * @param {Object} [staged] - Files to modify and stage. - * @param {Object} [unstaged] - Files to modify and leave unstaged. + * @param {object[]} branches - An array of branches to create. + * @param {string} [branches.name] - Name of the branch. + * @param {string} [branches.parent] - Name of the parent branch. If omitted, the parent is the previous entry in the array. Must be omitted in the first entry. + * @param {Object} branches.files - Files to modify, and their contents (or null to delete the file). + * @param {Object} [staged] - Files to modify and stage. + * @param {Object} [unstaged] - Files to modify and leave unstaged. */ async function mktmpdirgit( branches, staged, unstaged ) { await mktmpdir(); @@ -355,7 +355,7 @@ describe( 'bin/eslint-changed.js', () => { * Modify files. * * @param {Object} files - Files to modify, and their contents (or null to delete the file). - * @param {boolean} git - Whether to do git manipulations. + * @param {boolean} git - Whether to do git manipulations. */ async function doFiles( files, git ) { const modified = []; diff --git a/projects/js-packages/eslint-config-target-es/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/eslint-config-target-es/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/eslint-config-target-es/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/eslint-config-target-es/src/funcs.js b/projects/js-packages/eslint-config-target-es/src/funcs.js index 53a9920c678f7..3d2ae46f8d926 100644 --- a/projects/js-packages/eslint-config-target-es/src/funcs.js +++ b/projects/js-packages/eslint-config-target-es/src/funcs.js @@ -10,9 +10,9 @@ const warn = debug( '@automattic/eslint-config-target-es:warn' ); /** * Get the list of supported browsers. * - * @param {object} options - Options. + * @param {object} options - Options. * @param {string} options.query - Browserslist query. - * @returns {object} Browsers mapped to arrays of versions. + * @return {object} Browsers mapped to arrays of versions. */ function getAllBrowsers( options = {} ) { const browsers = {}; @@ -42,9 +42,9 @@ function getAllBrowsers( options = {} ) { * Get the list of supported browsers. * * @deprecated since 2.1.0. Use getAllBrowsers instead. - * @param {object} options - Options. + * @param {object} options - Options. * @param {string} options.query - Browserslist query. - * @returns {object} Browsers mapped to minimum versions. + * @return {object} Browsers mapped to minimum versions. */ function getBrowsers( options = {} ) { warn( 'getBrowsers is deprecated. Use getAllBrowsers instead.' ); @@ -59,10 +59,10 @@ function getBrowsers( options = {} ) { /** * Get the es-x rule configurations. * - * @param {object} options - Options. + * @param {object} options - Options. * @param {boolean|null} options.builtins - If true, only rules with "javascript.builtins" paths are checked. If false, such rules are not checked. If null/undefined, all may be checked. - * @param {string} options.query - Browserslist query. - * @returns {object} Rules configuration. + * @param {string} options.query - Browserslist query. + * @return {object} Rules configuration. */ function getRules( options = {} ) { const browsers = getAllBrowsers( options ); diff --git a/projects/js-packages/eslint-config-target-es/src/needsCheck.js b/projects/js-packages/eslint-config-target-es/src/needsCheck.js index b34d37f023a99..859a49bfe2095 100644 --- a/projects/js-packages/eslint-config-target-es/src/needsCheck.js +++ b/projects/js-packages/eslint-config-target-es/src/needsCheck.js @@ -9,11 +9,11 @@ const debuglog = debug( '@automattic/eslint-config-target-es:debug' ); /** * Test if a rule needs to be checked. * - * @param {string} rule - Rule. - * @param {object} browsers - Browsers targeted. - * @param {object} options - Options. + * @param {string} rule - Rule. + * @param {object} browsers - Browsers targeted. + * @param {object} options - Options. * @param {boolean|null} options.builtins - If true, only rules with "javascript.builtins" paths are checked. If false, such rules are not checked. If null/undefined, all may be checked. - * @returns {boolean} Whether the rule needs to be checked. + * @return {boolean} Whether the rule needs to be checked. */ function needsCheck( rule, browsers, options = {} ) { let paths = rulesMap[ rule ]; diff --git a/projects/js-packages/eslint-config-target-es/tests/configs-eslintrc.test.js b/projects/js-packages/eslint-config-target-es/tests/configs-eslintrc.test.js index 28408c4c5edec..0ea9f50cd8ece 100644 --- a/projects/js-packages/eslint-config-target-es/tests/configs-eslintrc.test.js +++ b/projects/js-packages/eslint-config-target-es/tests/configs-eslintrc.test.js @@ -24,7 +24,7 @@ afterEach( () => { * Load the config, bypassing normal module caching. * * @param {string} name - Config name. - * @returns {object} Config. + * @return {object} Config. */ function loadConfig( name ) { let config; diff --git a/projects/js-packages/eslint-config-target-es/tests/configs-flat.test.js b/projects/js-packages/eslint-config-target-es/tests/configs-flat.test.js index 79a33be71c1a1..a1ba3f652b1fa 100644 --- a/projects/js-packages/eslint-config-target-es/tests/configs-flat.test.js +++ b/projects/js-packages/eslint-config-target-es/tests/configs-flat.test.js @@ -33,7 +33,7 @@ afterEach( () => { * Load the config, bypassing normal module caching. * * @param {string} name - Config name. - * @returns {object} Config. + * @return {object} Config. */ function loadConfig( name ) { let config; diff --git a/projects/js-packages/i18n-check-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/i18n-check-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/i18n-check-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/i18n-check-webpack-plugin/package.json b/projects/js-packages/i18n-check-webpack-plugin/package.json index afc3d9a806fac..3e6936218afbc 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/package.json +++ b/projects/js-packages/i18n-check-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/i18n-check-webpack-plugin", - "version": "1.1.9", + "version": "1.1.10-alpha", "description": "A Webpack plugin to check that WordPress i18n hasn't been mangled by Webpack optimizations.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/i18n-check-webpack-plugin/#readme", "bugs": { diff --git a/projects/js-packages/i18n-check-webpack-plugin/src/GettextEntry.js b/projects/js-packages/i18n-check-webpack-plugin/src/GettextEntry.js index 154edb00e37be..819deb546a807 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/src/GettextEntry.js +++ b/projects/js-packages/i18n-check-webpack-plugin/src/GettextEntry.js @@ -22,12 +22,12 @@ class GettextEntry { /** * Constructor. * - * @param {object} data - Entry data. - * @param {string} data.msgid - Message string. - * @param {string} data.plural - Plural string. - * @param {string} data.context - Context. - * @param {string} data.domain - Text domain. - * @param {Iterable} data.comments - Comments. + * @param {object} data - Entry data. + * @param {string} data.msgid - Message string. + * @param {string} data.plural - Plural string. + * @param {string} data.context - Context. + * @param {string} data.domain - Text domain. + * @param {Iterable} data.comments - Comments. * @param {Iterable} data.locations - Locations. */ constructor( data ) { diff --git a/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js b/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js index 814061fbf214a..6cd362e8f2da1 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js +++ b/projects/js-packages/i18n-check-webpack-plugin/src/GettextExtractor.js @@ -38,10 +38,10 @@ class GettextExtractor { /** * Constructor. * - * @param {object} options - Configuration options. - * @param {object} options.babelOptions - Options for Babel. - * @param {Object} options.functions - Functions to extract. Defaults are available as a static property `defaultFunctions`. - * @param {Function} options.lintLogger - Lint logging callback. See `this.setLintLogger()`. + * @param {object} options - Configuration options. + * @param {object} options.babelOptions - Options for Babel. + * @param {Object} options.functions - Functions to extract. Defaults are available as a static property `defaultFunctions`. + * @param {Function} options.lintLogger - Lint logging callback. See `this.setLintLogger()`. */ constructor( options = {} ) { this.#babelOptions = options.babelOptions || {}; @@ -54,7 +54,7 @@ class GettextExtractor { * * @param {string} file - File name. * @param {object} opts - Babel options. - * @returns {GettextEntries} Set of entries. + * @return {GettextEntries} Set of entries. */ async extractFromFile( file, opts = {} ) { const contents = await fs.readFile( file, { encoding: 'utf8' } ); @@ -65,8 +65,8 @@ class GettextExtractor { * Parse source. * * @param {string} source - JavaScript source. - * @param {object} opts - Babel options. - * @returns {babel.File} Babel File object. + * @param {object} opts - Babel options. + * @return {babel.File} Babel File object. */ async parse( source, opts = {} ) { const options = { ...this.#babelOptions, ...opts }; @@ -79,8 +79,8 @@ class GettextExtractor { * Extract gettext strings from source. * * @param {string} source - JavaScript source. - * @param {object} opts - Babel options. - * @returns {GettextEntries} Set of entries. + * @param {object} opts - Babel options. + * @return {GettextEntries} Set of entries. */ async extract( source, opts ) { return this.extractFromAst( await this.parse( source, opts ), opts ); @@ -90,8 +90,8 @@ class GettextExtractor { * Extract gettext strings from a Babel File object. * * @param {babel.File} file - Babel File object, e.g. from `this.parse()`. - * @param {object} opts - Babel options. - * @returns {GettextEntries} Set of entries. + * @param {object} opts - Babel options. + * @return {GettextEntries} Set of entries. */ extractFromAst( file, opts = {} ) { const entries = new GettextEntries(); @@ -101,11 +101,11 @@ class GettextExtractor { /** * Extract gettext strings from a Babel File object. * - * @param {babel.File} file - Babel File object, e.g. from `this.parse()`. - * @param {GettextEntries} entries - Entries object to fill in. - * @param {number|false} evalline - If this is a recursive call from an `eval()`, the line of the eval. - * @param {object} opts - Babel options. - * @returns {GettextEntries} `entries`. + * @param {babel.File} file - Babel File object, e.g. from `this.parse()`. + * @param {GettextEntries} entries - Entries object to fill in. + * @param {number|false} evalline - If this is a recursive call from an `eval()`, the line of the eval. + * @param {object} opts - Babel options. + * @return {GettextEntries} `entries`. */ #extractFromAst( file, entries, evalline, opts ) { const options = { ...this.#babelOptions, ...opts }; @@ -311,7 +311,7 @@ class GettextExtractor { * * @see https://github.com/wp-cli/i18n-command/blob/e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302/src/JsFunctionsScanner.php#L254 * @param {babel.CallExpression} node - CallExpression node. - * @returns {{ name: string, comments: string[] }|undefined} Callee name and comments, or undefined. + * @return {{ name: string, comments: string[] }|undefined} Callee name and comments, or undefined. */ #resolveExpressionCallee( node ) { const callee = node.callee; @@ -422,8 +422,8 @@ class GettextExtractor { * * @see https://github.com/wp-cli/i18n-command/blob/e9eef8aab4b5e43c3aa09bf60e1e7a9d6d30d302/src/JsFunctionsScanner.php#L364 * @param {babel.Comment} comment - Comment. - * @param {babel.Node} node - Node. - * @returns {boolean} Whether the comment comes before the node. + * @param {babel.Node} node - Node. + * @return {boolean} Whether the comment comes before the node. */ #commentPrecedesNode( comment, node ) { // Comments should be on the same or an earlier line than the translation. diff --git a/projects/js-packages/i18n-check-webpack-plugin/src/I18nCheckPlugin.js b/projects/js-packages/i18n-check-webpack-plugin/src/I18nCheckPlugin.js index 0d90fdabe4a8c..1309260725c9d 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/src/I18nCheckPlugin.js +++ b/projects/js-packages/i18n-check-webpack-plugin/src/I18nCheckPlugin.js @@ -127,8 +127,8 @@ class I18nCheckPlugin { * Record the resources for an asset. * * @param {webpack.Compilation} compilation - Compilation. - * @param {string} filename - Asset filename. - * @param {webpack.Module[]} modules - Modules in the asset. + * @param {string} filename - Asset filename. + * @param {webpack.Module[]} modules - Modules in the asset. */ #recordResourcesForAsset( compilation, filename, modules ) { const resources = new Set(); @@ -159,7 +159,7 @@ class I18nCheckPlugin { * Stringify an entry to msgid + context. * * @param {GettextEntry} entry - Entry. - * @returns {string} String. + * @return {string} String. */ #strentry( entry ) { let ret = '"' + entry.msgid.replace( /[\\"]/g, '\\$&' ).replaceAll( '\n', '\\n' ) + '"'; @@ -210,8 +210,8 @@ class I18nCheckPlugin { * Process an asset. * * @param {webpack.Compilation} compilation - Compilation. - * @param {string} filename - Asset filename. - * @param {Map} moduleCache - Cache for processed modules. + * @param {string} filename - Asset filename. + * @param {Map} moduleCache - Cache for processed modules. */ async #processAsset( compilation, filename, moduleCache ) { const t0 = Date.now(); diff --git a/projects/js-packages/i18n-check-webpack-plugin/src/I18nSafeMangleExportsPlugin.js b/projects/js-packages/i18n-check-webpack-plugin/src/I18nSafeMangleExportsPlugin.js index 5ba6b32dd8bf2..da868376a0580 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/src/I18nSafeMangleExportsPlugin.js +++ b/projects/js-packages/i18n-check-webpack-plugin/src/I18nSafeMangleExportsPlugin.js @@ -26,7 +26,7 @@ const { assignDeterministicIds } = require( 'webpack/lib/ids/IdHelpers' ); /** * Determine if we can mangle. * @param {ExportsInfo} exportsInfo - exports info - * @returns {boolean} mangle is possible + * @return {boolean} mangle is possible */ const canMangle = exportsInfo => { if ( exportsInfo.otherExportsInfo.getUsed( undefined ) !== UsageState.Unused ) { @@ -45,10 +45,10 @@ const canMangle = exportsInfo => { const comparator = compareSelect( e => e.name, compareStringsNumeric ); /** * Mangle exports. - * @param {boolean} deterministic - use deterministic names - * @param {ExportsInfo} exportsInfo - exports info - * @param {boolean | undefined} isNamespace - is namespace object - * @returns {void} + * @param {boolean} deterministic - use deterministic names + * @param {ExportsInfo} exportsInfo - exports info + * @param {boolean | undefined} isNamespace - is namespace object + * @return {void} */ const mangleExportsInfo = ( deterministic, exportsInfo, isNamespace ) => { if ( ! canMangle( exportsInfo ) ) { @@ -153,7 +153,7 @@ class MangleExportsPlugin { /** * Apply the plugin * @param {Compiler} compiler - the compiler instance - * @returns {void} + * @return {void} */ apply( compiler ) { const { _deterministic: deterministic } = this; diff --git a/projects/js-packages/i18n-check-webpack-plugin/tests/build.test.js b/projects/js-packages/i18n-check-webpack-plugin/tests/build.test.js index ae95ae46015fd..2665ce69ab5e5 100644 --- a/projects/js-packages/i18n-check-webpack-plugin/tests/build.test.js +++ b/projects/js-packages/i18n-check-webpack-plugin/tests/build.test.js @@ -9,7 +9,7 @@ const configFixtures = fs.readdirSync( fixturesPath ).sort(); * Find all files in a path. * * @param {string} dir - Path. - * @returns {string[]} Promise resolving to a list of files. + * @return {string[]} Promise resolving to a list of files. */ function lsFiles( dir ) { const ret = []; diff --git a/projects/js-packages/i18n-loader-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/i18n-loader-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/i18n-loader-webpack-plugin/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/i18n-loader-webpack-plugin/package.json b/projects/js-packages/i18n-loader-webpack-plugin/package.json index 12965e26eee2c..4d4319c074e47 100644 --- a/projects/js-packages/i18n-loader-webpack-plugin/package.json +++ b/projects/js-packages/i18n-loader-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/i18n-loader-webpack-plugin", - "version": "2.0.54", + "version": "2.0.55-alpha", "description": "A Webpack plugin to load WordPress i18n when Webpack lazy-loads a bundle.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/i18n-loader-webpack-plugin/#readme", "bugs": { diff --git a/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderPlugin.js b/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderPlugin.js index 2417c76c2e82a..4eb3974b915d4 100644 --- a/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderPlugin.js +++ b/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderPlugin.js @@ -148,7 +148,7 @@ class I18nLoaderPlugin { /** * Fetch stuff we need for the various callbacks. * - * @returns {object} Stuff. + * @return {object} Stuff. */ function getStuff() { const loaderModule = compilation.moduleGraph.getModule( loaderModuleDep ); diff --git a/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderRuntimeModule.js b/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderRuntimeModule.js index 413a9ea1887e2..d6dfc7d77ebbb 100644 --- a/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderRuntimeModule.js +++ b/projects/js-packages/i18n-loader-webpack-plugin/src/I18nLoaderRuntimeModule.js @@ -21,7 +21,7 @@ class I18nLoaderRuntimeModule extends webpack.RuntimeModule { * Get the path for a chunk. * * @param {webpack.Chunk} chunk - Chunk. - * @returns {string} Chunk path + * @return {string} Chunk path */ getChunkPath( chunk ) { const compilation = this.compilation; @@ -44,7 +44,7 @@ class I18nLoaderRuntimeModule extends webpack.RuntimeModule { /** * Get set of chunks we need to care about. * - * @returns {Set} Chunk IDs. + * @return {Set} Chunk IDs. */ getChunks() { const ret = new Set(); diff --git a/projects/js-packages/i18n-loader-webpack-plugin/tests/build.test.js b/projects/js-packages/i18n-loader-webpack-plugin/tests/build.test.js index 73011112c665d..54cf024e78d62 100644 --- a/projects/js-packages/i18n-loader-webpack-plugin/tests/build.test.js +++ b/projects/js-packages/i18n-loader-webpack-plugin/tests/build.test.js @@ -8,9 +8,9 @@ require( './globals' ); * Extract a section from a string. * * @param {string} content - String to extract from. - * @param {string} start - Starting line. - * @param {string} end - Line to end before. - * @returns {string|null} Section. + * @param {string} start - Starting line. + * @param {string} end - Line to end before. + * @return {string|null} Section. */ function extractSection( content, start, end ) { const s = content.indexOf( '\n' + start ); @@ -25,7 +25,7 @@ function extractSection( content, start, end ) { * Find all files in a path. * * @param {string} dir - Path. - * @returns {string[]} Promise resolving to a list of files. + * @return {string[]} Promise resolving to a list of files. */ function lsFiles( dir ) { const ret = []; diff --git a/projects/js-packages/i18n-loader-webpack-plugin/tests/globals.js b/projects/js-packages/i18n-loader-webpack-plugin/tests/globals.js index 70e2d97c0bb58..df1fb398b49dc 100644 --- a/projects/js-packages/i18n-loader-webpack-plugin/tests/globals.js +++ b/projects/js-packages/i18n-loader-webpack-plugin/tests/globals.js @@ -11,9 +11,9 @@ class I18nLoader { * Actually just returns a promise from `this.expect`, if any, * or throws an error. * - * @param {string} path - Path being "downloaded". + * @param {string} path - Path being "downloaded". * @param {string} domain - Text domain. - * @returns {Promise} Promise. + * @return {Promise} Promise. */ downloadI18n( path, domain ) { const ret = this.expect[ path ]; @@ -46,7 +46,7 @@ class I18nLoader { * Mock an error. * * @param {string} path - Path. - * @param {Error} err - Error. + * @param {Error} err - Error. */ expectError = ( path, err ) => { this.expect[ path ] = () => { diff --git a/projects/js-packages/idc/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/idc/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/idc/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/idc/components/card-fresh/index.jsx b/projects/js-packages/idc/components/card-fresh/index.jsx index 90cfb8f48a70c..055b019f6924d 100644 --- a/projects/js-packages/idc/components/card-fresh/index.jsx +++ b/projects/js-packages/idc/components/card-fresh/index.jsx @@ -14,7 +14,7 @@ import ErrorMessage from '../error-message'; * Render the error message. * * @param {string} supportURL - The support page URL. - * @returns {React.Component} The error message. + * @return {React.Component} The error message. */ const renderError = supportURL => { return ( @@ -49,7 +49,7 @@ const renderComparisonUrls = ( wpcomHostName, currentHostName ) => { * The "start fresh" card. * * @param {object} props - The properties. - * @returns {React.Component} The `ConnectScreen` component. + * @return {React.Component} The `ConnectScreen` component. */ const CardFresh = props => { const { diff --git a/projects/js-packages/idc/components/card-migrate/index.jsx b/projects/js-packages/idc/components/card-migrate/index.jsx index 9c719764dbf61..57f1e55e0710b 100644 --- a/projects/js-packages/idc/components/card-migrate/index.jsx +++ b/projects/js-packages/idc/components/card-migrate/index.jsx @@ -14,7 +14,7 @@ import ErrorMessage from '../error-message'; * Render the error message. * * @param {string} supportURL - The support page URL. - * @returns {React.Component} The error message. + * @return {React.Component} The error message. */ const renderError = supportURL => { return ( @@ -39,7 +39,7 @@ const renderError = supportURL => { * The "migrate" card. * * @param {object} props - The properties. - * @returns {React.Component} The `ConnectScreen` component. + * @return {React.Component} The `ConnectScreen` component. */ const CardMigrate = props => { const wpcomHostName = extractHostname( props.wpcomHomeUrl ); diff --git a/projects/js-packages/idc/components/idc-screen/index.jsx b/projects/js-packages/idc/components/idc-screen/index.jsx index 2ba3594bda4ac..054b4ecbb80d9 100644 --- a/projects/js-packages/idc/components/idc-screen/index.jsx +++ b/projects/js-packages/idc/components/idc-screen/index.jsx @@ -14,7 +14,7 @@ import IDCScreenVisual from './visual'; * The IDC screen component. * * @param {object} props - The properties. - * @returns {React.Component} The `ConnectScreen` component. + * @return {React.Component} The `ConnectScreen` component. */ const IDCScreen = props => { const { diff --git a/projects/js-packages/idc/components/idc-screen/screen-main.jsx b/projects/js-packages/idc/components/idc-screen/screen-main.jsx index 098a11c8d3f28..8203832de09c8 100644 --- a/projects/js-packages/idc/components/idc-screen/screen-main.jsx +++ b/projects/js-packages/idc/components/idc-screen/screen-main.jsx @@ -13,7 +13,7 @@ import SafeMode from '../safe-mode'; * Retrieve the main screen body. * * @param {object} props - The properties. - * @returns {React.Component} The ScreenMain component. + * @return {React.Component} The ScreenMain component. */ const ScreenMain = props => { const { diff --git a/projects/js-packages/idc/components/idc-screen/screen-migrated.jsx b/projects/js-packages/idc/components/idc-screen/screen-migrated.jsx index abcc5dd7094e5..3237deee40526 100644 --- a/projects/js-packages/idc/components/idc-screen/screen-migrated.jsx +++ b/projects/js-packages/idc/components/idc-screen/screen-migrated.jsx @@ -11,7 +11,7 @@ import extractHostname from '../../tools/extract-hostname'; * Retrieve the migrated screen body. * * @param {object} props - The properties. - * @returns {React.Component} The ScreenMigrated component. + * @return {React.Component} The ScreenMigrated component. */ const ScreenMigrated = props => { const { finishCallback = () => {}, isFinishing = false, customContent = {} } = props; diff --git a/projects/js-packages/idc/components/idc-screen/screen-non-admin.jsx b/projects/js-packages/idc/components/idc-screen/screen-non-admin.jsx index 9784f244dd574..c78c3d4dc1f67 100644 --- a/projects/js-packages/idc/components/idc-screen/screen-non-admin.jsx +++ b/projects/js-packages/idc/components/idc-screen/screen-non-admin.jsx @@ -9,7 +9,7 @@ import customContentShape from '../../tools/custom-content-shape'; * Retrieve the main screen body. * * @param {object} props - The properties. - * @returns {React.Component} The ScreenMain component. + * @return {React.Component} The ScreenMain component. */ const ScreenNonAdmin = props => { const { customContent = {} } = props; diff --git a/projects/js-packages/idc/components/safe-mode/index.jsx b/projects/js-packages/idc/components/safe-mode/index.jsx index d021f44c5c8bd..db15094424d8d 100644 --- a/projects/js-packages/idc/components/safe-mode/index.jsx +++ b/projects/js-packages/idc/components/safe-mode/index.jsx @@ -17,9 +17,9 @@ import './style.scss'; /** * Render the "Stay safe" button. * - * @param {Function} callback - Button click callback. - * @param {boolean} isDisabled - Whether the button should be disabled. - * @returns {React.Component} - The rendered output. + * @param {Function} callback - Button click callback. + * @param {boolean} isDisabled - Whether the button should be disabled. + * @return {React.Component} - The rendered output. */ const renderStaySafeButton = ( callback, isDisabled ) => { @@ -41,7 +41,7 @@ const renderStaySafeButton = ( callback, isDisabled ) => { /** * Render the "staying safe" line. * - * @returns {React.Component} - The rendered output. + * @return {React.Component} - The rendered output. */ const renderStayingSafe = () => { return ( @@ -56,7 +56,7 @@ const renderStayingSafe = () => { * Render the error message. * * @param {string} supportURL - The support page URL. - * @returns {React.Component} The error message. + * @return {React.Component} The error message. */ const renderError = supportURL => { return ( diff --git a/projects/js-packages/idc/hooks/use-migration-finished.jsx b/projects/js-packages/idc/hooks/use-migration-finished.jsx index 4b4582833474d..b76afa51f4b7f 100644 --- a/projects/js-packages/idc/hooks/use-migration-finished.jsx +++ b/projects/js-packages/idc/hooks/use-migration-finished.jsx @@ -3,7 +3,7 @@ import { useCallback, useState } from 'react'; /** * Custom hook to handle finishing migration action. * - * @returns {{isFinishingMigration: boolean, finishMigrationCallback: ((function(): void)|*)}} Hook values. + * @return {{isFinishingMigration: boolean, finishMigrationCallback: ((function(): void)|*)}} Hook values. */ export default () => { const [ isFinishingMigration, setIsFinishingMigration ] = useState( false ); diff --git a/projects/js-packages/idc/hooks/use-migration.jsx b/projects/js-packages/idc/hooks/use-migration.jsx index c1b0dcfeb649d..15c2e3420bc33 100644 --- a/projects/js-packages/idc/hooks/use-migration.jsx +++ b/projects/js-packages/idc/hooks/use-migration.jsx @@ -8,7 +8,7 @@ import trackAndBumpMCStats from '../tools/tracking'; * Custom hook to handle the migration action. * * @param {Function} onMigrated - The callback to be called when migration has completed. - * @returns {{isMigrating: boolean, migrateCallback: ((function(): void)|*)}} Hook values. + * @return {{isMigrating: boolean, migrateCallback: ((function(): void)|*)}} Hook values. */ export default onMigrated => { const [ isMigrating, setIsMigrating ] = useState( false ); diff --git a/projects/js-packages/idc/hooks/use-start-fresh.jsx b/projects/js-packages/idc/hooks/use-start-fresh.jsx index 34a03e14d9561..7016511c7a305 100644 --- a/projects/js-packages/idc/hooks/use-start-fresh.jsx +++ b/projects/js-packages/idc/hooks/use-start-fresh.jsx @@ -8,7 +8,7 @@ import trackAndBumpMCStats from '../tools/tracking'; * Custom hook to handle the migration action. * * @param {string} redirectUri - WP-admin URI to redirect user to after reconnecting. - * @returns {{isStartingFresh: boolean, startFreshCallback: ((function(): void)|*)}} Hook values. + * @return {{isStartingFresh: boolean, startFreshCallback: ((function(): void)|*)}} Hook values. */ export default redirectUri => { const [ isStartingFresh, setIsStartingFresh ] = useState( false ); diff --git a/projects/js-packages/idc/package.json b/projects/js-packages/idc/package.json index 0da320891618e..e3a31d634b825 100644 --- a/projects/js-packages/idc/package.json +++ b/projects/js-packages/idc/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-idc", - "version": "0.11.7", + "version": "0.11.8-alpha", "description": "Jetpack Connection Component", "author": "Automattic", "license": "GPL-2.0-or-later", diff --git a/projects/js-packages/idc/tools/extract-hostname.jsx b/projects/js-packages/idc/tools/extract-hostname.jsx index 8563f11abe37b..5b99fd4132dea 100644 --- a/projects/js-packages/idc/tools/extract-hostname.jsx +++ b/projects/js-packages/idc/tools/extract-hostname.jsx @@ -2,7 +2,7 @@ * Extract hostname from an URL if needed. * * @param {string} url - The URL to extract hostname from. - * @returns {string} The hostname extracted from the URL. + * @return {string} The hostname extracted from the URL. */ const extractHostname = url => /^https?:\/\//.test( url ) ? new URL( url ).hostname : url.replace( /\/$/, '' ); diff --git a/projects/js-packages/idc/tools/tracking.jsx b/projects/js-packages/idc/tools/tracking.jsx index 8f405fe4d725a..37af2592521ea 100644 --- a/projects/js-packages/idc/tools/tracking.jsx +++ b/projects/js-packages/idc/tools/tracking.jsx @@ -4,7 +4,7 @@ import analytics from '@automattic/jetpack-analytics'; * Initialize the analytics object. * * @param {object} tracksEventData - Tracks data. - * @param {object} tracksUserData - User data. + * @param {object} tracksUserData - User data. */ export function initializeAnalytics( tracksEventData, tracksUserData ) { if ( @@ -35,7 +35,7 @@ export function initializeAnalytics( tracksEventData, tracksUserData ) { * Tracks Will be prefixed by 'jetpack_idc_' and use underscores. * MC Will not be prefixed, and will use dashes. * - * @param {string} eventName - name. + * @param {string} eventName - name. * @param {object} extraProps - extra props. */ export default function trackAndBumpMCStats( eventName, extraProps = {} ) { diff --git a/projects/js-packages/licensing/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/licensing/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/licensing/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/licensing/components/activation-screen-controls/index.jsx b/projects/js-packages/licensing/components/activation-screen-controls/index.jsx index 37f455e0ef6c0..fa5cb83509285 100644 --- a/projects/js-packages/licensing/components/activation-screen-controls/index.jsx +++ b/projects/js-packages/licensing/components/activation-screen-controls/index.jsx @@ -12,12 +12,12 @@ import './style.scss'; /** * The Activation Screen Controls component. * - * @param {object} props -- The properties. + * @param {object} props -- The properties. * @param {Function} props.className -- class name of the input control. - * @param {boolean} props.disabled -- determines if input control is disabled. - * @param {string} props.value -- the license code to edit or submit - * @param {Function} props.onChange -- function to handle changes to the value. - * @returns {React.Component} The `ManualLicenseKeyInput` component. + * @param {boolean} props.disabled -- determines if input control is disabled. + * @param {string} props.value -- the license code to edit or submit + * @param {Function} props.onChange -- function to handle changes to the value. + * @return {React.Component} The `ManualLicenseKeyInput` component. */ const ManualLicenseKeyInput = props => { const { className, disabled, onChange, value } = props; @@ -36,13 +36,13 @@ const ManualLicenseKeyInput = props => { /** * The Activation Screen Controls component. * - * @param {object} props -- The properties. - * @param {Function} props.className -- class name of the input control. - * @param {Array} props.availableLicenses -- list of available license keys for activation. - * @param {boolean} props.disabled -- determines if input control is disabled. - * @param {string} props.value -- the license code to edit or submit - * @param {Function} props.onChange -- function to handle changes to the value. - * @returns {React.Component} The `SelectableLicenseKeyInput` component. + * @param {object} props -- The properties. + * @param {Function} props.className -- class name of the input control. + * @param {Array} props.availableLicenses -- list of available license keys for activation. + * @param {boolean} props.disabled -- determines if input control is disabled. + * @param {string} props.value -- the license code to edit or submit + * @param {Function} props.onChange -- function to handle changes to the value. + * @return {React.Component} The `SelectableLicenseKeyInput` component. */ const SelectableLicenseKeyInput = props => { const { className, availableLicenses, disabled, onChange, value } = props; @@ -121,16 +121,16 @@ const SelectableLicenseKeyInput = props => { /** * The Activation Screen Controls component. * - * @param {object} props -- The properties. - * @param {Function} props.activateLicense -- function to handle submitting a license - * @param {Array} props.availableLicenses -- list of available license keys for activation. - * @param {boolean} props.fetchingAvailableLicenses -- status to determine if the screen is fetching available license keys. - * @param {boolean} props.isActivating -- should the controls be disabled - * @param {string} props.license -- the license code to edit or submit - * @param {?string} props.licenseError -- any error that occurred while activating a license - * @param {Function} props.onLicenseChange -- function to handle changes to license - * @param {string} props.siteUrl -- the url of the site - * @returns {React.Component} The `ActivationScreenControls` component. + * @param {object} props -- The properties. + * @param {Function} props.activateLicense -- function to handle submitting a license + * @param {Array} props.availableLicenses -- list of available license keys for activation. + * @param {boolean} props.fetchingAvailableLicenses -- status to determine if the screen is fetching available license keys. + * @param {boolean} props.isActivating -- should the controls be disabled + * @param {string} props.license -- the license code to edit or submit + * @param {?string} props.licenseError -- any error that occurred while activating a license + * @param {Function} props.onLicenseChange -- function to handle changes to license + * @param {string} props.siteUrl -- the url of the site + * @return {React.Component} The `ActivationScreenControls` component. */ const ActivationScreenControls = props => { const { diff --git a/projects/js-packages/licensing/components/activation-screen-illustration/index.jsx b/projects/js-packages/licensing/components/activation-screen-illustration/index.jsx index 83114ef53fc51..c2451f53efe51 100644 --- a/projects/js-packages/licensing/components/activation-screen-illustration/index.jsx +++ b/projects/js-packages/licensing/components/activation-screen-illustration/index.jsx @@ -9,10 +9,10 @@ import './style.scss'; /** * The Activation Screen Illustration component. * - * @param {object} props -- The properties. - * @param {string} props.imageUrl -- The assets base URL. + * @param {object} props -- The properties. + * @param {string} props.imageUrl -- The assets base URL. * @param {boolean} props.showSupportLink -- The assets base URL. - * @returns {React.Component} The `ActivationScreenIllustration` component. + * @return {React.Component} The `ActivationScreenIllustration` component. */ const ActivationScreenIllustration = props => { const { imageUrl, showSupportLink = false } = props; diff --git a/projects/js-packages/licensing/components/activation-screen-success-info/index.jsx b/projects/js-packages/licensing/components/activation-screen-success-info/index.jsx index 7f73bb4c9b24f..5a5e6c81910ca 100644 --- a/projects/js-packages/licensing/components/activation-screen-success-info/index.jsx +++ b/projects/js-packages/licensing/components/activation-screen-success-info/index.jsx @@ -10,12 +10,12 @@ import './style.scss'; /** * The Activation Screen Illustration component. * - * @param {object} props -- The properties. - * @param {number} props.productId -- The id of the product activated - * @param {string} props.siteRawUrl -- The url of the site - * @param {string} props.siteAdminUrl -- URL of the Jetpack Site Admin + * @param {object} props -- The properties. + * @param {number} props.productId -- The id of the product activated + * @param {string} props.siteRawUrl -- The url of the site + * @param {string} props.siteAdminUrl -- URL of the Jetpack Site Admin * @param {string} props.currentRecommendationsStep -- The current recommendation step - * @returns {React.Component} The `ActivationSuccessInfo` component. + * @return {React.Component} The `ActivationSuccessInfo` component. */ const ActivationSuccessInfo = props => { const { productId, siteRawUrl, siteAdminUrl, currentRecommendationsStep } = props; diff --git a/projects/js-packages/licensing/components/activation-screen-success-info/product-details/index.js b/projects/js-packages/licensing/components/activation-screen-success-info/product-details/index.js index e0c6107537bfb..7bbecf07e52b8 100644 --- a/projects/js-packages/licensing/components/activation-screen-success-info/product-details/index.js +++ b/projects/js-packages/licensing/components/activation-screen-success-info/product-details/index.js @@ -10,10 +10,10 @@ import './style.scss'; /** * The Jetpack Product Details component. * - * @param {object} props -- The properties. - * @param {number} props.productId -- The id of the product + * @param {object} props -- The properties. + * @param {number} props.productId -- The id of the product * @param {string} props.siteRawUrl -- The url of the site - * @returns {React.Component} The `JetpackProductDetails` component. + * @return {React.Component} The `JetpackProductDetails` component. */ const JetpackProductDetails = props => { const { productId, siteRawUrl } = props; diff --git a/projects/js-packages/licensing/components/activation-screen/index.jsx b/projects/js-packages/licensing/components/activation-screen/index.jsx index 970cecec545a0..760850f332fae 100644 --- a/projects/js-packages/licensing/components/activation-screen/index.jsx +++ b/projects/js-packages/licensing/components/activation-screen/index.jsx @@ -17,7 +17,7 @@ import './style.scss'; * attachLicenses has a particular result, which we reduce to the parts we care about here * * @param {(object|Array)} result -- the result from the attachLicenses request - * @returns {number} The activatedProductId from the result + * @return {number} The activatedProductId from the result * @throws Errors either from the API response or from any issues parsing the response */ const parseAttachLicensesResult = result => { @@ -45,14 +45,14 @@ const parseAttachLicensesResult = result => { /** * The Activation Screen component. * - * @param {object} props -- The properties. - * @param {Function?} props.onActivationSuccess -- A function to call on success. - * @param {string} props.siteRawUrl -- url of the Jetpack Site - * @param {string?} props.startingLicense -- pre-fill the license value - * @param {string} props.siteAdminUrl -- URL of the Jetpack Site Admin - * @param {string} props.currentRecommendationsStep -- The current recommendation step. - * @param {string} props.currentUser -- Current wpcom user info. - * @returns {React.Component} The `ActivationScreen` component. + * @param {object} props -- The properties. + * @param {Function?} props.onActivationSuccess -- A function to call on success. + * @param {string} props.siteRawUrl -- url of the Jetpack Site + * @param {string?} props.startingLicense -- pre-fill the license value + * @param {string} props.siteAdminUrl -- URL of the Jetpack Site Admin + * @param {string} props.currentRecommendationsStep -- The current recommendation step. + * @param {string} props.currentUser -- Current wpcom user info. + * @return {React.Component} The `ActivationScreen` component. */ const ActivationScreen = props => { const { diff --git a/projects/js-packages/licensing/components/activation-screen/utils.js b/projects/js-packages/licensing/components/activation-screen/utils.js index 46428a18dfc43..f11d7b04117f5 100644 --- a/projects/js-packages/licensing/components/activation-screen/utils.js +++ b/projects/js-packages/licensing/components/activation-screen/utils.js @@ -55,7 +55,7 @@ const PRODUCT_GROUPS = { * Get the group of a product given a product Id. * * @param {number} productId -- The id of the product - * @returns {string} The group of the product. + * @return {string} The group of the product. */ export function getProductGroup( productId ) { return ( diff --git a/projects/js-packages/licensing/components/golden-token-modal/index.jsx b/projects/js-packages/licensing/components/golden-token-modal/index.jsx index 6b5bae9fd2838..5cc4c01896c03 100644 --- a/projects/js-packages/licensing/components/golden-token-modal/index.jsx +++ b/projects/js-packages/licensing/components/golden-token-modal/index.jsx @@ -21,12 +21,12 @@ const onModalCloseDefault = event => { /** * Component that displays a golden token experience. * - * @param {object} props - Component props. - * @param {Function} props.redeemClick - Callback function to handle redeem click. - * @param {object} props.displayName - Connected user data. - * @param {Function} props.onModalClose - Callback function to handle module closure. + * @param {object} props - Component props. + * @param {Function} props.redeemClick - Callback function to handle redeem click. + * @param {object} props.displayName - Connected user data. + * @param {Function} props.onModalClose - Callback function to handle module closure. * @param {Function} props.tokenRedeemed - If their token is already redeemed. - * @returns {React.Component} - GoldenToken component. + * @return {React.Component} - GoldenToken component. */ function GoldenTokenModal( { redeemClick, diff --git a/projects/js-packages/licensing/hooks/use-active-plugins/index.js b/projects/js-packages/licensing/hooks/use-active-plugins/index.js index 2e9ec2c28a751..5b6cecc669e35 100644 --- a/projects/js-packages/licensing/hooks/use-active-plugins/index.js +++ b/projects/js-packages/licensing/hooks/use-active-plugins/index.js @@ -9,7 +9,7 @@ const fetchActivePlugins = async () => { /** * Hook to handle retrieving dismissed notices and dismissing a notice. * - * @returns {Array} An array of active plugins. + * @return {Array} An array of active plugins. */ export default function useActivePlugins() { const [ activePlugins, setActivePlugins ] = useState( [] ); diff --git a/projects/js-packages/partner-coupon/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/partner-coupon/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/partner-coupon/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/partner-coupon/components/redeem-partner-coupon-post-connection/index.jsx b/projects/js-packages/partner-coupon/components/redeem-partner-coupon-post-connection/index.jsx index 3af8837d37225..bbf63d5bd88de 100644 --- a/projects/js-packages/partner-coupon/components/redeem-partner-coupon-post-connection/index.jsx +++ b/projects/js-packages/partner-coupon/components/redeem-partner-coupon-post-connection/index.jsx @@ -15,7 +15,7 @@ export const DISMISS_LS_ITEM_MAX_AGE = 3 * 24 * 60 * 60; // 3 days /** * Is partner coupon redeem CTA dismissed? * - * @returns {boolean} Is the redeem CTA dismissed? + * @return {boolean} Is the redeem CTA dismissed? */ function isDismissed() { const dismissedAt = localStorage.getItem( DISMISS_LS_ITEM_NAME ); @@ -33,7 +33,7 @@ function isDismissed() { /** * Dismiss partner coupon redeem CTA. * - * @returns {void} + * @return {void} */ function dismiss() { localStorage.setItem( DISMISS_LS_ITEM_NAME, new Date().getTime() ); diff --git a/projects/js-packages/partner-coupon/hooks.js b/projects/js-packages/partner-coupon/hooks.js index 9f8b5fcdcfd8c..da6edcfd21459 100644 --- a/projects/js-packages/partner-coupon/hooks.js +++ b/projects/js-packages/partner-coupon/hooks.js @@ -4,12 +4,12 @@ import { useCallback, useEffect } from 'react'; /** * Handle partner coupon redeem analytics and clicks. * - * @param {object} partnerCoupon - Partner coupon details. - * @param {string} siteRawUrl - Site's raw URL. - * @param {object} connectionStatus - Connection status. - * @param {boolean} tracksUserData - Should we track user data. - * @param {object} analytics - Analytics. - * @returns {Function} Click handler for coupon redemption. + * @param {object} partnerCoupon - Partner coupon details. + * @param {string} siteRawUrl - Site's raw URL. + * @param {object} connectionStatus - Connection status. + * @param {boolean} tracksUserData - Should we track user data. + * @param {object} analytics - Analytics. + * @return {Function} Click handler for coupon redemption. */ export function usePartnerCouponRedemption( partnerCoupon, diff --git a/projects/js-packages/publicize-components/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/publicize-components/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/publicize-components/src/components/connection-management/connection-info.tsx b/projects/js-packages/publicize-components/src/components/connection-management/connection-info.tsx index 1b64fab0a5727..eb86600155cd4 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/connection-info.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/connection-info.tsx @@ -17,7 +17,7 @@ type ConnectionInfoProps = ConnectionStatusProps; * * @param {ConnectionInfoProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function ConnectionInfo( { connection, service }: ConnectionInfoProps ) { const [ isPanelOpen, togglePanel ] = useReducer( state => ! state, false ); diff --git a/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx b/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx index c77ab0ee8baf8..5259df0d9ea5b 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/connection-name.tsx @@ -14,7 +14,7 @@ type ConnectionNameProps = { * * @param {ConnectionNameProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function ConnectionName( { connection }: ConnectionNameProps ) { const isUpdating = useSelect( diff --git a/projects/js-packages/publicize-components/src/components/connection-management/connection-status.tsx b/projects/js-packages/publicize-components/src/components/connection-management/connection-status.tsx index 03177f511a97b..b8a3f254ae643 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/connection-status.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/connection-status.tsx @@ -17,7 +17,7 @@ export type ConnectionStatusProps = { * * @param {ConnectionStatusProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function ConnectionStatus( { connection, service }: ConnectionStatusProps ) { if ( connection.status !== 'broken' ) { diff --git a/projects/js-packages/publicize-components/src/components/connection-management/disconnect.tsx b/projects/js-packages/publicize-components/src/components/connection-management/disconnect.tsx index c41a1ba2ec2c3..c4629fcd89912 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/disconnect.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/disconnect.tsx @@ -18,7 +18,7 @@ export type DisconnectProps = { * * @param {DisconnectProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function Disconnect( { connection, diff --git a/projects/js-packages/publicize-components/src/components/connection-management/mark-as-shared.tsx b/projects/js-packages/publicize-components/src/components/connection-management/mark-as-shared.tsx index 2c959957e33f1..913a1c9b2016f 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/mark-as-shared.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/mark-as-shared.tsx @@ -14,7 +14,7 @@ type MarkAsSharedProps = { * * @param {MarkAsSharedProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function MarkAsShared( { connection }: MarkAsSharedProps ) { const { updateConnectionById } = useDispatch( socialStore ); diff --git a/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx b/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx index 7dedd9865b39d..107fdc5240c10 100644 --- a/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx +++ b/projects/js-packages/publicize-components/src/components/connection-management/reconnect.tsx @@ -18,7 +18,7 @@ export type ReconnectProps = { * * @param {ReconnectProps} props - component props * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function Reconnect( { connection, service, variant = 'link' }: ReconnectProps ) { const { deleteConnectionById, setKeyringResult, openConnectionsModal, setReconnectingAccount } = diff --git a/projects/js-packages/publicize-components/src/components/connection/index.js b/projects/js-packages/publicize-components/src/components/connection/index.js index fbc3878fb5d45..9e5f895645f0d 100644 --- a/projects/js-packages/publicize-components/src/components/connection/index.js +++ b/projects/js-packages/publicize-components/src/components/connection/index.js @@ -20,7 +20,7 @@ class PublicizeConnection extends Component { * Displays a message when a connection requires reauthentication. We used this when migrating LinkedIn API usage from v1 to v2, * since the prevous OAuth1 tokens were incompatible with OAuth2. * - * @returns {object|?null} Notice about reauthentication + * @return {object|?null} Notice about reauthentication */ maybeDisplayLinkedInNotice = () => this.connectionNeedsReauth() && ( @@ -44,7 +44,7 @@ class PublicizeConnection extends Component { /** * Check whether the connection needs to be reauthenticated. * - * @returns {boolean} True if connection must be reauthenticated. + * @return {boolean} True if connection must be reauthenticated. */ connectionNeedsReauth = () => this.props.mustReauthConnections.includes( this.props.name ); diff --git a/projects/js-packages/publicize-components/src/components/form/enabled-connections-notice.tsx b/projects/js-packages/publicize-components/src/components/form/enabled-connections-notice.tsx index 182e347dce6d9..b6d54baffb036 100644 --- a/projects/js-packages/publicize-components/src/components/form/enabled-connections-notice.tsx +++ b/projects/js-packages/publicize-components/src/components/form/enabled-connections-notice.tsx @@ -8,7 +8,7 @@ import { useConnectionState } from './use-connection-state'; /** * Displays enabled connections text. * - * @returns {import('react').ReactElement} Enabled connections text. + * @return {import('react').ReactElement} Enabled connections text. */ export function EnabledConnectionsNotice() { const { enabledConnections } = useSocialMediaConnections(); diff --git a/projects/js-packages/publicize-components/src/components/form/index.tsx b/projects/js-packages/publicize-components/src/components/form/index.tsx index be2d793c06f0d..5d0f342b3326b 100644 --- a/projects/js-packages/publicize-components/src/components/form/index.tsx +++ b/projects/js-packages/publicize-components/src/components/form/index.tsx @@ -22,7 +22,7 @@ import { SharePostForm } from './share-post-form'; /** * The Publicize form component. It contains the connection list, and the message box. * - * @returns {object} - Publicize form component. + * @return {object} - Publicize form component. */ export default function PublicizeForm() { const { hasConnections, hasEnabledConnections } = useSocialMediaConnections(); diff --git a/projects/js-packages/publicize-components/src/components/form/settings-button.tsx b/projects/js-packages/publicize-components/src/components/form/settings-button.tsx index 8f591da12a2f7..cfc80641df4be 100644 --- a/projects/js-packages/publicize-components/src/components/form/settings-button.tsx +++ b/projects/js-packages/publicize-components/src/components/form/settings-button.tsx @@ -21,7 +21,7 @@ type SettingsButtonProps = { * * @param {SettingsButtonProps} props - The component props. * - * @returns {import('react').ReactNode} The button/link component. + * @return {import('react').ReactNode} The button/link component. */ export function SettingsButton( { label, variant = 'primary' }: SettingsButtonProps ) { const { useAdminUiV1, connections } = useSelect( select => { diff --git a/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx b/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx index 668c9bc33e9d5..92794ff64f661 100644 --- a/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx +++ b/projects/js-packages/publicize-components/src/components/form/share-post-form.tsx @@ -9,9 +9,9 @@ type SharePostFormProps = { /** * The SharePostForm component. - * @param {object} props - The component props. + * @param {object} props - The component props. * @param {object} [props.analyticsData] - Data for tracking analytics. - * @returns {object} The SharePostForm component. + * @return {object} The SharePostForm component. */ export const SharePostForm: React.FC< SharePostFormProps > = ( { analyticsData = null } ) => { const { message, updateMessage, maxLength } = useSocialMediaMessage(); diff --git a/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts b/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts index 56ae6f3d234dc..9fd4daea5e49d 100644 --- a/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts +++ b/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts @@ -6,7 +6,7 @@ import { useCallback } from '@wordpress/element'; * Hook to handle autosaving and redirecting to a new page. * It can be used a click handler for links. * - * @returns {Function} Function to handle autosaving and redirecting. + * @return {Function} Function to handle autosaving and redirecting. */ export function useAutoSaveAndRedirect(): React.DOMAttributes< HTMLAnchorElement >[ 'onClick' ] { const { isEditedPostDirty } = useSelect( editorStore, [] ); diff --git a/projects/js-packages/publicize-components/src/components/generated-image-preview/index.js b/projects/js-packages/publicize-components/src/components/generated-image-preview/index.js index 929476c5663fb..ff6dc4de988ec 100644 --- a/projects/js-packages/publicize-components/src/components/generated-image-preview/index.js +++ b/projects/js-packages/publicize-components/src/components/generated-image-preview/index.js @@ -34,8 +34,8 @@ export const calculateImageUrl = ( imageType, customImageId, featuredImageId, ge * Fetches the preview of the generated image based on the post info * * @param {{shouldDebounce:boolean, customText: string, imageType: string, imageId: number, template: string}} props - - * The props to pass to the generator config. Contains the imageType, imageId, template and customText. Also contains boolean shouldDebounce. - * @returns {React.ReactNode} The generated image preview. + * The props to pass to the generator config. Contains the imageType, imageId, template and customText. Also contains boolean shouldDebounce. + * @return {React.ReactNode} The generated image preview. */ export default function GeneratedImagePreview( { shouldDebounce = true, diff --git a/projects/js-packages/publicize-components/src/components/generated-image-preview/utils.js b/projects/js-packages/publicize-components/src/components/generated-image-preview/utils.js index 52bfd422cce90..77e5fcd8f736b 100644 --- a/projects/js-packages/publicize-components/src/components/generated-image-preview/utils.js +++ b/projects/js-packages/publicize-components/src/components/generated-image-preview/utils.js @@ -4,7 +4,7 @@ import { getRedirectUrl } from '@automattic/jetpack-components'; * Returns the URL to the image generated by the Social Image Generator. * * @param {string} token - The token for the image. - * @returns {string} - The URL to the image. + * @return {string} - The URL to the image. */ export function getSigImageUrl( token ) { return token ? getRedirectUrl( 'sigenerate', { query: `t=${ token }` } ) : ''; diff --git a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx index 820bc1bee8afa..7d22a15c6d11a 100644 --- a/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manage-connections-modal/confirmation-form/index.tsx @@ -30,7 +30,7 @@ type AccountInfoProps = { * * @param {AccountInfoProps} props - Component props * - * @returns {import('react').ReactNode} Account info component + * @return {import('react').ReactNode} Account info component */ function AccountInfo( { label, profile_picture }: AccountInfoProps ) { return ( @@ -48,7 +48,7 @@ function AccountInfo( { label, profile_picture }: AccountInfoProps ) { * * @param {ConfirmationFormProps} props - Component props * - * @returns {import('react').ReactNode} Connection confirmation component + * @return {import('react').ReactNode} Connection confirmation component */ export function ConfirmationForm( { keyringResult, onComplete, isAdmin }: ConfirmationFormProps ) { const supportedServices = useSupportedServices(); diff --git a/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx b/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx index c3798ba561947..129dcbc54d9ba 100644 --- a/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manage-connections-modal/index.tsx @@ -92,7 +92,7 @@ export const ManageConnectionsModal = () => { * * This component can be used to avoid dealing with modal state management. * - * @returns {import('react').ReactNode} - React element + * @return {import('react').ReactNode} - React element */ export function ThemedConnectionsModal() { const shouldModalBeOpen = useSelect( select => { diff --git a/projects/js-packages/publicize-components/src/components/manual-sharing/index.tsx b/projects/js-packages/publicize-components/src/components/manual-sharing/index.tsx index bcda5b41bc836..e0301a09a4b77 100644 --- a/projects/js-packages/publicize-components/src/components/manual-sharing/index.tsx +++ b/projects/js-packages/publicize-components/src/components/manual-sharing/index.tsx @@ -12,7 +12,7 @@ export type ManualSharingProps = ManualSharingInfoProps; * * @param {ManualSharingProps} props - Component props. * - * @returns {import('react').ReactNode} Manual sharing component. + * @return {import('react').ReactNode} Manual sharing component. */ export function ManualSharing( props: ManualSharingProps ) { return ( diff --git a/projects/js-packages/publicize-components/src/components/manual-sharing/info.tsx b/projects/js-packages/publicize-components/src/components/manual-sharing/info.tsx index 3849cc740eae7..8ab59cbd50ab2 100644 --- a/projects/js-packages/publicize-components/src/components/manual-sharing/info.tsx +++ b/projects/js-packages/publicize-components/src/components/manual-sharing/info.tsx @@ -9,7 +9,7 @@ export type ManualSharingInfoProps = React.ComponentPropsWithoutRef< typeof Text * * @param {ManualSharingInfoProps} props - Component props. * - * @returns {import('react').ReactNode} Manual sharing information component. + * @return {import('react').ReactNode} Manual sharing information component. */ export function ManualSharingInfo( { ...textProps }: ManualSharingInfoProps ) { return ( diff --git a/projects/js-packages/publicize-components/src/components/media-picker/index.js b/projects/js-packages/publicize-components/src/components/media-picker/index.js index f71ccf3e88bb9..2ad260ce709f1 100644 --- a/projects/js-packages/publicize-components/src/components/media-picker/index.js +++ b/projects/js-packages/publicize-components/src/components/media-picker/index.js @@ -20,15 +20,15 @@ const clickHandler = open => e => { /** * Wrapper that handles media-related functionality. * - * @param {object} props - Props for the Media Picker - * @param {string} props.buttonLabel - Label for the button of the picker - * @param {string} props.subTitle - Alt text under the button - * @param {number} props.mediaId - The ID of the currently selected media - * @param {object} props.mediaDetails - The details of the media for preview - * @param {Function} props.onChange - A callback that can be passed to parent for validation - * @param {string} props.wrapperClassName - A class name to be added to the wrapper - * @param {object} props.allowedMediaTypes - Custom allowed media types - * @returns {object} The media section. + * @param {object} props - Props for the Media Picker + * @param {string} props.buttonLabel - Label for the button of the picker + * @param {string} props.subTitle - Alt text under the button + * @param {number} props.mediaId - The ID of the currently selected media + * @param {object} props.mediaDetails - The details of the media for preview + * @param {Function} props.onChange - A callback that can be passed to parent for validation + * @param {string} props.wrapperClassName - A class name to be added to the wrapper + * @param {object} props.allowedMediaTypes - Custom allowed media types + * @return {object} The media section. */ export default function MediaPicker( { buttonLabel, diff --git a/projects/js-packages/publicize-components/src/components/media-picker/test/index.test.js b/projects/js-packages/publicize-components/src/components/media-picker/test/index.test.js index f6c55d17b09ce..1eac35fa2183f 100644 --- a/projects/js-packages/publicize-components/src/components/media-picker/test/index.test.js +++ b/projects/js-packages/publicize-components/src/components/media-picker/test/index.test.js @@ -41,7 +41,7 @@ jest.spyOn( window.HTMLMediaElement.prototype, 'pause' ).mockImplementation( () * Helper method to set up the user event. * * @param {ReactElement} jsx - The element to render. - * @returns {object} An object with the user method and everything from the render method. + * @return {object} An object with the user method and everything from the render method. */ const setup = async jsx => ( { user: await userEvent.setup(), diff --git a/projects/js-packages/publicize-components/src/components/media-section/index.js b/projects/js-packages/publicize-components/src/components/media-section/index.js index 46e9b70495acc..7b21a83888dd9 100644 --- a/projects/js-packages/publicize-components/src/components/media-section/index.js +++ b/projects/js-packages/publicize-components/src/components/media-section/index.js @@ -13,12 +13,12 @@ const ADD_MEDIA_LABEL = __( 'Choose Media', 'jetpack' ); /** * Wrapper that handles media-related functionality. * - * @param {object} props - The properties passed to the component. - * @param {boolean} [props.disabled=false] - Indicates whether the MediaSection is disabled or not. - * @param {string} [props.disabledNoticeMessage=''] - An optional notice that's displayed when the section is disabled. - * @param {import('react').ReactNode} [props.CustomNotice=null] - An optional custom notice that's displayed. - * @param {object} [props.analyticsData] - Data for tracking analytics. - * @returns {object} The media section. + * @param {object} props - The properties passed to the component. + * @param {boolean} [props.disabled=false] - Indicates whether the MediaSection is disabled or not. + * @param {string} [props.disabledNoticeMessage=''] - An optional notice that's displayed when the section is disabled. + * @param {import('react').ReactNode} [props.CustomNotice=null] - An optional custom notice that's displayed. + * @param {object} [props.analyticsData] - Data for tracking analytics. + * @return {object} The media section. */ export default function MediaSection( { disabled = false, diff --git a/projects/js-packages/publicize-components/src/components/message-box-control/index.js b/projects/js-packages/publicize-components/src/components/message-box-control/index.js index 55e0cd3efc0e1..76c62f701fd96 100644 --- a/projects/js-packages/publicize-components/src/components/message-box-control/index.js +++ b/projects/js-packages/publicize-components/src/components/message-box-control/index.js @@ -7,13 +7,13 @@ import { useCallback, useRef } from 'react'; * Wrapper around a textbox to restrict the number of characters and * display how many are remaining. * - * @param {object} props - The component's props. - * @param {string} props.message - The message to display. - * @param {Function} props.onChange - Callback to invoke as the message changes. - * @param {boolean} [props.disabled] - Whether the control is disabled. - * @param {number} props.maxLength - The maximum character length of the message. + * @param {object} props - The component's props. + * @param {string} props.message - The message to display. + * @param {Function} props.onChange - Callback to invoke as the message changes. + * @param {boolean} [props.disabled] - Whether the control is disabled. + * @param {number} props.maxLength - The maximum character length of the message. * @param {object} props.analyticsData - Data for tracking analytics. - * @returns {object} The message box component. + * @return {object} The message box component. */ export default function MessageBoxControl( { message = '', diff --git a/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx b/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx index 244afc4430fbe..15212154fd7a8 100644 --- a/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx +++ b/projects/js-packages/publicize-components/src/components/post-publish-manual-sharing/index.jsx @@ -10,7 +10,7 @@ import styles from './styles.module.scss'; /** * Post Publish Manual Sharing component. * - * @returns {import('react').ReactNode} Post Publish Manual Sharing component. + * @return {import('react').ReactNode} Post Publish Manual Sharing component. */ export default function PostPublishManualSharing() { const { isCurrentPostPublished } = useSelect( select => select( editorStore ), [] ); diff --git a/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js b/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js index db0b488bb2000..16726c614650b 100644 --- a/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js +++ b/projects/js-packages/publicize-components/src/components/refresh-jetpack-social-settings/index.js @@ -4,10 +4,10 @@ import { SOCIAL_STORE_ID } from '../../social-store'; /** * HOC that refreshes all of the Jetpack Social settings in the store, to be used in class components. * - * @param {object} props - The component props. + * @param {object} props - The component props. * @param {boolean} props.shouldRefresh - Whether or not to refresh the settings. - * @param {object} props.children - The children to render. - * @returns { object } The refreshJetpackSocialSettings function. + * @param {object} props.children - The children to render. + * @return { object } The refreshJetpackSocialSettings function. */ export default function RefreshJetpackSocialSettingsWrapper( { shouldRefresh, children } ) { const refreshOptions = useDispatch( SOCIAL_STORE_ID ).refreshJetpackSocialSettings; diff --git a/projects/js-packages/publicize-components/src/components/services/connect-form.tsx b/projects/js-packages/publicize-components/src/components/services/connect-form.tsx index 1368539238130..60ce0cb770e4c 100644 --- a/projects/js-packages/publicize-components/src/components/services/connect-form.tsx +++ b/projects/js-packages/publicize-components/src/components/services/connect-form.tsx @@ -23,7 +23,7 @@ type ConnectFormProps = { * * @param {ConnectFormProps} props - Component props * - * @returns {import('react').ReactNode} Connect form component + * @return {import('react').ReactNode} Connect form component */ export function ConnectForm( { service, diff --git a/projects/js-packages/publicize-components/src/components/services/service-item-details.tsx b/projects/js-packages/publicize-components/src/components/services/service-item-details.tsx index 59a40597c9923..1be326d409089 100644 --- a/projects/js-packages/publicize-components/src/components/services/service-item-details.tsx +++ b/projects/js-packages/publicize-components/src/components/services/service-item-details.tsx @@ -19,7 +19,7 @@ export type ServicesItemDetailsProps = { * * @param {ServicesItemDetailsProps} props - Component props * - * @returns {import('react').ReactNode} Service item details component + * @return {import('react').ReactNode} Service item details component */ export function ServiceItemDetails( { service, serviceConnections }: ServicesItemDetailsProps ) { const [ isSmall ] = useBreakpointMatch( 'sm' ); diff --git a/projects/js-packages/publicize-components/src/components/services/service-item.tsx b/projects/js-packages/publicize-components/src/components/services/service-item.tsx index 5c203ac23ebf6..134220927b01a 100644 --- a/projects/js-packages/publicize-components/src/components/services/service-item.tsx +++ b/projects/js-packages/publicize-components/src/components/services/service-item.tsx @@ -15,7 +15,7 @@ export type ServicesItemProps = ServicesItemDetailsProps; * * @param {ServicesItemProps} props - Component props * - * @returns {import('react').ReactNode} Service item component + * @return {import('react').ReactNode} Service item component */ export function ServiceItem( { service, serviceConnections }: ServicesItemProps ) { const [ isSmall ] = useBreakpointMatch( 'sm' ); diff --git a/projects/js-packages/publicize-components/src/components/services/service-status.tsx b/projects/js-packages/publicize-components/src/components/services/service-status.tsx index 21704cd87add8..bfdf37419452f 100644 --- a/projects/js-packages/publicize-components/src/components/services/service-status.tsx +++ b/projects/js-packages/publicize-components/src/components/services/service-status.tsx @@ -13,7 +13,7 @@ export type ServiceStatusProps = { * * @param {ServiceStatusProps} props - Component props * - * @returns {import('react').ReactNode} Service status component + * @return {import('react').ReactNode} Service status component */ export function ServiceStatus( { serviceConnections, brokenConnections }: ServiceStatusProps ) { if ( ! serviceConnections.length ) { diff --git a/projects/js-packages/publicize-components/src/components/services/services-list.tsx b/projects/js-packages/publicize-components/src/components/services/services-list.tsx index 4678ad8eca387..c2cdf4c4ac8b9 100644 --- a/projects/js-packages/publicize-components/src/components/services/services-list.tsx +++ b/projects/js-packages/publicize-components/src/components/services/services-list.tsx @@ -8,7 +8,7 @@ import { useSupportedServices } from './use-supported-services'; /** * Services list component * - * @returns {import('react').ReactNode} Services list component + * @return {import('react').ReactNode} Services list component */ export function ServicesList() { const supportedServices = useSupportedServices(); diff --git a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts index 2b4a715f54c2a..e2f5547d34d66 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-request-access.ts +++ b/projects/js-packages/publicize-components/src/components/services/use-request-access.ts @@ -18,7 +18,7 @@ export type RequestAccessOptions = { * Hook to request access to a service. * * @param {RequestAccessOptions} options - Options - * @returns {(formData: FormData) => void} - Function to request access + * @return {(formData: FormData) => void} - Function to request access */ export function useRequestAccess( { service, onConfirm }: RequestAccessOptions ) { const { createErrorNotice } = useGlobalNotices(); diff --git a/projects/js-packages/publicize-components/src/components/services/use-service-label.ts b/projects/js-packages/publicize-components/src/components/services/use-service-label.ts index 50ced24cd99f7..c295832c4097b 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-service-label.ts +++ b/projects/js-packages/publicize-components/src/components/services/use-service-label.ts @@ -11,7 +11,7 @@ interface GetServiceLabel { /** * Returns the label for a service. * - * @returns {GetServiceLabel} - The service label. + * @return {GetServiceLabel} - The service label. */ export function useServiceLabel() { const getService = useService(); diff --git a/projects/js-packages/publicize-components/src/components/services/use-service.ts b/projects/js-packages/publicize-components/src/components/services/use-service.ts index 72a28cb845dec..d1dacffc2985b 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-service.ts +++ b/projects/js-packages/publicize-components/src/components/services/use-service.ts @@ -13,7 +13,7 @@ export type SupportedServicesMap = Record< string, SupportedService >; /** * Returns the service object for a service name. * - * @returns {GetService} - The service object. + * @return {GetService} - The service object. */ export function useService() { const supportedServices = useSupportedServices(); diff --git a/projects/js-packages/publicize-components/src/components/services/use-supported-services.tsx b/projects/js-packages/publicize-components/src/components/services/use-supported-services.tsx index a83688fb61cad..b0a23c48630e1 100644 --- a/projects/js-packages/publicize-components/src/components/services/use-supported-services.tsx +++ b/projects/js-packages/publicize-components/src/components/services/use-supported-services.tsx @@ -26,7 +26,7 @@ export interface SupportedService extends ConnectionService { /** * Get the list of supported services. * - * @returns {Array< SupportedService >} The list of supported services + * @return {Array< SupportedService >} The list of supported services */ export function useSupportedServices(): Array< SupportedService > { const availableServices = useMemo( () => { diff --git a/projects/js-packages/publicize-components/src/components/share-buttons/share-buttons.tsx b/projects/js-packages/publicize-components/src/components/share-buttons/share-buttons.tsx index a72e215ad262f..8af89ebc1d0a8 100644 --- a/projects/js-packages/publicize-components/src/components/share-buttons/share-buttons.tsx +++ b/projects/js-packages/publicize-components/src/components/share-buttons/share-buttons.tsx @@ -19,7 +19,7 @@ export type ShareButtonsProps = { * * @param {ShareButtonsProps} props - Component props * - * @returns {React.JSX.Element} - Rendered component + * @return {React.JSX.Element} - Rendered component */ export function ShareButtons( { buttonStyle = 'icon', buttonVariant }: ShareButtonsProps ) { const prepareText = useShareButtonText(); diff --git a/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts b/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts index 0a9305c2fb09b..037d6e2e04502 100644 --- a/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts +++ b/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts @@ -5,7 +5,7 @@ import { usePostMeta } from '../../hooks/use-post-meta'; /** * Prepares the text to share. * - * @returns {(textWithPlaceholders: string, isUrl: boolean) => string} A function that accepts the text with placeholders and returns the text with the placeholders replaced. + * @return {(textWithPlaceholders: string, isUrl: boolean) => string} A function that accepts the text with placeholders and returns the text with the placeholders replaced. */ export function useShareButtonText() { const { shareMessage } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/components/share-post/index.js b/projects/js-packages/publicize-components/src/components/share-post/index.js index d324715149d35..08aee11a537b6 100644 --- a/projects/js-packages/publicize-components/src/components/share-post/index.js +++ b/projects/js-packages/publicize-components/src/components/share-post/index.js @@ -42,7 +42,7 @@ function showSuccessNotice() { /** * Component to trigger the resharing of the post. * - * @returns {object} A button component that will share the current post when clicked. + * @return {object} A button component that will share the current post when clicked. */ export function SharePostButton() { const { hasEnabledConnections } = useSocialMediaConnections(); @@ -103,7 +103,7 @@ export function SharePostButton() { * A panel row that renders the share button when the resharing * feature is available. * - * @returns {object|null} A PanelRow component, or null if nothing should be rendered. + * @return {object|null} A PanelRow component, or null if nothing should be rendered. */ export function SharePostRow() { const { isRePublicizeUpgradableViaUpsell } = usePublicizeConfig(); diff --git a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/index.js b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/index.js index f635c86926389..0f97415416ca2 100644 --- a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/index.js +++ b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/index.js @@ -10,11 +10,11 @@ import styles from './styles.module.scss'; /** * Wraps the template picker component in a modal, and saves the selected template on modal save. * - * @param {object} props - The component props. - * @param {Function} props.onSelect - A function that will be called when a template is selected. Receives the name of the selected template as an argument. - * @param {Function} props.render - A function that will be called with an object containing an "open" function, which can be called to open the template picker. + * @param {object} props - The component props. + * @param {Function} props.onSelect - A function that will be called when a template is selected. Receives the name of the selected template as an argument. + * @param {Function} props.render - A function that will be called with an object containing an "open" function, which can be called to open the template picker. * @param {string|null} [props.value=null] - The name of the currently selected template. - * @returns {JSXElement} - The component's rendered output. + * @return {JSXElement} - The component's rendered output. */ const TemplatePickerModal = ( { onSelect, render, value = null } ) => { const [ isOpen, setIsOpen ] = useState( false ); diff --git a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/test/index.test.js b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/test/index.test.js index b70899946566b..fcc684722df0b 100644 --- a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/test/index.test.js +++ b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/modal/test/index.test.js @@ -7,7 +7,7 @@ import TemplatePickerModal from '..'; * Helper method to set up the user event. * * @param {ReactElement} jsx - The element to render. - * @returns {object} An object with the user method and everything from the render method. + * @return {object} An object with the user method and everything from the render method. */ const setup = async jsx => ( { user: await userEvent.setup(), diff --git a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/picker/index.js b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/picker/index.js index d8383dedc9013..a2a91b14f2fb9 100644 --- a/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/picker/index.js +++ b/projects/js-packages/publicize-components/src/components/social-image-generator/template-picker/picker/index.js @@ -12,9 +12,9 @@ import TEMPLATES_DATA from './templates.js'; * with the onTemplateSelected callback. * * @param {{value: string|null, onTemplateSelected: Function}} props - The component props: - * Value is the name of the currently selected template, onTemplateSelected is a function that - * will be called when a template is selected. Receives the name of the selected template as an argument. - * @returns {ReactNode} - The component's rendered output. + * Value is the name of the currently selected template, onTemplateSelected is a function that + * will be called when a template is selected. Receives the name of the selected template as an argument. + * @return {ReactNode} - The component's rendered output. */ const TemplatePicker = ( { value = null, onTemplateSelected = null } ) => { const onTemplateClicked = useCallback( diff --git a/projects/js-packages/publicize-components/src/components/social-image-generator/toggle/index.tsx b/projects/js-packages/publicize-components/src/components/social-image-generator/toggle/index.tsx index 154b38b034f8d..7a7ceee6f7f50 100644 --- a/projects/js-packages/publicize-components/src/components/social-image-generator/toggle/index.tsx +++ b/projects/js-packages/publicize-components/src/components/social-image-generator/toggle/index.tsx @@ -21,7 +21,7 @@ type SocialImageGeneratorToggleProps = { * A button toggle wrapper for enabling/disabling the Social Image Generator feature. * * @param {SocialImageGeneratorToggleProps} props - Component props. - * @returns {React.ReactElement} - JSX.Element + * @return {React.ReactElement} - JSX.Element */ const SocialImageGeneratorToggle: React.FC< SocialImageGeneratorToggleProps > = ( { toggleClass, diff --git a/projects/js-packages/publicize-components/src/components/social-post-modal/modal.tsx b/projects/js-packages/publicize-components/src/components/social-post-modal/modal.tsx index deb4e2103e548..8cf54e4d21ca2 100644 --- a/projects/js-packages/publicize-components/src/components/social-post-modal/modal.tsx +++ b/projects/js-packages/publicize-components/src/components/social-post-modal/modal.tsx @@ -10,7 +10,7 @@ import styles from './styles.module.scss'; /** * The Social Post Modal component. * - * @returns {import('react').ReactNode} - Social Post Modal component. + * @return {import('react').ReactNode} - Social Post Modal component. */ export function SocialPostModal() { const [ isModalOpen, toggleModal ] = useReducer( state => ! state, false ); diff --git a/projects/js-packages/publicize-components/src/components/social-post-modal/post-preview.tsx b/projects/js-packages/publicize-components/src/components/social-post-modal/post-preview.tsx index f8d15a3f4fff9..66c90805181c6 100644 --- a/projects/js-packages/publicize-components/src/components/social-post-modal/post-preview.tsx +++ b/projects/js-packages/publicize-components/src/components/social-post-modal/post-preview.tsx @@ -27,7 +27,7 @@ export type PostPreviewProps = { * * @param {PostPreviewProps} props - PostPreview component props. * - * @returns {import('react').ReactNode} - Post preview component. + * @return {import('react').ReactNode} - Post preview component. */ export function PostPreview( { connection }: PostPreviewProps ) { const user = useMemo( diff --git a/projects/js-packages/publicize-components/src/components/social-post-modal/preview-section.tsx b/projects/js-packages/publicize-components/src/components/social-post-modal/preview-section.tsx index 92cd970ff221e..ab96029e8e502 100644 --- a/projects/js-packages/publicize-components/src/components/social-post-modal/preview-section.tsx +++ b/projects/js-packages/publicize-components/src/components/social-post-modal/preview-section.tsx @@ -14,7 +14,7 @@ import styles from './styles.module.scss'; /** * Preview section of the social post modal. * - * @returns {import('react').ReactNode} - Preview section of the social post modal. + * @return {import('react').ReactNode} - Preview section of the social post modal. */ export function PreviewSection() { const { recordEvent } = useAnalytics(); diff --git a/projects/js-packages/publicize-components/src/components/social-post-modal/settings-section.tsx b/projects/js-packages/publicize-components/src/components/social-post-modal/settings-section.tsx index ad410efe6a96c..061ff8312d92b 100644 --- a/projects/js-packages/publicize-components/src/components/social-post-modal/settings-section.tsx +++ b/projects/js-packages/publicize-components/src/components/social-post-modal/settings-section.tsx @@ -5,7 +5,7 @@ import styles from './styles.module.scss'; /** * Settings section of the social post modal. * - * @returns {import('react').ReactNode} - Settings section of the social post modal. + * @return {import('react').ReactNode} - Settings section of the social post modal. */ export function SettingsSection() { return ( diff --git a/projects/js-packages/publicize-components/src/components/social-previews/google-search.js b/projects/js-packages/publicize-components/src/components/social-previews/google-search.js index 7839815791a68..f8a048eb9e60e 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/google-search.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/google-search.js @@ -6,10 +6,10 @@ import React from 'react'; /** * The Google Search tab component. * - * @param {object} props - The props. + * @param {object} props - The props. * @param {object[]} props.tweets - The tweets. - * @param {object} props.media - The media. - * @returns {React.ReactNode} The Google Search tab component. + * @param {object} props.media - The media. + * @return {React.ReactNode} The Google Search tab component. */ export function GoogleSearch( props ) { const siteTitle = useSelect( select => { diff --git a/projects/js-packages/publicize-components/src/components/social-previews/instagram.js b/projects/js-packages/publicize-components/src/components/social-previews/instagram.js index a8a450fdfa523..cfed68ba5b5c2 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/instagram.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/instagram.js @@ -12,7 +12,7 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_INSTAGRAM_BUSINESS } from '../../so * The Instagram tab component. * * @param {object} props - The props. - * @returns {React.ReactNode} The Instagram tab component. + * @return {React.ReactNode} The Instagram tab component. */ export function Instagram( props ) { const { title, image, media, description } = props; diff --git a/projects/js-packages/publicize-components/src/components/social-previews/linkedin.js b/projects/js-packages/publicize-components/src/components/social-previews/linkedin.js index 8cbc7bc6747c3..f609ba2c18803 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/linkedin.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/linkedin.js @@ -9,7 +9,7 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_LINKEDIN } from '../../social-store * The linkedin tab component. * * @param {object} props - The props. - * @returns {React.ReactNode} The linkedin tab component. + * @return {React.ReactNode} The linkedin tab component. */ export function LinkedIn( props ) { const { title, url, image, media, description: postDescription } = props; diff --git a/projects/js-packages/publicize-components/src/components/social-previews/nextdoor.js b/projects/js-packages/publicize-components/src/components/social-previews/nextdoor.js index 892e0a1f83d91..5688fb89edd5b 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/nextdoor.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/nextdoor.js @@ -8,7 +8,7 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_NEXTDOOR } from '../../social-store * The linkedin tab component. * * @param {object} props - The props. - * @returns {React.ReactNode} The linkedin tab component. + * @return {React.ReactNode} The linkedin tab component. */ export function Nextdoor( props ) { const { title, url, image, media, description: postDescription } = props; diff --git a/projects/js-packages/publicize-components/src/components/social-previews/threads.js b/projects/js-packages/publicize-components/src/components/social-previews/threads.js index 76ac408f9cf3f..e6bf11750eaca 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/threads.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/threads.js @@ -8,14 +8,14 @@ import { CONNECTION_SERVICE_THREADS, store } from '../../social-store'; /** * The threads tab component. * - * @param {object} props - The props. - * @param {string} props.excerpt - The post excerpt - * @param {string} props.title - The post title - * @param {string} props.description - The post description/excerpt - * @param {object} props.image - The post featured image - * @param {string} props.url - The URL of the post - * @param {object[]} props.media - Array of attached media - * @returns {React.ReactNode} The threads tab component. + * @param {object} props - The props. + * @param {string} props.excerpt - The post excerpt + * @param {string} props.title - The post title + * @param {string} props.description - The post description/excerpt + * @param {object} props.image - The post featured image + * @param {string} props.url - The URL of the post + * @param {object[]} props.media - Array of attached media + * @return {React.ReactNode} The threads tab component. */ export function Threads( { excerpt, title, description, image, url, media } ) { const { shareMessage } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/components/social-previews/twitter.js b/projects/js-packages/publicize-components/src/components/social-previews/twitter.js index 901eaa6e08ff0..8927cd4706ce3 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/twitter.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/twitter.js @@ -7,13 +7,13 @@ import { SOCIAL_STORE_ID, CONNECTION_SERVICE_TWITTER } from '../../social-store' /** * The twitter tab component. * - * @param {object} props - The props. - * @param {string} props.title - The post title - * @param {string} props.description - The post description/excerpt - * @param {object} props.image - The post featured image - * @param {string} props.url - The URL of the post - * @param {object[]} props.media - Array of attached media - * @returns {React.ReactNode} The twitter tab component. + * @param {object} props - The props. + * @param {string} props.title - The post title + * @param {string} props.description - The post description/excerpt + * @param {object} props.image - The post featured image + * @param {string} props.url - The URL of the post + * @param {object[]} props.media - Array of attached media + * @return {React.ReactNode} The twitter tab component. */ function Twitter( { title, description, image, url, media } ) { const { shareMessage } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/components/social-previews/use-available-services.js b/projects/js-packages/publicize-components/src/components/social-previews/use-available-services.js index e479b1994d510..a3f575f8c884a 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/use-available-services.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/use-available-services.js @@ -16,7 +16,7 @@ import Twitter from './twitter'; /** * Returns the list of available services. * - * @returns {Array<{title: string, icon: React.Component, name: string, preview: React.Component}>} The list of available services. + * @return {Array<{title: string, icon: React.Component, name: string, preview: React.Component}>} The list of available services. */ export function useAvailableSerivces() { const additionalConnections = getSupportedAdditionalConnections(); diff --git a/projects/js-packages/publicize-components/src/components/social-previews/use-post-data.js b/projects/js-packages/publicize-components/src/components/social-previews/use-post-data.js index 25711edcf0504..3f7b318b5a393 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/use-post-data.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/use-post-data.js @@ -7,7 +7,7 @@ import { getMediaSourceUrl, getPostImageUrl } from './utils'; /** * Returns the post data. * - * @returns {object} The post data. + * @return {object} The post data. */ export function usePostData() { const { attachedMedia, imageGeneratorSettings } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/components/social-previews/utils.js b/projects/js-packages/publicize-components/src/components/social-previews/utils.js index 9ec506bf2a842..81a241f0da879 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/utils.js +++ b/projects/js-packages/publicize-components/src/components/social-previews/utils.js @@ -2,7 +2,7 @@ * Gets the URL of the media. Tries loading a smaller size (1024px width) if available and falls back to the full size. * * @param {object} media - Media object - * @returns {?string} URL address + * @return {?string} URL address */ export function getMediaSourceUrl( media ) { if ( ! media ) { @@ -17,7 +17,7 @@ export function getMediaSourceUrl( media ) { * Gets the URL of an image from the post body * * @param {string} editedPostContent - The post content coming from core/editor - * @returns {?string} URL address + * @return {?string} URL address */ export function getPostImageUrl( editedPostContent ) { const parser = new DOMParser(); diff --git a/projects/js-packages/publicize-components/src/hooks/use-attached-media/index.js b/projects/js-packages/publicize-components/src/hooks/use-attached-media/index.js index 6db6b44edc973..8f18783567c93 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-attached-media/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-attached-media/index.js @@ -2,14 +2,14 @@ import { usePostMeta } from '../use-post-meta'; /** * @typedef {object} AttachedMediaHook - * @property {Array} attachedMedia - List of media with ID, URL, and metadata. + * @property {Array} attachedMedia - List of media with ID, URL, and metadata. * @property {Function} updateAttachedMedia - Callback used to update the attached media. */ /** * Hook to handle storing the attached media, choosing whether it is a social post. * - * @returns {AttachedMediaHook} - An object with the attached media hook properties set. + * @return {AttachedMediaHook} - An object with the attached media hook properties set. */ export default function useAttachedMedia() { const { attachedMedia, updateJetpackSocialOptions } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/hooks/use-dismiss-notice/index.js b/projects/js-packages/publicize-components/src/hooks/use-dismiss-notice/index.js index 8b4dd00a405a8..ebe127baa0ba7 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-dismiss-notice/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-dismiss-notice/index.js @@ -4,9 +4,9 @@ import { useCallback, useMemo, useState } from '@wordpress/element'; /** * @typedef {object} NoticeTypes - * @property {string} instagram - The name of the Instagram notice. + * @property {string} instagram - The name of the Instagram notice. * @property {string} advancedUpgradeEditor - The name of the advanced upgrade nudge in the editor. - * @property {string} advancedUpgradeAdmin - The name of the advanced upgrade nudge in the admin page. + * @property {string} advancedUpgradeAdmin - The name of the advanced upgrade nudge in the admin page. */ const NOTICES = { @@ -23,16 +23,16 @@ const calculateReappearanceTime = seconds => { /** * @typedef {object} DismissNoticeHook - * @property {Array} dismissedNotices - Array of names of dismissed notices. - * @property {Function} dismissNotice - Callback used to dismiss a notice. - * @property {Function} shouldShowNotice - Callback used to check if a notice should be shown. - * @property {NoticeTypes} NOTICES - Object containing the names of the supported notices. + * @property {Array} dismissedNotices - Array of names of dismissed notices. + * @property {Function} dismissNotice - Callback used to dismiss a notice. + * @property {Function} shouldShowNotice - Callback used to check if a notice should be shown. + * @property {NoticeTypes} NOTICES - Object containing the names of the supported notices. */ /** * Hook to handle retrieving dismissed notices and dismissing a notice. * - * @returns {DismissNoticeHook} - An object with the dismissed notice hook properties set. + * @return {DismissNoticeHook} - An object with the dismissed notice hook properties set. */ export default function useDismissNotice() { const [ dismissedNotices, setDismissedNotices ] = useState( () => { @@ -46,7 +46,7 @@ export default function useDismissNotice() { /** * Dismiss a notice for a given time. * - * @param {string} notice - The name of the notice to dismiss. + * @param {string} notice - The name of the notice to dismiss. * @param {number} [dismissDuration=-1] - The number of seconds to dismiss the notice for. -1 means forever. */ const dismissNotice = useCallback( ( notice, dismissDuration = -1 ) => { @@ -65,7 +65,7 @@ export default function useDismissNotice() { * Check if a notice should be shown. * * @param {string} notice - The name of the notice to check. - * @returns {boolean} - Whether the notice should be shown. + * @return {boolean} - Whether the notice should be shown. */ const shouldShowNotice = useCallback( notice => { diff --git a/projects/js-packages/publicize-components/src/hooks/use-featured-image/index.js b/projects/js-packages/publicize-components/src/hooks/use-featured-image/index.js index de543485ae2d0..47a36df2a1e6d 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-featured-image/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-featured-image/index.js @@ -4,7 +4,7 @@ import { store as editorStore } from '@wordpress/editor'; /** * Returns the ID of the current featured image if there is one. * - * @returns {number?} The ID of the featured image. + * @return {number?} The ID of the featured image. */ export default () => useSelect( select => select( editorStore ).getEditedPostAttribute( 'featured_media' ) ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-image-generator-config/index.js b/projects/js-packages/publicize-components/src/hooks/use-image-generator-config/index.js index 9bf8dfcf3287f..a0177f1c73fab 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-image-generator-config/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-image-generator-config/index.js @@ -14,21 +14,21 @@ const getCurrentSettings = ( sigSettings, isPostPublished ) => ( { /** * @typedef {object} ImageGeneratorConfigHook - * @property {Array} postSettings - Array of post settings (custom text, image type etc). - * @property {boolean} isEnabled - True if the image generator is enabled for this post. - * @property {string} customText - Custom text for the generated image. - * @property {string} imageType - Optional. Type of the image in the generated image. - * @property {number} imageId - Optional. ID of the image in the generated image. - * @property {string} template - Template for the generated image. - * @property {Function} setIsEnabled - Callback to enable or disable the image generator for a post. + * @property {Array} postSettings - Array of post settings (custom text, image type etc). + * @property {boolean} isEnabled - True if the image generator is enabled for this post. + * @property {string} customText - Custom text for the generated image. + * @property {string} imageType - Optional. Type of the image in the generated image. + * @property {number} imageId - Optional. ID of the image in the generated image. + * @property {string} template - Template for the generated image. + * @property {Function} setIsEnabled - Callback to enable or disable the image generator for a post. * @property {Function} updateProperty - Callback to update various SIG settings. - * @property {Function} setToken - Callback to change the token. + * @property {Function} setToken - Callback to change the token. */ /** * Hook to handle storing and retrieving image generator config. * - * @returns {ImageGeneratorConfigHook} - An object with the attached media hook properties set. + * @return {ImageGeneratorConfigHook} - An object with the attached media hook properties set. */ export default function useImageGeneratorConfig() { const { imageGeneratorSettings, jetpackSocialOptions, updateJetpackSocialOptions } = diff --git a/projects/js-packages/publicize-components/src/hooks/use-media-details/index.js b/projects/js-packages/publicize-components/src/hooks/use-media-details/index.js index 134998bc7a02b..b5cb6c93a3256 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-media-details/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-media-details/index.js @@ -5,7 +5,7 @@ import { useCallback, useEffect, useState } from '@wordpress/element'; * Get meta data from a VideoPress video. * * @param {object} video - VideoPress media object. - * @returns {Promise} A promise containing {mime: string, fileSize: number, length: number}} + * @return {Promise} A promise containing {mime: string, fileSize: number, length: number}} */ const getVideoPressMetadata = async video => { if ( @@ -34,7 +34,7 @@ const getVideoPressMetadata = async video => { * Get relevant details from a WordPress media object. * * @param {object} media - WordPress media object. - * @returns {Promise} An object containing mediaData and metaData. + * @return {Promise} An object containing mediaData and metaData. */ const getMediaDetails = async media => { if ( ! media ) { @@ -87,7 +87,7 @@ const getMediaDetails = async media => { * Hook to handle storing the attached media. * * @param {number} mediaId - ID of the current media in the Media Lib. - * @returns {[ mediaDetails: import('./types').MediaDetails ]} - The media details + * @return {[ mediaDetails: import('./types').MediaDetails ]} - The media details */ export default function useMediaDetails( mediaId = null ) { const [ mediaDetails, setMediaDetails ] = useState( [ {} ] ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/constants.ts b/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/constants.ts index 5945e8686b500..8aad3e9828ec0 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/constants.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/constants.ts @@ -10,7 +10,7 @@ export const DIMENSION_ERROR = 'DIMENSION_ERROR'; /** * Returns the error labels. * - * @returns {Record} The error labels. + * @return {Record} The error labels. */ export function getErrorLabels() { return { @@ -26,7 +26,7 @@ export function getErrorLabels() { * * @param {string} errorType - The error type. * - * @returns {string} The error label. + * @return {string} The error label. */ export function getErrorLabel( errorType: string ) { return getErrorLabels()[ errorType ] || __( 'Invalid media', 'jetpack' ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/index.ts b/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/index.ts index 48cc3a44d04ad..dccf4f4d48d13 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-media-restrictions/index.ts @@ -23,7 +23,7 @@ import { MediaRestrictions } from './types'; * Checks whether a media is a video. * * @param {string} mime - The MIME tye of the media - * @returns {boolean} Whether it is a video. + * @return {boolean} Whether it is a video. */ export function isVideo( mime ) { return mime.split( '/' )[ 0 ] === 'video'; @@ -33,7 +33,7 @@ export function isVideo( mime ) { * Checks whether a media is convertible so we can convert it if needed. * * @param {object} metaData - Media metadata, mime, fileSize and length. - * @returns {boolean} Whether it is convertible. + * @return {boolean} Whether it is convertible. */ const isMediaConvertible = metaData => { if ( ! metaData?.mime || ! metaData?.fileSize ) { @@ -61,11 +61,11 @@ const isMediaConvertible = metaData => { /** * This function is used to check if the provided image is valid based on it's size and type. * - * @param {number} sizeInMb - The fileSize in bytes. - * @param {number} width - Width of the image. - * @param {number} height - Height of the image. + * @param {number} sizeInMb - The fileSize in bytes. + * @param {number} width - Width of the image. + * @param {number} height - Height of the image. * @param {object} imageLimits - Has the properties to check against - * @returns {FILE_SIZE_ERROR} Returns validation error. + * @return {FILE_SIZE_ERROR} Returns validation error. */ const getImageValidationError = ( sizeInMb, width, height, imageLimits ) => { const { @@ -91,12 +91,12 @@ const getImageValidationError = ( sizeInMb, width, height, imageLimits ) => { /** * This function is used to check if the provided video is valid based on it's size and type and length. * - * @param {number} sizeInMb - The fileSize in bytes. - * @param {number} length - Video length in seconds and. - * @param {number} width - Width of the video. - * @param {number} height - Height of the video. + * @param {number} sizeInMb - The fileSize in bytes. + * @param {number} length - Video length in seconds and. + * @param {number} width - Width of the video. + * @param {number} height - Height of the video. * @param {object} videoLimits - Has the properties to check against - * @returns {(FILE_SIZE_ERROR | VIDEO_LENGTH_TOO_LONG_ERROR | VIDEO_LENGTH_TOO_SHORT_ERROR)} Returns validation error. + * @return {(FILE_SIZE_ERROR | VIDEO_LENGTH_TOO_LONG_ERROR | VIDEO_LENGTH_TOO_SHORT_ERROR)} Returns validation error. */ const getVideoValidationError = ( sizeInMb, length, width, height, videoLimits ) => { const { @@ -131,12 +131,12 @@ const getVideoValidationError = ( sizeInMb, length, width, height, videoLimits ) /** * Checks whether the media with the provided metaData is valid. It can validate images or videos. * - * @param {object} metaData - Media metadata, mime, fileSize and length. - * @param {object} mediaData - Data for media, width, height, source_url etc. - * @param {string} serviceName - The name of the social media service we want to validate against. facebook, tumblr etc. - * @param {boolean} hasAttachedMedia - Whether the media is attached. + * @param {object} metaData - Media metadata, mime, fileSize and length. + * @param {object} mediaData - Data for media, width, height, source_url etc. + * @param {string} serviceName - The name of the social media service we want to validate against. facebook, tumblr etc. + * @param {boolean} hasAttachedMedia - Whether the media is attached. * @param {boolean} hasAutoGeneratedImage - Whether there is an auto generated image. - * @returns {(FILE_SIZE_ERROR | FILE_TYPE_ERROR | VIDEO_LENGTH_TOO_SHORT_ERROR | VIDEO_LENGTH_TOO_LONG_ERROR)} Returns validation error. + * @return {(FILE_SIZE_ERROR | FILE_TYPE_ERROR | VIDEO_LENGTH_TOO_SHORT_ERROR | VIDEO_LENGTH_TOO_LONG_ERROR)} Returns validation error. */ const getValidationError = ( metaData, @@ -183,8 +183,8 @@ const getValidationError = ( * Hooks to deal with the media restrictions * * @param {Array< Connection >} connections - Currently enabled connections. - * @param {MediaDetails} media - Currently enabled connections. - * @returns {MediaRestrictions} Social media connection handler. + * @param {MediaDetails} media - Currently enabled connections. + * @return {MediaRestrictions} Social media connection handler. */ const useMediaRestrictions = ( connections: Array< Connection >, diff --git a/projects/js-packages/publicize-components/src/hooks/use-post-meta/index.js b/projects/js-packages/publicize-components/src/hooks/use-post-meta/index.js index e6501f34148e8..4f8232043e033 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-post-meta/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-post-meta/index.js @@ -6,7 +6,7 @@ import { getShareMessageMaxLength } from '../../utils'; /** * Returns the post meta values. * - * @returns {import('./types').UsePostMeta} The post meta values. + * @return {import('./types').UsePostMeta} The post meta values. */ export function usePostMeta() { const { editPost } = useDispatch( editorStore ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js b/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js index 005458e6dbc70..9cbb80cf1f70d 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-publicize-config/index.js @@ -17,7 +17,7 @@ const republicizeFeatureName = 'republicize'; * Hook that provides various elements of Publicize configuration, * whether it's enabled, and whether resharing is available. * - * @returns { object } The various flags and togglePublicizeFeature, + * @return { object } The various flags and togglePublicizeFeature, * for toggling support for the current post. */ export default function usePublicizeConfig() { diff --git a/projects/js-packages/publicize-components/src/hooks/use-refresh-connections/index.js b/projects/js-packages/publicize-components/src/hooks/use-refresh-connections/index.js index 2205988638fce..40b230fea061c 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-refresh-connections/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-refresh-connections/index.js @@ -6,7 +6,7 @@ import useSelectSocialMediaConnections from '../use-social-media-connections'; /** * Hook that provides a function to refresh the connections. * - * @returns { object } The refreshConnections function. + * @return { object } The refreshConnections function. */ export default function useRefreshConnections() { const shouldAutoRefresh = useRef( false ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-save-image-to-library/index.ts b/projects/js-packages/publicize-components/src/hooks/use-save-image-to-library/index.ts index 58159171e7dc1..042934f8b14a3 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-save-image-to-library/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-save-image-to-library/index.ts @@ -17,7 +17,7 @@ export type SaveImageToLibrary = { * * @param {SaveImageToLibraryOptions} options - Options for the hook. * - * @returns {SaveImageToLibrary} The object. + * @return {SaveImageToLibrary} The object. */ export function useSaveImageToLibrary( { onError, onSuccess }: SaveImageToLibraryOptions ) { const [ isSaving, setIsSaving ] = useState( false ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-saving-post/index.js b/projects/js-packages/publicize-components/src/hooks/use-saving-post/index.js index 1fbe99fbce52d..47849e39f6666 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-saving-post/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-saving-post/index.js @@ -8,8 +8,8 @@ import { useEffect } from '@wordpress/element'; * running the callback when it happens. * Additionally, it accepts a dependency array which is passed to useEffect hook. * - * @param {Function} fn - Callback function to run when the post is just saved. - * @param {Array} deps - Depencency array. + * @param {Function} fn - Callback function to run when the post is just saved. + * @param {Array} deps - Depencency array. */ export function usePostJustSaved( fn, deps ) { const isSaving = useSelect( select => select( editorStore ).isSavingPost(), [] ); @@ -29,8 +29,8 @@ export function usePostJustSaved( fn, deps ) { * running the callback when it happens. * Additionally, it accepts a dependency array which is passed to useEffect hook. * - * @param {Function} fn - Callback function to run when the post is just published. - * @param {Array} [deps] - Depencency array. + * @param {Function} fn - Callback function to run when the post is just published. + * @param {Array} [deps] - Depencency array. */ export function usePostJustPublished( fn, deps ) { const isPublishing = useSelect( select => select( editorStore ).isPublishingPost(), [] ); @@ -50,8 +50,8 @@ export function usePostJustPublished( fn, deps ) { * running the callback when it happens. * Additionally, it accepts a dependency array which is passed to useEffect hook. * - * @param {Function} fn - Callback function to run when the post starts publishing. - * @param {Array} deps - Dependency array. + * @param {Function} fn - Callback function to run when the post starts publishing. + * @param {Array} deps - Dependency array. */ export function usePostStartedPublishing( fn, deps ) { const isPublishing = useSelect( select => select( editorStore ).isPublishingPost(), [] ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-share-limits/index.ts b/projects/js-packages/publicize-components/src/hooks/use-share-limits/index.ts index afb5496887d59..049b6a2d37e7b 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-share-limits/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-share-limits/index.ts @@ -20,7 +20,7 @@ export type UseShareLimitsArgs = { * Returns the messages for the share limits * * @param {number} remainingCount - The number of shares left - * @returns {ReturnType} Share limits messages + * @return {ReturnType} Share limits messages */ export function getMessages( remainingCount: number ) { const remaining = Number.isFinite( remainingCount ) @@ -51,7 +51,7 @@ export function getMessages( remainingCount: number ) { * * @param {UseShareLimitsArgs} args - Arguments * - * @returns {ShareLimits} Share limits details + * @return {ShareLimits} Share limits details */ export function useShareLimits( { scheduledCountAdjustment = 0, diff --git a/projects/js-packages/publicize-components/src/hooks/use-share-limits/test/index.test.tsx b/projects/js-packages/publicize-components/src/hooks/use-share-limits/test/index.test.tsx index 7bc88f9518a9c..c31c40dfb7cfc 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-share-limits/test/index.test.tsx +++ b/projects/js-packages/publicize-components/src/hooks/use-share-limits/test/index.test.tsx @@ -16,7 +16,7 @@ type DeepPartial< T > = T extends object * * @param {Partial< SocialStoreState >} initialState - Initial state for the store. * - * @returns {WPDataRegistry} Registry. + * @return {WPDataRegistry} Registry. */ function createRegistryWithStores( initialState = {} ): WPDataRegistry { // Create a registry. @@ -35,7 +35,7 @@ function createRegistryWithStores( initialState = {} ): WPDataRegistry { * * @param {Partial< SocialStoreState >} data - Data to override the default state * - * @returns {SocialStoreState} Initial state for the store + * @return {SocialStoreState} Initial state for the store */ function getStoreInitialState( data: DeepPartial< SocialStoreState > ) { return { diff --git a/projects/js-packages/publicize-components/src/hooks/use-share-post/index.js b/projects/js-packages/publicize-components/src/hooks/use-share-post/index.js index 2dd89900f0626..17f865ccce260 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-share-post/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-share-post/index.js @@ -11,7 +11,7 @@ import useSocialMediaMessage from '../../hooks/use-social-media-message'; * Takes an error object and returns a more meaningful error message. * * @param {object} result - An API error object. - * @returns {{ message: string, result: object }} The error message and passed in error object. + * @return {{ message: string, result: object }} The error message and passed in error object. */ function getHumanReadableError( result ) { // Errors coming from the API. @@ -67,7 +67,7 @@ function getHumanReadableError( result ) { * A hook to get the necessary data and callbacks to reshare a post. * * @param {number} postId - The ID of the post to share. - * @returns { { doPublicize: Function, data: object } } The doPublicize callback to share the post. + * @return { { doPublicize: Function, data: object } } The doPublicize callback to share the post. */ export default function useSharePost( postId ) { // Sharing data. diff --git a/projects/js-packages/publicize-components/src/hooks/use-social-media-connections/index.ts b/projects/js-packages/publicize-components/src/hooks/use-social-media-connections/index.ts index f33c4ed00df3a..cc922ef523042 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-social-media-connections/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-social-media-connections/index.ts @@ -4,7 +4,7 @@ import { store as socialStore } from '../../social-store'; /** * Hooks to deal with the social media connections. * - * @returns {object} Social media connection handler. + * @return {object} Social media connection handler. */ export default function useSocialMediaConnections() { const { refreshConnectionTestResults, toggleConnectionById } = useDispatch( socialStore ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-social-media-message/index.js b/projects/js-packages/publicize-components/src/hooks/use-social-media-message/index.js index 313e4f0b89887..2783efc96e1ce 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-social-media-message/index.js +++ b/projects/js-packages/publicize-components/src/hooks/use-social-media-message/index.js @@ -3,15 +3,15 @@ import { usePostMeta } from '../use-post-meta'; /** * @typedef {object} MessageHook - * @property {string} message - The text of the message. - * @property {number} maxLength - The maximum length of the message. + * @property {string} message - The text of the message. + * @property {number} maxLength - The maximum length of the message. * @property {Function} updateMessage - Callback used to update the message. */ /** * Hook to handle storing the the current custom message. * - * @returns {MessageHook} - An object with the message hook properties set. + * @return {MessageHook} - An object with the message hook properties set. */ export default function useSocialMediaMessage() { const { updateMeta, shareMessage } = usePostMeta(); diff --git a/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js b/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js index 5e2c7ec0aae9d..f9fc9f81dd418 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/connection-data.js @@ -22,7 +22,7 @@ import { /** * Set connections list * @param {Array} connections - list of connections - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setConnections( connections ) { return { @@ -36,7 +36,7 @@ export function setConnections( connections ) { * * @param {import('../types').KeyringResult} [keyringResult] - keyring result * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setKeyringResult( keyringResult ) { return { @@ -48,7 +48,7 @@ export function setKeyringResult( keyringResult ) { /** * Add connection to the list * @param {import('../types').Connection} connection - connection object - * @returns {object} - an action object. + * @return {object} - an action object. */ export function addConnection( connection ) { return { @@ -61,7 +61,7 @@ export function addConnection( connection ) { * Toggle connection enable status. * @param {string} connectionId - Connection ID to switch. * - * @returns {object} Switch connection enable-status action. + * @return {object} Switch connection enable-status action. */ export function toggleConnection( connectionId ) { return { @@ -73,7 +73,7 @@ export function toggleConnection( connectionId ) { /** * Merge connections with fresh connections. * @param {Array} freshConnections - list of fresh connections - * @returns {Function} - a function to merge connections. + * @return {Function} - a function to merge connections. */ export function mergeConnections( freshConnections ) { return function ( { dispatch, select } ) { @@ -113,9 +113,9 @@ export function mergeConnections( freshConnections ) { /** * Create an abort controller. * @param {AbortController} abortController - Abort controller. - * @param {string} requestType - Type of abort request. + * @param {string} requestType - Type of abort request. * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function createAbortController( abortController, requestType ) { return { @@ -130,7 +130,7 @@ export function createAbortController( abortController, requestType ) { * * @param {string} requestType - Type of abort request. * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function removeAbortControllers( requestType ) { return { @@ -144,7 +144,7 @@ export function removeAbortControllers( requestType ) { * * @param {string} requestType - Type of abort request. * - * @returns {Function} - a function to abort a request. + * @return {Function} - a function to abort a request. */ export function abortRequest( requestType ) { return function ( { dispatch, select } ) { @@ -162,7 +162,7 @@ export function abortRequest( requestType ) { /** * Abort the refresh connections request. * - * @returns {Function} - a function to abort a request. + * @return {Function} - a function to abort a request. */ export function abortRefreshConnectionsRequest() { return abortRequest( REQUEST_TYPE_REFRESH_CONNECTIONS ); @@ -171,8 +171,8 @@ export function abortRefreshConnectionsRequest() { /** * Effect handler which will refresh the connection test results. * - * @param {boolean} syncToMeta - Whether to sync the connection state to the post meta. - * @returns {Function} Refresh connection test results action. + * @param {boolean} syncToMeta - Whether to sync the connection state to the post meta. + * @return {Function} Refresh connection test results action. */ export function refreshConnectionTestResults( syncToMeta = false ) { return async function ( { dispatch, select } ) { @@ -212,7 +212,7 @@ export function refreshConnectionTestResults( syncToMeta = false ) { /** * Syncs the connections to the post meta. * - * @returns {Function} Sync connections to post meta action. + * @return {Function} Sync connections to post meta action. */ export function syncConnectionsToPostMeta() { return function ( { registry, select } ) { @@ -228,9 +228,9 @@ export function syncConnectionsToPostMeta() { /** * Toggles the connection enable-status. * - * @param {string} connectionId - Connection ID to switch. - * @param {boolean} syncToMeta - Whether to sync the connection state to the post meta. - * @returns {object} Switch connection enable-status action. + * @param {string} connectionId - Connection ID to switch. + * @param {boolean} syncToMeta - Whether to sync the connection state to the post meta. + * @return {object} Switch connection enable-status action. */ export function toggleConnectionById( connectionId, syncToMeta = true ) { return function ( { dispatch } ) { @@ -247,7 +247,7 @@ export function toggleConnectionById( connectionId, syncToMeta = true ) { * * @param {string} connectionId - Connection ID to delete. * - * @returns {object} Delete connection action. + * @return {object} Delete connection action. */ export function deleteConnection( connectionId ) { return { @@ -259,10 +259,10 @@ export function deleteConnection( connectionId ) { /** * Marks a connection as being deleted. * - * @param {string} connectionId - Connection ID to delete. - * @param {boolean} deleting - Whether the connection is being deleted. + * @param {string} connectionId - Connection ID to delete. + * @param {boolean} deleting - Whether the connection is being deleted. * - * @returns {object} Deleting connection action. + * @return {object} Deleting connection action. */ export function deletingConnection( connectionId, deleting = true ) { return { @@ -275,11 +275,11 @@ export function deletingConnection( connectionId, deleting = true ) { /** * Deletes a connection by disconnecting it. * - * @param {object} args - Arguments. - * @param {string | number} args.connectionId - Connection ID to delete. - * @param {boolean} [args.showSuccessNotice] - Whether to show a success notice. + * @param {object} args - Arguments. + * @param {string | number} args.connectionId - Connection ID to delete. + * @param {boolean} [args.showSuccessNotice] - Whether to show a success notice. * - * @returns {boolean} Whether the connection was deleted. + * @return {boolean} Whether the connection was deleted. */ export function deleteConnectionById( { connectionId, showSuccessNotice = true } ) { return async function ( { registry, dispatch } ) { @@ -331,9 +331,9 @@ let uniqueId = 1; /** * Creates a connection. * - * @param {Record} data - The data for API call. + * @param {Record} data - The data for API call. * @param {Record} optimisticData - Optimistic data for the connection. - * @returns {void} + * @return {void} */ export function createConnection( data, optimisticData = {} ) { return async function ( { registry, dispatch } ) { @@ -408,10 +408,10 @@ export function createConnection( data, optimisticData = {} ) { /** * Updates a connection. * - * @param {string} connectionId - Connection ID to update. - * @param {Record} data - The data. + * @param {string} connectionId - Connection ID to update. + * @param {Record} data - The data. * - * @returns {object} Delete connection action. + * @return {object} Delete connection action. */ export function updateConnection( connectionId, data ) { return { @@ -424,10 +424,10 @@ export function updateConnection( connectionId, data ) { /** * Marks a connection as being updating. * - * @param {string} connectionId - Connection ID being updated. - * @param {boolean} updating - Whether the connection is being updated. + * @param {string} connectionId - Connection ID being updated. + * @param {boolean} updating - Whether the connection is being updated. * - * @returns {object} Deleting connection action. + * @return {object} Deleting connection action. */ export function updatingConnection( connectionId, updating = true ) { return { @@ -442,7 +442,7 @@ export function updatingConnection( connectionId, updating = true ) { * * @param {string} reconnectingAccount - Account being reconnected. * - * @returns {object} Reconnecting account action. + * @return {object} Reconnecting account action. */ export function setReconnectingAccount( reconnectingAccount ) { return { @@ -454,9 +454,9 @@ export function setReconnectingAccount( reconnectingAccount ) { /** * Updates a connection. * - * @param {string} connectionId - Connection ID to update. - * @param {Record} data - The data for API call. - * @returns {void} + * @param {string} connectionId - Connection ID to update. + * @param {Record} data - The data for API call. + * @return {void} */ export function updateConnectionById( connectionId, data ) { return async function ( { dispatch, select } ) { @@ -505,7 +505,7 @@ export function updateConnectionById( connectionId, data ) { * * @param {boolean} isOpen - Whether the modal is open. * - * @returns {object} - An action object. + * @return {object} - An action object. */ export function toggleConnectionsModal( isOpen ) { return { @@ -517,7 +517,7 @@ export function toggleConnectionsModal( isOpen ) { /** * Opens the connections modal. * - * @returns {object} - An action object. + * @return {object} - An action object. */ export function openConnectionsModal() { return toggleConnectionsModal( true ); @@ -525,7 +525,7 @@ export function openConnectionsModal() { /** * Closes the connections modal. - * @returns {object} - An action object. + * @return {object} - An action object. */ export function closeConnectionsModal() { return toggleConnectionsModal( false ); diff --git a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-settings.js b/projects/js-packages/publicize-components/src/social-store/actions/jetpack-settings.js index 1a6692d77791f..535928f4e16d3 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-settings.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/jetpack-settings.js @@ -12,8 +12,8 @@ export const TOGGLE_PUBLICIZE_MODULE = 'TOGGLE_PUBLICIZE_MODULE'; * Yield actions to update settings * * @param {object} settings - settings to apply. - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateJetpackSettings( settings ) { try { @@ -35,7 +35,7 @@ export function* updateJetpackSettings( settings ) { /** * Set state updating action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingJetpackSettings() { return setJetpackSettings( { is_updating: true } ); @@ -44,7 +44,7 @@ export function setUpdatingJetpackSettings() { /** * Set state updating finished * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingJetpackSettingsDone() { return setJetpackSettings( { is_updating: false } ); @@ -54,7 +54,7 @@ export function setUpdatingJetpackSettingsDone() { * Set Jetpack settings action * * @param {object} options - Jetpack settings. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setJetpackSettings( options ) { return { type: SET_JETPACK_SETTINGS, options }; diff --git a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js b/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js index 0273a6fdf8f8f..23827a6261787 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/jetpack-social-settings.js @@ -8,8 +8,8 @@ import { /** * Yield actions to refresh all of the Jetpack Social registered settings. * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* refreshJetpackSocialSettings() { try { diff --git a/projects/js-packages/publicize-components/src/social-store/actions/social-image-generator-settings.js b/projects/js-packages/publicize-components/src/social-store/actions/social-image-generator-settings.js index 22d1f4917b733..73fc4ad0ae7f0 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/social-image-generator-settings.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/social-image-generator-settings.js @@ -11,8 +11,8 @@ export const SET_SOCIAL_IMAGE_GENERATOR_SETTINGS = 'SET_SOCIAL_IMAGE_GENERATOR_S * Yield actions to update settings * * @param {object} settings - settings to apply. - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateSocialImageGeneratorSettings( settings ) { try { @@ -36,7 +36,7 @@ export function* updateSocialImageGeneratorSettings( settings ) { /** * Set state updating action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingSocialImageGeneratorSettings() { return setSocialImageGeneratorSettings( { isUpdating: true } ); @@ -45,7 +45,7 @@ export function setUpdatingSocialImageGeneratorSettings() { /** * Set state updating finished * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingSocialImageGeneratorSettingsDone() { return setSocialImageGeneratorSettings( { isUpdating: false } ); @@ -55,7 +55,7 @@ export function setUpdatingSocialImageGeneratorSettingsDone() { * Set Social Image Generator settings action * * @param {object} options - Social Image Generator settings. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setSocialImageGeneratorSettings( options ) { return { type: SET_SOCIAL_IMAGE_GENERATOR_SETTINGS, options }; @@ -64,8 +64,8 @@ export function setSocialImageGeneratorSettings( options ) { /** * Yield actions to refresh settings * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* refreshSocialImageGeneratorSettings() { try { diff --git a/projects/js-packages/publicize-components/src/social-store/actions/social-notes-settings.js b/projects/js-packages/publicize-components/src/social-store/actions/social-notes-settings.js index f45f03a23a10f..35243885cd383 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/social-notes-settings.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/social-notes-settings.js @@ -10,8 +10,8 @@ import { setJetpackSettings } from './jetpack-settings'; * Yield actions to update settings * * @param {object} settings - settings to apply. - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateSocialNotesSettings( settings ) { try { @@ -34,8 +34,8 @@ export function* updateSocialNotesSettings( settings ) { * Yield actions to update settings * * @param {object} config - config to update - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateSocialNotesConfig( config ) { const prevConfig = select( SOCIAL_STORE_ID ).getSocialNotesConfig(); @@ -55,8 +55,8 @@ export function* updateSocialNotesConfig( config ) { /** * Yield actions to refresh settings * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* refreshSocialNotesSettings() { try { @@ -74,7 +74,7 @@ export function* refreshSocialNotesSettings() { /** * Set state updating action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingSocialNotesSettings() { return setJetpackSettings( { social_notes_is_updating: true } ); @@ -83,7 +83,7 @@ export function setUpdatingSocialNotesSettings() { /** * Set state updating finished * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingSocialNotesSettingsDone() { return setJetpackSettings( { social_notes_is_updating: false } ); @@ -92,7 +92,7 @@ export function setUpdatingSocialNotesSettingsDone() { /** * Set state updating action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingSocialNotesConfig() { return setJetpackSettings( { social_notes_config_is_updating: true } ); diff --git a/projects/js-packages/publicize-components/src/social-store/actions/test/connection-data.js b/projects/js-packages/publicize-components/src/social-store/actions/test/connection-data.js index 78d68ece7d2c9..e4ebbc87cbde1 100644 --- a/projects/js-packages/publicize-components/src/social-store/actions/test/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/actions/test/connection-data.js @@ -14,7 +14,7 @@ const post = { * * @param {boolean} initConnections - Whether to set initial connections. * - * @returns {WPDataRegistry} Registry. + * @return {WPDataRegistry} Registry. */ function createRegistryWithStores( initConnections = true ) { // Create a registry. diff --git a/projects/js-packages/publicize-components/src/social-store/controls.js b/projects/js-packages/publicize-components/src/social-store/controls.js index a0418877b2be4..7830da3898d67 100644 --- a/projects/js-packages/publicize-components/src/social-store/controls.js +++ b/projects/js-packages/publicize-components/src/social-store/controls.js @@ -10,7 +10,7 @@ export const FETCH_JETPACK_SOCIAL_SETTINGS = 'FETCH_JETPACK_SOCIAL_SETTINGS'; /** * fetchJetpackSettings action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchJetpackSettings = () => { return { @@ -22,7 +22,7 @@ export const fetchJetpackSettings = () => { * updateJetpackSettings action * * @param {*} settings - Jetpack settings object. - * @returns {object} - an action object. + * @return {object} - an action object. */ export const updateJetpackSettings = settings => { return { @@ -34,7 +34,7 @@ export const updateJetpackSettings = settings => { /** * fetchSocialImageGeneratorSettings action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchSocialImageGeneratorSettings = () => { return { @@ -46,7 +46,7 @@ export const fetchSocialImageGeneratorSettings = () => { * updateSocialImageGeneratorSettings action * * @param {*} settings - Social Image Generator settings object. - * @returns {object} - an action object. + * @return {object} - an action object. */ export const updateSocialImageGeneratorSettings = settings => { return { @@ -58,7 +58,7 @@ export const updateSocialImageGeneratorSettings = settings => { /** * fetchJetpackSocialSettings action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchJetpackSocialSettings = () => { return { diff --git a/projects/js-packages/publicize-components/src/social-store/reducer/connection-data.js b/projects/js-packages/publicize-components/src/social-store/reducer/connection-data.js index b99683e85605e..c8f350f077eb6 100644 --- a/projects/js-packages/publicize-components/src/social-store/reducer/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/reducer/connection-data.js @@ -17,9 +17,9 @@ import { /** * Connection data reducer * - * @param {import('../types').ConnectionData} state - Current state. - * @param {object} action - Action object. - * @returns {import('../types').ConnectionData} The new state. + * @param {import('../types').ConnectionData} state - Current state. + * @param {object} action - Action object. + * @return {import('../types').ConnectionData} The new state. */ const connectionData = ( state = {}, action ) => { switch ( action.type ) { diff --git a/projects/js-packages/publicize-components/src/social-store/resolvers.js b/projects/js-packages/publicize-components/src/social-store/resolvers.js index 8024cc5dd5c50..6dc45a4debde7 100644 --- a/projects/js-packages/publicize-components/src/social-store/resolvers.js +++ b/projects/js-packages/publicize-components/src/social-store/resolvers.js @@ -7,8 +7,8 @@ import { fetchJetpackSettings, fetchSocialImageGeneratorSettings } from './contr /** * Yield actions to get the Jetpack settings. * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getJetpackSettings() { try { @@ -25,8 +25,8 @@ export function* getJetpackSettings() { /** * Yield actions to get the Social Image Generator settings. * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getSocialImageGeneratorSettings() { try { @@ -43,7 +43,7 @@ export function* getSocialImageGeneratorSettings() { /** * Resolves the connections from the post. * - * @returns {Function} Resolver + * @return {Function} Resolver */ export function getConnections() { return function ( { dispatch, registry } ) { diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js b/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js index 12eadb9a05610..2c4fd4542b5f8 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js +++ b/projects/js-packages/publicize-components/src/social-store/selectors/connection-data.js @@ -5,7 +5,7 @@ import { REQUEST_TYPE_DEFAULT } from '../actions/constants'; * * @param {import("../types").SocialStoreState} state - State object. * - * @returns {Array} The connections list + * @return {Array} The connections list */ export function getConnections( state ) { return state.connectionData?.connections ?? []; @@ -14,10 +14,10 @@ export function getConnections( state ) { /** * Return a connection by its ID. * - * @param {import("../types").SocialStoreState} state - State object. - * @param {string} connectionId - The connection ID. + * @param {import("../types").SocialStoreState} state - State object. + * @param {string} connectionId - The connection ID. * - * @returns {import("../types").Connection | undefined} The connection. + * @return {import("../types").Connection | undefined} The connection. */ export function getConnectionById( state, connectionId ) { return getConnections( state ).find( connection => connection.connection_id === connectionId ); @@ -26,10 +26,10 @@ export function getConnectionById( state, connectionId ) { /** * Returns connections by service name/ID. * - * @param {import("../types").SocialStoreState} state - State object. - * @param {string} serviceName - The service name. + * @param {import("../types").SocialStoreState} state - State object. + * @param {string} serviceName - The service name. * - * @returns {Array} The connections. + * @return {Array} The connections. */ export function getConnectionsByService( state, serviceName ) { return getConnections( state ).filter( ( { service_name } ) => service_name === serviceName ); @@ -38,7 +38,7 @@ export function getConnectionsByService( state, serviceName ) { /** * Returns the connections admin URL from the store. * @param {import("../types").SocialStoreState} state - State object. - * @returns {string|null} The connections admin URL. + * @return {string|null} The connections admin URL. */ export function getConnectionsAdminUrl( state ) { return state.connectionData?.adminUrl ?? null; @@ -47,7 +47,7 @@ export function getConnectionsAdminUrl( state ) { /** * Returns whether there are connections in the store. * @param {import("../types").SocialStoreState} state - State object. - * @returns {boolean} Whether there are connections. + * @return {boolean} Whether there are connections. */ export function hasConnections( state ) { return getConnections( state ).length > 0; @@ -57,7 +57,7 @@ export function hasConnections( state ) { * Returns the failed Publicize connections. * * @param {import("../types").SocialStoreState} state - State object. - * @returns {Array} List of connections. + * @return {Array} List of connections. */ export function getFailedConnections( state ) { const connections = getConnections( state ); @@ -70,7 +70,7 @@ export function getFailedConnections( state ) { * iFor example, when LinkedIn switched its API from v1 to v2. * * @param {import("../types").SocialStoreState} state - State object. - * @returns {Array} List of service names that need reauthentication. + * @return {Array} List of service names that need reauthentication. */ export function getMustReauthConnections( state ) { const connections = getConnections( state ); @@ -84,7 +84,7 @@ export function getMustReauthConnections( state ) { * * @param {import("../types").SocialStoreState} state - State object. * - * @returns {Array} List of enabled connections. + * @return {Array} List of enabled connections. */ export function getEnabledConnections( state ) { return getConnections( state ).filter( connection => connection.enabled ); @@ -95,7 +95,7 @@ export function getEnabledConnections( state ) { * * @param {import("../types").SocialStoreState} state - State object. * - * @returns {Array} List of disabled connections. + * @return {Array} List of disabled connections. */ export function getDisabledConnections( state ) { return getConnections( state ).filter( connection => ! connection.enabled ); @@ -104,12 +104,12 @@ export function getDisabledConnections( state ) { /** * Get the profile details for a connection * - * @param {import("../types").SocialStoreState} state - State object. - * @param {string} service - The service name. - * @param {object} args - Arguments. - * @param {boolean} args.forceDefaults - Whether to use default values. + * @param {import("../types").SocialStoreState} state - State object. + * @param {string} service - The service name. + * @param {object} args - Arguments. + * @param {boolean} args.forceDefaults - Whether to use default values. * - * @returns {object} The profile details. + * @return {object} The profile details. */ export function getConnectionProfileDetails( state, service, { forceDefaults = false } = {} ) { let displayName = ''; @@ -137,7 +137,7 @@ export function getConnectionProfileDetails( state, service, { forceDefaults = f * Get the connections being deleted. * * @param {import("../types").SocialStoreState} state - State object. - * @returns {import("../types").ConnectionData['deletingConnections']} The connection being deleted. + * @return {import("../types").ConnectionData['deletingConnections']} The connection being deleted. */ export function getDeletingConnections( state ) { return state.connectionData?.deletingConnections ?? []; @@ -147,7 +147,7 @@ export function getDeletingConnections( state ) { * Get the connections being updated. * * @param {import("../types").SocialStoreState} state - State object. - * @returns {import("../types").ConnectionData['updatingConnections']} The connection being updated. + * @return {import("../types").ConnectionData['updatingConnections']} The connection being updated. */ export function getUpdatingConnections( state ) { return state.connectionData?.updatingConnections ?? []; @@ -157,7 +157,7 @@ export function getUpdatingConnections( state ) { * Get the account being reconnected * * @param {import("../types").SocialStoreState} state - State object. - * @returns {import("../types").ConnectionData['reconnectingAccount']} The account being reconnected. + * @return {import("../types").ConnectionData['reconnectingAccount']} The account being reconnected. */ export function getReconnectingAccount( state ) { return state.connectionData?.reconnectingAccount ?? ''; @@ -166,10 +166,10 @@ export function getReconnectingAccount( state ) { /** * Get the abort controllers for a specific request type. * - * @param {import("../types").SocialStoreState} state - State object. - * @param {string} requestType - The request type. + * @param {import("../types").SocialStoreState} state - State object. + * @param {string} requestType - The request type. * - * @returns {Array} The abort controllers. + * @return {Array} The abort controllers. */ export function getAbortControllers( state, requestType = REQUEST_TYPE_DEFAULT ) { return state.connectionData?.abortControllers?.[ requestType ] ?? []; @@ -178,10 +178,10 @@ export function getAbortControllers( state, requestType = REQUEST_TYPE_DEFAULT ) /** * Whether a mastodon account is already connected. * - * @param {import("../types").SocialStoreState} state - State object. - * @param {string} username - The mastodon username. + * @param {import("../types").SocialStoreState} state - State object. + * @param {string} username - The mastodon username. * - * @returns {boolean} Whether the mastodon account is already connected. + * @return {boolean} Whether the mastodon account is already connected. */ export function isMastodonAccountAlreadyConnected( state, username ) { return getConnectionsByService( state, 'mastodon' ).some( connection => { @@ -194,7 +194,7 @@ export function isMastodonAccountAlreadyConnected( state, username ) { * * @param {import("../types").SocialStoreState} state - State object. * - * @returns {import("../types").KeyringResult} The KeyringResult + * @return {import("../types").KeyringResult} The KeyringResult */ export function getKeyringResult( state ) { return state.connectionData?.keyringResult; @@ -204,7 +204,7 @@ export function getKeyringResult( state ) { * Whether the connections modal is open. * @param {import("../types").SocialStoreState} state - State object. * - * @returns {boolean} Whether the connections modal is open. + * @return {boolean} Whether the connections modal is open. */ export function isConnectionsModalOpen( state ) { return state.connectionData?.isConnectionsModalOpen ?? false; diff --git a/projects/js-packages/publicize-components/src/social-store/selectors/shares-data.ts b/projects/js-packages/publicize-components/src/social-store/selectors/shares-data.ts index 732a554fef15f..2d2716f7e5e7c 100644 --- a/projects/js-packages/publicize-components/src/social-store/selectors/shares-data.ts +++ b/projects/js-packages/publicize-components/src/social-store/selectors/shares-data.ts @@ -6,7 +6,7 @@ import settings from './jetpack-settings'; * * @param {SocialStoreState} state - Global state tree * - * @returns {boolean} Whether the share limit is enabled + * @return {boolean} Whether the share limit is enabled */ export function isShareLimitEnabled( state: SocialStoreState ) { return state.sharesData?.is_share_limit_enabled ?? false; @@ -17,7 +17,7 @@ export function isShareLimitEnabled( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {boolean} Whether to show the share limits + * @return {boolean} Whether to show the share limits */ export function showShareLimits( state: SocialStoreState ) { if ( settings.hasPaidPlan( state ) || state.hasPaidPlan ) { @@ -31,7 +31,7 @@ export function showShareLimits( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {number} Current share limit + * @return {number} Current share limit */ export function getShareLimit( state: SocialStoreState ) { return state.sharesData?.share_limit ?? 30; @@ -42,7 +42,7 @@ export function getShareLimit( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {number} Total number of shares used + * @return {number} Total number of shares used */ export function getSharesUsedCount( state: SocialStoreState ) { return state.sharesData?.publicized_count ?? 0; @@ -53,7 +53,7 @@ export function getSharesUsedCount( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {number} Number of shares scheduled + * @return {number} Number of shares scheduled */ export function getScheduledSharesCount( state: SocialStoreState ) { return state.sharesData?.to_be_publicized_count ?? 0; @@ -64,7 +64,7 @@ export function getScheduledSharesCount( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {number} Total number of shares used and scheduled + * @return {number} Total number of shares used and scheduled */ export function getTotalSharesCount( state: SocialStoreState ) { const count = getSharesUsedCount( state ) + getScheduledSharesCount( state ); @@ -77,7 +77,7 @@ export function getTotalSharesCount( state: SocialStoreState ) { * * @param {SocialStoreState} state - Global state tree * - * @returns {number} Number of posts shared this month + * @return {number} Number of posts shared this month */ export function getSharedPostsCount( state: SocialStoreState ) { return state.sharesData?.shared_posts_count ?? 0; @@ -93,10 +93,10 @@ export type NumberOfSharesRemainingOptions = { /** * Returns the number of shares remaining. * - * @param {SocialStoreState} state - Global state tree + * @param {SocialStoreState} state - Global state tree * @param {NumberOfSharesRemainingOptions} options - Options * - * @returns {number} Number of shares remaining + * @return {number} Number of shares remaining */ export function numberOfSharesRemaining( state: SocialStoreState, diff --git a/projects/js-packages/publicize-components/src/utils/get-share-message-max-length.js b/projects/js-packages/publicize-components/src/utils/get-share-message-max-length.js index b1817ee28f831..15c0ba8260ba1 100644 --- a/projects/js-packages/publicize-components/src/utils/get-share-message-max-length.js +++ b/projects/js-packages/publicize-components/src/utils/get-share-message-max-length.js @@ -7,7 +7,7 @@ const MAXIMUM_MESSAGE_LENGTH = 280 - ATTACHMENT_MESSAGE_PADDING - 1; /** * Get the maximum length that a share message can be. * - * @returns {number} The maximum length of a share message. + * @return {number} The maximum length of a share message. */ export function getShareMessageMaxLength() { return MAXIMUM_MESSAGE_LENGTH; diff --git a/projects/js-packages/publicize-components/src/utils/get-supported-additional-connections.js b/projects/js-packages/publicize-components/src/utils/get-supported-additional-connections.js index 7b4b3896eda45..7899eded54a76 100644 --- a/projects/js-packages/publicize-components/src/utils/get-supported-additional-connections.js +++ b/projects/js-packages/publicize-components/src/utils/get-supported-additional-connections.js @@ -3,7 +3,7 @@ import { getJetpackData } from '@automattic/jetpack-shared-extension-utils'; /** * Get a list of additional connections that are supported by the current plan. * - * @returns {Array} A list of connection names + * @return {Array} A list of connection names */ export function getSupportedAdditionalConnections() { return getJetpackData()?.social?.supportedAdditionalConnections || []; diff --git a/projects/js-packages/publicize-components/src/utils/request-external-access.js b/projects/js-packages/publicize-components/src/utils/request-external-access.js index e468fb67eff32..b38dccef8a3a8 100644 --- a/projects/js-packages/publicize-components/src/utils/request-external-access.js +++ b/projects/js-packages/publicize-components/src/utils/request-external-access.js @@ -8,8 +8,8 @@ import PopupMonitor from '@automattic/popup-monitor'; /** * Utility for requesting authorization of sharing services. - * @param {string} url - The URL to be loaded in the newly opened window. - * @param {requestCallback} cb - The callback that handles the response. + * @param {string} url - The URL to be loaded in the newly opened window. + * @param {requestCallback} cb - The callback that handles the response. */ export const requestExternalAccess = ( url, cb ) => { const popupMonitor = new PopupMonitor(); diff --git a/projects/js-packages/publicize-components/src/utils/script-data.ts b/projects/js-packages/publicize-components/src/utils/script-data.ts index 9707648ae940b..4db102747a639 100644 --- a/projects/js-packages/publicize-components/src/utils/script-data.ts +++ b/projects/js-packages/publicize-components/src/utils/script-data.ts @@ -4,7 +4,7 @@ import { SocialScriptData } from '../types/types'; /** * Get the social script data from the window object. * - * @returns {SocialScriptData} The social script data. + * @return {SocialScriptData} The social script data. */ export function getSocialScriptData(): SocialScriptData { return getScriptData().social; diff --git a/projects/js-packages/publicize-components/src/utils/test-utils.js b/projects/js-packages/publicize-components/src/utils/test-utils.js index c572f00193b44..857e4ecc1585d 100644 --- a/projects/js-packages/publicize-components/src/utils/test-utils.js +++ b/projects/js-packages/publicize-components/src/utils/test-utils.js @@ -69,7 +69,7 @@ export const connections = [ * * @param {object} postAttributes - Post attributes. * - * @returns {WPDataRegistry} Registry. + * @return {WPDataRegistry} Registry. */ export function createRegistryWithStores( postAttributes = {} ) { // Create a registry. @@ -104,7 +104,7 @@ export function createRegistryWithStores( postAttributes = {} ) { * * @param {number} count - Number of active connections to create. * - * @returns {Array} Array of active connections. + * @return {Array} Array of active connections. */ export function createActiveConnections( count ) { return [ diff --git a/projects/js-packages/react-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/react-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/react-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/react-data-sync-client/package.json b/projects/js-packages/react-data-sync-client/package.json index c87ed178ff0f9..339fb6f89886e 100644 --- a/projects/js-packages/react-data-sync-client/package.json +++ b/projects/js-packages/react-data-sync-client/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-react-data-sync-client", - "version": "0.1.3", + "version": "0.1.4-alpha", "description": "DataSync client for React", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/react-data-sync-client/#readme", "bugs": { diff --git a/projects/js-packages/react-data-sync-client/src/DataSync.ts b/projects/js-packages/react-data-sync-client/src/DataSync.ts index e063d0d0c1539..8d3b78b76e4d7 100644 --- a/projects/js-packages/react-data-sync-client/src/DataSync.ts +++ b/projects/js-packages/react-data-sync-client/src/DataSync.ts @@ -65,8 +65,8 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema * This would make a request to: http://localhost/wp-json/namespace/key * * @param namespace - The namespace of the endpoint. This matches the name of the global variable (window.{namespace}.{endpoint_name}). - * @param key - The key of the value that's being synced. This is used to fetch the value from the global window object. - * @param schema - The Zod schema to validate the value against. This ensures that the value is of the expected type. + * @param key - The key of the value that's being synced. This is used to fetch the value from the global window object. + * @param schema - The Zod schema to validate the value against. This ensures that the value is of the expected type. */ constructor( namespace: string, @@ -129,7 +129,7 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema * Helper function to get values * from the window object and validate them. * - * @param valueName - The name of the value. For example, `posts`. + * @param valueName - The name of the value. For example, `posts`. * @param valueSchema - The Zod schema to validate the value against. * @returns The parsed value. */ @@ -175,11 +175,11 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to make a request to the endpoint. - * @param method - The request method. + * @param method - The request method. * @param partialPathname - The request path. - * @param value - Data to send when using POST. - * @param params - Append query params to the URL. Takes in an object of key/value pairs. - * @param abortSignal - The abort signal. + * @param value - Data to send when using POST. + * @param params - Append query params to the URL. Takes in an object of key/value pairs. + * @param abortSignal - The abort signal. * @returns The parsed value. * @throws ApiError * @throws Error @@ -276,9 +276,9 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to parse the request. - * @param method - The request method. + * @param method - The request method. * @param requestPath - The request path. - * @param value - The request parameters. + * @param value - The request parameters. * @param abortSignal - The abort signal. * @returns The parsed value. */ @@ -337,7 +337,7 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to attempt the request. - * @param url - The request URL. + * @param url - The request URL. * @param args - The request arguments. * @returns The result of the request. */ @@ -410,7 +410,7 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Trigger an endpoint action - * @param name - The name of the action. + * @param name - The name of the action. * @param value - The value to send to the endpoint. * @returns A direct response from the endpoint. */ diff --git a/projects/js-packages/react-data-sync-client/src/DataSyncHooks.ts b/projects/js-packages/react-data-sync-client/src/DataSyncHooks.ts index 603e7e0f862d1..2ae4b3585527c 100644 --- a/projects/js-packages/react-data-sync-client/src/DataSyncHooks.ts +++ b/projects/js-packages/react-data-sync-client/src/DataSyncHooks.ts @@ -71,10 +71,10 @@ function buildQueryKey( key: string, params: Record< string, string | number > ) /** * React Query hook for DataSync. * @param namespace - The namespace of the endpoint. - * @param key - The key of the value that's being synced. - * @param schema - The Zod schema to validate the value against. - * @param config - React Query configuration. - * @param params - key/value pairs to be used as GET parameters. + * @param key - The key of the value that's being synced. + * @param schema - The Zod schema to validate the value against. + * @param config - React Query configuration. + * @param params - key/value pairs to be used as GET parameters. * @returns A tuple of React Query hooks. * @see https://tanstack.com/query/v5/docs/react/reference/useQuery * @see https://tanstack.com/query/v5/docs/react/reference/useMutation diff --git a/projects/js-packages/script-data/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/script-data/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/script-data/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/script-data/package.json b/projects/js-packages/script-data/package.json index 7688537f442af..bee09b5ab60bd 100644 --- a/projects/js-packages/script-data/package.json +++ b/projects/js-packages/script-data/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-script-data", - "version": "0.1.1", + "version": "0.1.2-alpha", "description": "A library to provide data for script handles and the corresponding utility functions for Jetpack.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/script-data/#readme", "bugs": { diff --git a/projects/js-packages/script-data/src/utils.ts b/projects/js-packages/script-data/src/utils.ts index e23463e308d06..690b6f4f7c298 100644 --- a/projects/js-packages/script-data/src/utils.ts +++ b/projects/js-packages/script-data/src/utils.ts @@ -1,7 +1,7 @@ /** * Get the script data from the window object. * - * @returns {import('./types').JetpackScriptData} The script data. + * @return {import('./types').JetpackScriptData} The script data. */ export function getScriptData() { return window.JetpackScriptData; @@ -10,7 +10,7 @@ export function getScriptData() { /** * Get the site data from the script data. * - * @returns {import('./types').SiteData} The site data. + * @return {import('./types').SiteData} The site data. */ export function getSiteData() { return getScriptData().site; @@ -21,7 +21,7 @@ export function getSiteData() { * * @param {string} [path] - The path to append to the admin URL. e.g. `admin.php?page=jetpack`. * - * @returns {string} The admin URL. + * @return {string} The admin URL. */ export function getAdminUrl( path = '' ) { return `${ getScriptData().site.admin_url }${ path }`; @@ -32,7 +32,7 @@ export function getAdminUrl( path = '' ) { * * @param {string} [section] - The section to append to the My Jetpack URL. e.g. `#/settings`. * - * @returns {string} The Jetpack admin page URL. + * @return {string} The Jetpack admin page URL. */ export function getJetpackAdminPageUrl( section = '' ) { return getAdminUrl( `admin.php?page=jetpack${ section }` ); @@ -43,7 +43,7 @@ export function getJetpackAdminPageUrl( section = '' ) { * * @param {string} [section] - The section to append to the My Jetpack URL. e.g. `#/connection`. * - * @returns {string} The My Jetpack URL. + * @return {string} The My Jetpack URL. */ export function getMyJetpackUrl( section = '' ) { return getAdminUrl( `admin.php?page=my-jetpack${ section }` ); @@ -52,7 +52,7 @@ export function getMyJetpackUrl( section = '' ) { /** * Get active features from the site plan. * - * @returns {import('./types').SitePlan['features']['active']} The active features. + * @return {import('./types').SitePlan['features']['active']} The active features. */ export function getActiveFeatures() { return getScriptData().site.plan?.features?.active ?? []; diff --git a/projects/js-packages/shared-extension-utils/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/shared-extension-utils/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/shared-extension-utils/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/shared-extension-utils/package.json b/projects/js-packages/shared-extension-utils/package.json index d9a37608e695e..1721a83481cb3 100644 --- a/projects/js-packages/shared-extension-utils/package.json +++ b/projects/js-packages/shared-extension-utils/package.json @@ -1,6 +1,6 @@ { "name": "@automattic/jetpack-shared-extension-utils", - "version": "0.15.3", + "version": "0.15.4-alpha", "description": "Utility functions used by the block editor extensions", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/shared-extension-utils/#readme", "bugs": { diff --git a/projects/js-packages/shared-extension-utils/src/components/jetpack-editor-panel-logo/index.jsx b/projects/js-packages/shared-extension-utils/src/components/jetpack-editor-panel-logo/index.jsx index 15f09ec6ec3f4..a8a5e551e3801 100644 --- a/projects/js-packages/shared-extension-utils/src/components/jetpack-editor-panel-logo/index.jsx +++ b/projects/js-packages/shared-extension-utils/src/components/jetpack-editor-panel-logo/index.jsx @@ -6,7 +6,7 @@ import './style.scss'; /** * The Jetpack logo used for block editor panels * - * @returns {React.Component} Jetpack logo component + * @return {React.Component} Jetpack logo component */ const JetpackEditorPanelLogo = () => ( { const { isModuleActive, isChangingStatus, isLoadingModules } = useSelect( diff --git a/projects/js-packages/shared-extension-utils/src/is-current-user-connected.js b/projects/js-packages/shared-extension-utils/src/is-current-user-connected.js index f2c14aa275194..43df9d9080a4b 100644 --- a/projects/js-packages/shared-extension-utils/src/is-current-user-connected.js +++ b/projects/js-packages/shared-extension-utils/src/is-current-user-connected.js @@ -3,7 +3,7 @@ import getJetpackData from './get-jetpack-data'; /** * Return whether the current user is connected to WP.com. * - * @returns {boolean} Whether the current user is connected. + * @return {boolean} Whether the current user is connected. */ export default function isCurrentUserConnected() { return getJetpackData()?.jetpack?.is_current_user_connected ?? false; diff --git a/projects/js-packages/shared-extension-utils/src/is-my-jetpack-available.js b/projects/js-packages/shared-extension-utils/src/is-my-jetpack-available.js index 7d6a92fd097e0..9019c81d7a0b5 100644 --- a/projects/js-packages/shared-extension-utils/src/is-my-jetpack-available.js +++ b/projects/js-packages/shared-extension-utils/src/is-my-jetpack-available.js @@ -6,7 +6,7 @@ import getJetpackData from './get-jetpack-data'; * @see https://github.com/Automattic/jetpack/pull/38500 introduced the is_my_jetpack_available flag * The value is the same that can be found on Initial_State.siteData.showMyJetpack (dashboard context) * - * @returns {boolean} Object indicating if My Jetpack is available (so to navigate to interstitials and product pages) + * @return {boolean} Object indicating if My Jetpack is available (so to navigate to interstitials and product pages) */ export default function isMyJetpackAvailable() { return getJetpackData()?.jetpack?.is_my_jetpack_available === true; diff --git a/projects/js-packages/shared-extension-utils/src/modules-state/actions.js b/projects/js-packages/shared-extension-utils/src/modules-state/actions.js index 6b17928ca63ef..628f305a488a3 100644 --- a/projects/js-packages/shared-extension-utils/src/modules-state/actions.js +++ b/projects/js-packages/shared-extension-utils/src/modules-state/actions.js @@ -12,11 +12,11 @@ export const SET_MODULE_UPDATING = 'SET_MODULE_UPDATING'; /** * Yield actions to update module status * - * @param {object} settings - Jetpack module settings. - * @param {string} settings.name - Jetpack module name. + * @param {object} settings - Jetpack module settings. + * @param {string} settings.name - Jetpack module name. * @param {boolean} settings.active - If the module is active or not. - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateJetpackModuleStatus( settings ) { try { @@ -36,8 +36,8 @@ export function* updateJetpackModuleStatus( settings ) { /** * Yield actions to update module status - * @yields {object} - an action object. - * @returns {boolean} - if operation is successful or not. + * @yield {object} - an action object. + * @return {boolean} - if operation is successful or not. */ export function* fetchModules() { // We don't fetch modules for Simple Site and aknowledge that all modules are active @@ -62,7 +62,7 @@ export function* fetchModules() { * Set modules as loading action * * @param {boolean} isLoading - If the modules are loading or not. - * @returns {object} - an action object. + * @return {object} - an action object. */ function setIsLoading( isLoading ) { return setJetpackModules( { isLoading } ); @@ -71,9 +71,9 @@ function setIsLoading( isLoading ) { /** * Set modules as updating action * - * @param {string} name - Name of the module. + * @param {string} name - Name of the module. * @param {boolean} isUpdating - If the modules are updating or not. - * @returns {object} - an action object. + * @return {object} - an action object. */ function setIsUpdating( name, isUpdating ) { return { type: SET_MODULE_UPDATING, name, isUpdating }; @@ -82,10 +82,10 @@ function setIsUpdating( name, isUpdating ) { /** * Set Jetpack module action * - * @param {object} options - Jetpack settings. - * @param {object} options.modules - Jetpack modules. + * @param {object} options - Jetpack settings. + * @param {object} options.modules - Jetpack modules. * @param {boolean} options.isLoading - If the modules are loading or not. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setJetpackModules( options ) { return { type: SET_JETPACK_MODULES, options }; diff --git a/projects/js-packages/shared-extension-utils/src/modules-state/controls.js b/projects/js-packages/shared-extension-utils/src/modules-state/controls.js index 1b811a77d4687..fd348075738ac 100644 --- a/projects/js-packages/shared-extension-utils/src/modules-state/controls.js +++ b/projects/js-packages/shared-extension-utils/src/modules-state/controls.js @@ -6,7 +6,7 @@ export const UPDATE_JETPACK_MODULE_STATUS = 'UPDATE_JETPACK_MODULE_STATUS'; /** * fetchJetpackModules action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchJetpackModules = () => { return { @@ -17,8 +17,8 @@ export const fetchJetpackModules = () => { /** * Updating single module status action * - * @param settings - Jetpack module settings. - * @param {string} settings.name - Jetpack module name. + * @param settings - Jetpack module settings. + * @param {string} settings.name - Jetpack module name. * @param {boolean} settings.active - If the module is active or not. */ diff --git a/projects/js-packages/shared-extension-utils/src/modules-state/resolvers.js b/projects/js-packages/shared-extension-utils/src/modules-state/resolvers.js index 7bdab717e1709..3b4032cc8777d 100644 --- a/projects/js-packages/shared-extension-utils/src/modules-state/resolvers.js +++ b/projects/js-packages/shared-extension-utils/src/modules-state/resolvers.js @@ -4,8 +4,8 @@ import { fetchJetpackModules } from './controls'; /** * Yield actions to get the Jetpack modules. * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getJetpackModules() { try { diff --git a/projects/js-packages/shared-extension-utils/src/plan-utils.js b/projects/js-packages/shared-extension-utils/src/plan-utils.js index 9899c8467210e..b3bcaed6fce0e 100644 --- a/projects/js-packages/shared-extension-utils/src/plan-utils.js +++ b/projects/js-packages/shared-extension-utils/src/plan-utils.js @@ -10,12 +10,12 @@ import { isAtomicSite, isSimpleSite } from './site-type-utils'; * Return the checkout URL to upgrade the site plan, * depending on the plan, postId, and postType site values. * - * @param {object} siteParams - Site params used to build the URL. + * @param {object} siteParams - Site params used to build the URL. * @param {string} siteParams.planSlug - Plan slug. - * @param {object} siteParams.plan - An object with details about the plan. - * @param {number} siteParams.postId - Post id. + * @param {object} siteParams.plan - An object with details about the plan. + * @param {number} siteParams.postId - Post id. * @param {string} siteParams.postType - Post type. - * @returns {string} Upgrade URL. + * @return {string} Upgrade URL. */ export function getUpgradeUrl( { planSlug, plan, postId, postType } ) { // WP.com plan objects have a dedicated `path_slug` field, Jetpack plan objects don't. @@ -88,7 +88,7 @@ export function getUpgradeUrl( { planSlug, plan, postId, postType } ) { * the block requires a paid plan. * * @param {string} name - Block name. - * @returns {boolean} True if the block is upgradable, false otherwise. + * @return {boolean} True if the block is upgradable, false otherwise. */ export function isUpgradable( name ) { if ( ! name ) { @@ -105,8 +105,8 @@ export function isUpgradable( name ) { * Checks whether the block requires a paid plan or not. * * @param {string} unavailableReason - The reason why block is unavailable - * @param {object} details - The block details - * @returns {string|boolean} Either false if the block doesn't require a paid plan, or the actual plan name it requires. + * @param {object} details - The block details + * @return {string|boolean} Either false if the block doesn't require a paid plan, or the actual plan name it requires. */ export function requiresPaidPlan( unavailableReason, details ) { if ( unavailableReason === 'missing_plan' ) { @@ -119,7 +119,7 @@ export function requiresPaidPlan( unavailableReason, details ) { * Returns the required plan slug for a passed block name. * * @param {string} name - Block name. - * @returns {string|boolean} Plan name if the block is upgradable, false otherwise. + * @return {string|boolean} Plan name if the block is upgradable, false otherwise. */ export function getRequiredPlan( name ) { if ( ! name ) { @@ -158,7 +158,7 @@ const usableBlockWithFreePlan = [ /** * Return whether upgrade nudges are enabled or not. * - * @returns {boolean} True if the Upgrade Nudge is enable. Otherwise, False. + * @return {boolean} True if the Upgrade Nudge is enable. Otherwise, False. */ export function isUpgradeNudgeEnabled() { return get( getJetpackData(), 'jetpack.enable_upgrade_nudge', false ); diff --git a/projects/js-packages/shared-extension-utils/src/register-jetpack-plugin.js b/projects/js-packages/shared-extension-utils/src/register-jetpack-plugin.js index d013656905c8c..e48c01b7e601a 100644 --- a/projects/js-packages/shared-extension-utils/src/register-jetpack-plugin.js +++ b/projects/js-packages/shared-extension-utils/src/register-jetpack-plugin.js @@ -4,9 +4,9 @@ import getJetpackExtensionAvailability from './get-jetpack-extension-availabilit /** * Registers a Gutenberg block if the availability requirements are met. * - * @param {string} name - The plugin's name + * @param {string} name - The plugin's name * @param {object} settings - The plugin's settings. - * @returns {object|boolean} Either false if the plugin is not available, or the results of `registerPlugin` + * @return {object|boolean} Either false if the plugin is not available, or the results of `registerPlugin` */ export default function registerJetpackPlugin( name, settings ) { const { available, unavailableReason } = getJetpackExtensionAvailability( name ); diff --git a/projects/js-packages/shared-extension-utils/src/site-type-utils.js b/projects/js-packages/shared-extension-utils/src/site-type-utils.js index 55d7b6785f9a9..6c491624b630c 100644 --- a/projects/js-packages/shared-extension-utils/src/site-type-utils.js +++ b/projects/js-packages/shared-extension-utils/src/site-type-utils.js @@ -3,7 +3,7 @@ import getJetpackData from './get-jetpack-data'; /** * Get the site type from environment * - * @returns {(string|null)} Site type + * @return {(string|null)} Site type */ function getSiteType() { return 'object' === typeof window && typeof window._currentSiteType === 'string' @@ -14,7 +14,7 @@ function getSiteType() { /** * Check if environment is Simple site. * - * @returns {boolean} True for Simple sites. + * @return {boolean} True for Simple sites. */ export function isSimpleSite() { return getSiteType() === 'simple'; @@ -23,7 +23,7 @@ export function isSimpleSite() { /** * Check if environment is Atomic site. * - * @returns {boolean} True for Atomic sites. + * @return {boolean} True for Atomic sites. */ export function isAtomicSite() { return getSiteType() === 'atomic'; @@ -32,7 +32,7 @@ export function isAtomicSite() { /** * Return whether the current blog is set to private. (if blog_public option is -1) * - * @returns {boolean} whether the current blog is set to private. + * @return {boolean} whether the current blog is set to private. */ export function isPrivateSite() { const jetpackData = getJetpackData(); @@ -43,7 +43,7 @@ export function isPrivateSite() { * Return whether the current site is coming soon (i.e. not launched yet). * This is only available for WordPress.com sites so far. * - * @returns {boolean} whether the current site is coming soon. + * @return {boolean} whether the current site is coming soon. */ export function isComingSoon() { const jetpackData = getJetpackData(); diff --git a/projects/js-packages/social-logos/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/social-logos/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/social-logos/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/social-logos/src/react/example.tsx b/projects/js-packages/social-logos/src/react/example.tsx index 01f2a757f8cf9..b37aaa61e0f49 100644 --- a/projects/js-packages/social-logos/src/react/example.tsx +++ b/projects/js-packages/social-logos/src/react/example.tsx @@ -6,7 +6,7 @@ import '../css/example.css'; /** * An example React component that displays all the social logos. * - * @returns {React.Component} The `SocialLogosExample` component. + * @return {React.Component} The `SocialLogosExample` component. */ function SocialLogosExample() { const [ useSmallIcons, setUseSmallIcons ] = useState( false ); diff --git a/projects/js-packages/social-logos/tools/svg-to-react-data.js b/projects/js-packages/social-logos/tools/svg-to-react-data.js index 75c15f85ad683..2cf23e4ef6909 100755 --- a/projects/js-packages/social-logos/tools/svg-to-react-data.js +++ b/projects/js-packages/social-logos/tools/svg-to-react-data.js @@ -17,7 +17,7 @@ process.chdir( rootDir ); /** * Transforms kebab case names to camel case. * @param {string} name - e.g.: foo-bar-baz - * @returns {string} e.g.: fooBarBaz + * @return {string} e.g.: fooBarBaz */ function kebabToCamelCase( name ) { const KEBAB_REGEX = /-(\w)/g; diff --git a/projects/js-packages/storybook/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/storybook/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/storybook/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/storybook/storybook/stories/playground/index.stories.jsx b/projects/js-packages/storybook/storybook/stories/playground/index.stories.jsx index 0ea0d37e9a9dc..7efa055212b17 100644 --- a/projects/js-packages/storybook/storybook/stories/playground/index.stories.jsx +++ b/projects/js-packages/storybook/storybook/stories/playground/index.stories.jsx @@ -18,7 +18,7 @@ import './style.scss'; /** * Render our playground component * - * @returns {React.Component} - The App + * @return {React.Component} - The App */ function App() { const [ blocks, updateBlocks ] = useState( [] ); diff --git a/projects/js-packages/svelte-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/svelte-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/svelte-data-sync-client/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/svelte-data-sync-client/src/DataSync.ts b/projects/js-packages/svelte-data-sync-client/src/DataSync.ts index 6078418312657..b09bf418400b1 100644 --- a/projects/js-packages/svelte-data-sync-client/src/DataSync.ts +++ b/projects/js-packages/svelte-data-sync-client/src/DataSync.ts @@ -66,8 +66,8 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema * This would make a request to: http://localhost/wp-json/namespace/key * * @param namespace - The namespace of the endpoint. This matches the name of the global variable (window.{namespace}.{endpoint_name}). - * @param key - The key of the value that's being synced. This is used to fetch the value from the global window object. - * @param schema - The Zod schema to validate the value against. This ensures that the value is of the expected type. + * @param key - The key of the value that's being synced. This is used to fetch the value from the global window object. + * @param schema - The Zod schema to validate the value against. This ensures that the value is of the expected type. */ constructor( namespace: string, @@ -128,7 +128,7 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema * Helper function to get values * from the window object and validate them. * - * @param valueName - The name of the value. For example, `posts`. + * @param valueName - The name of the value. For example, `posts`. * @param valueSchema - The Zod schema to validate the value against. * @returns The parsed value. */ @@ -213,9 +213,9 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to parse the request. - * @param method - The request method. + * @param method - The request method. * @param requestPath - The request path. - * @param params - The request parameters. + * @param params - The request parameters. * @param abortSignal - The abort signal. * @returns The parsed value. */ @@ -240,7 +240,7 @@ export class DataSync< Schema extends z.ZodSchema, Value extends z.infer< Schema /** * Method to attempt the request. - * @param url - The request URL. + * @param url - The request URL. * @param args - The request arguments. * @returns The result of the request. */ diff --git a/projects/js-packages/videopress-core/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/videopress-core/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/videopress-core/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/videopress-core/src/index.ts b/projects/js-packages/videopress-core/src/index.ts index f72f62621a2e4..8a75100bf2985 100644 --- a/projects/js-packages/videopress-core/src/index.ts +++ b/projects/js-packages/videopress-core/src/index.ts @@ -6,7 +6,7 @@ * * @param {number} a - First number. * @param {number} b - Second number. - * @returns {number} The sum. + * @return {number} The sum. */ export function addition( a: number, b: number ): number { return a + b; diff --git a/projects/js-packages/webpack-config/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/js-packages/webpack-config/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/js-packages/webpack-config/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/js-packages/webpack-config/package.json b/projects/js-packages/webpack-config/package.json index 55647959f00bc..1a95e601ad71c 100644 --- a/projects/js-packages/webpack-config/package.json +++ b/projects/js-packages/webpack-config/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-webpack-config", - "version": "3.3.1", + "version": "3.3.2-alpha", "description": "Library of pieces for webpack config in Jetpack projects.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/webpack-config/#readme", "bugs": { diff --git a/projects/js-packages/webpack-config/src/webpack/pnpm-deterministic-ids.js b/projects/js-packages/webpack-config/src/webpack/pnpm-deterministic-ids.js index 806a7ec2d7ae3..c10a633dfc0ed 100644 --- a/projects/js-packages/webpack-config/src/webpack/pnpm-deterministic-ids.js +++ b/projects/js-packages/webpack-config/src/webpack/pnpm-deterministic-ids.js @@ -26,7 +26,7 @@ const PNPM_PATH_REGEXP = * up with colliding identifiers, but Webpack already handles that. * * @param {string} identifier - Identifier. - * @returns {string} Transformed identifier. + * @return {string} Transformed identifier. */ function fixPnpmPaths( identifier ) { return identifier.replace( PNPM_PATH_REGEXP, '.pnpm/$1' ); @@ -44,7 +44,7 @@ class PnpmDeterministicModuleIdsPlugin { * Apply the plugin * * @param {Compiler} compiler - the compiler instance - * @returns {void} + * @return {void} */ apply( compiler ) { compiler.hooks.compilation.tap( 'PnpmDeterministicModuleIdsPlugin', compilation => { diff --git a/projects/js-packages/webpack-config/src/webpack/terser.js b/projects/js-packages/webpack-config/src/webpack/terser.js index db2d7e57cca73..4c38d8320d33e 100644 --- a/projects/js-packages/webpack-config/src/webpack/terser.js +++ b/projects/js-packages/webpack-config/src/webpack/terser.js @@ -11,10 +11,10 @@ const browsers = browserslist( * Terser's function to decide which comments to preserve. * * @see https://github.com/terser/terser/blob/v5.9.0/lib/output.js#L171-L177 - * @param {object} comment - Comment object. - * @param {string} comment.type - Comment type. + * @param {object} comment - Comment object. + * @param {string} comment.type - Comment type. * @param {string} comment.value - Comment text. - * @returns {boolean} Whether to keep it. + * @return {boolean} Whether to keep it. */ function isSomeComments( comment ) { return ( @@ -28,10 +28,10 @@ function isSomeComments( comment ) { * * @see https://github.com/php-gettext/Gettext/blob/4.x/src/Utils/ParsedComment.php#L53-L73 * @see https://github.com/wp-cli/i18n-command/blob/v2.2.9/src/JsCodeExtractor.php#L15 - * @param {object} comment - Comment object. - * @param {string} comment.type - Comment type. + * @param {object} comment - Comment object. + * @param {string} comment.type - Comment type. * @param {string} comment.value - Comment text. - * @returns {boolean} Whether to keep it. + * @return {boolean} Whether to keep it. */ function isTranslatorsComment( comment ) { return ( @@ -96,7 +96,7 @@ if ( * * @param {*} a - Object A. * @param {*} b - Object B. - * @returns {*} Result: + * @return {*} Result: * - If A and B are both plain objects, like { ...a, ...b }. * - If they're arrays, elements of B replace those of A. * - If B is undefined, A. Else B. diff --git a/projects/js-packages/webpack-config/src/webpack/transpile-rule.js b/projects/js-packages/webpack-config/src/webpack/transpile-rule.js index 0d7e3e576de4e..afa09f0417c4a 100644 --- a/projects/js-packages/webpack-config/src/webpack/transpile-rule.js +++ b/projects/js-packages/webpack-config/src/webpack/transpile-rule.js @@ -5,7 +5,7 @@ const path = require( 'path' ); * Make the condition to include certain node_modules prefixes. * * @param {string[]} modules - Module prefixes to include. - * @returns {Function} Condition function. + * @return {Function} Condition function. */ function makeIncludeNodeModulesCondition( modules ) { return file => { diff --git a/projects/packages/assets/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/assets/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/assets/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/assets/src/js/i18n-loader.js b/projects/packages/assets/src/js/i18n-loader.js index 2124ea5686f4e..664e4f21a130a 100644 --- a/projects/packages/assets/src/js/i18n-loader.js +++ b/projects/packages/assets/src/js/i18n-loader.js @@ -20,10 +20,10 @@ module.exports = { /** * Download and register translations for a bundle. * - * @param {string} path - Bundle path being fetched. May have a query part. - * @param {string} domain - Text domain to register into. + * @param {string} path - Bundle path being fetched. May have a query part. + * @param {string} domain - Text domain to register into. * @param {string} location - Location for the translation: 'plugin', 'theme', or 'core'. - * @returns {Promise} Resolved when the translations are registered, or rejected with an `Error`. + * @return {Promise} Resolved when the translations are registered, or rejected with an `Error`. */ async downloadI18n( path, domain, location ) { const state = this.state; diff --git a/projects/packages/backup/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/backup/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/backup/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/backup/src/js/components/backup-promotion/index.jsx b/projects/packages/backup/src/js/components/backup-promotion/index.jsx index c20d6fc43cece..dbc38e72c3854 100644 --- a/projects/packages/backup/src/js/components/backup-promotion/index.jsx +++ b/projects/packages/backup/src/js/components/backup-promotion/index.jsx @@ -4,7 +4,7 @@ import React from 'react'; /** * BackupPromotion component definition. * - * @returns {React.Component} BackupPromotion component. + * @return {React.Component} BackupPromotion component. */ export default function BackupPromotion() { return ( diff --git a/projects/packages/backup/src/js/hooks/useCapabilities.js b/projects/packages/backup/src/js/hooks/useCapabilities.js index 797b3bfcf29b8..f01c0b1360c1c 100644 --- a/projects/packages/backup/src/js/hooks/useCapabilities.js +++ b/projects/packages/backup/src/js/hooks/useCapabilities.js @@ -5,7 +5,7 @@ import useConnection from './useConnection'; /** * Return information and loader of Backup functioality Capabilities * - * @returns {object} capabilities, capabilitiesError, capabilitiesLoaded, fetchCapabilities + * @return {object} capabilities, capabilitiesError, capabilitiesLoaded, fetchCapabilities */ export default function useCapabilities() { const [ capabilities, setCapabilities ] = useState( null ); diff --git a/projects/packages/backup/src/js/hooks/useConnection.js b/projects/packages/backup/src/js/hooks/useConnection.js index 8edd192ac6018..bfc75c1427430 100644 --- a/projects/packages/backup/src/js/hooks/useConnection.js +++ b/projects/packages/backup/src/js/hooks/useConnection.js @@ -42,7 +42,7 @@ const testimonials = [ /** * Expose the `connectionStatus` state object and `BackupConnectionScreen` to show a component used for connection. * - * @returns {Array} connectionStatus, BackupConnectionScreen + * @return {Array} connectionStatus, BackupConnectionScreen */ export default function useConnection() { const APINonce = useSelect( select => select( STORE_ID ).getAPINonce(), [] ); diff --git a/projects/packages/blaze/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/blaze/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/blaze/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/blaze/src/js/icon.js b/projects/packages/blaze/src/js/icon.js index 060019cff96ea..fb2f4cb5dd0c6 100644 --- a/projects/packages/blaze/src/js/icon.js +++ b/projects/packages/blaze/src/js/icon.js @@ -3,7 +3,7 @@ import { SVG, Path, G } from '@wordpress/components'; /** * Blaze Fire Icon. * - * @returns {Element} Icon component. + * @return {Element} Icon component. */ export default function BlazeIcon() { return ( diff --git a/projects/packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/connection/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/connection/src/js/tracks-callables.js b/projects/packages/connection/src/js/tracks-callables.js index 081a6abc660ad..53512ad689883 100644 --- a/projects/packages/connection/src/js/tracks-callables.js +++ b/projects/packages/connection/src/js/tracks-callables.js @@ -14,9 +14,9 @@ const debug = console.error; // eslint-disable-line no-console /** * Build a query string. * - * @param {string|object} group - Stat group, or object mapping groups to names. - * @param {string} [name] - Stat name, when `group` is a string. - * @returns {string} Query string fragment. + * @param {string|object} group - Stat group, or object mapping groups to names. + * @param {string} [name] - Stat name, when `group` is a string. + * @return {string} Query string fragment. */ function buildQuerystring( group, name ) { let uriComponent = ''; diff --git a/projects/packages/explat/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/explat/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/explat/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/explat/package.json b/projects/packages/explat/package.json index 207187c492299..da1ee676f8625 100644 --- a/projects/packages/explat/package.json +++ b/projects/packages/explat/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@automattic/jetpack-explat", - "version": "0.1.2", + "version": "0.1.3-alpha", "description": "A package for running A/B tests on the Experimentation Platform (ExPlat) in the plugin.", "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/explat/#readme", "bugs": { diff --git a/projects/packages/explat/src/class-explat.php b/projects/packages/explat/src/class-explat.php index f0d12411f5770..03391ec107247 100644 --- a/projects/packages/explat/src/class-explat.php +++ b/projects/packages/explat/src/class-explat.php @@ -20,7 +20,7 @@ class ExPlat { * * @var string */ - const PACKAGE_VERSION = '0.1.2'; + const PACKAGE_VERSION = '0.1.3-alpha'; /** * Initializer. diff --git a/projects/packages/explat/src/client/anon.ts b/projects/packages/explat/src/client/anon.ts index 489c251be4fd0..5afc6b9060fce 100644 --- a/projects/packages/explat/src/client/anon.ts +++ b/projects/packages/explat/src/client/anon.ts @@ -10,7 +10,7 @@ const anonIdPollingIntervalMaxAttempts = 100; // 50 * 100 = 5000 = 5 seconds /** * Gather w.js anonymous cookie, tk_ai * - * @returns {?string} The anonymous cookie value, or null if it doesn't exist + * @return {?string} The anonymous cookie value, or null if it doesn't exist */ export const readAnonCookie = (): string | null => { return cookie.parse( document.cookie ).tk_ai || null; @@ -31,7 +31,7 @@ export const readAnonCookie = (): string | null => { * * Throws on error. * - * @returns {Promise} The anonymous cookie value, or null if it doesn't exist + * @return {Promise} The anonymous cookie value, or null if it doesn't exist */ export const initializeAnonId = async (): Promise< string | null > => { let attempt = 0; diff --git a/projects/packages/forms/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/forms/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/forms/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/forms/src/blocks/contact-form/util/block-icons.js b/projects/packages/forms/src/blocks/contact-form/util/block-icons.js index b4401b5fa229e..c2f176002e749 100644 --- a/projects/packages/forms/src/blocks/contact-form/util/block-icons.js +++ b/projects/packages/forms/src/blocks/contact-form/util/block-icons.js @@ -12,7 +12,7 @@ const COLOR_JETPACK = PALETTE[ 'Jetpack Green 40' ]; * * Green in the Jetpack context, otherwise black for Simple sites or Atomic sites. * - * @returns {string} HEX color for block editor icons + * @return {string} HEX color for block editor icons */ export function getIconColor() { if ( isAtomicSite() || isSimpleSite() ) { diff --git a/projects/packages/forms/src/blocks/contact-form/util/block-support.js b/projects/packages/forms/src/blocks/contact-form/util/block-support.js index 932e8e5ba3bc3..6e129601f7b2e 100644 --- a/projects/packages/forms/src/blocks/contact-form/util/block-support.js +++ b/projects/packages/forms/src/blocks/contact-form/util/block-support.js @@ -3,7 +3,7 @@ import { hasBlockSupport } from '@wordpress/blocks'; /** * Check if Gutenberg supports splitting paragraphs. * - * @returns {boolean} Whether Gutenberg supports splitting paragraphs. + * @return {boolean} Whether Gutenberg supports splitting paragraphs. */ export function supportsParagraphSplitting() { return hasBlockSupport( 'core/paragraph', 'splitting', false ); diff --git a/projects/packages/forms/src/blocks/contact-form/util/caret.js b/projects/packages/forms/src/blocks/contact-form/util/caret.js index 74cb11552290f..a5748ff3cd88b 100644 --- a/projects/packages/forms/src/blocks/contact-form/util/caret.js +++ b/projects/packages/forms/src/blocks/contact-form/util/caret.js @@ -3,7 +3,7 @@ * From https://gist.github.com/loilo/f873a88631e660c59a1d5ab757ca9b1e * * @param {HTMLElement} target - Contenteditable element of which to get the caret position - * @returns {number} The caret position + * @return {number} The caret position */ export const getCaretPosition = target => { const sel = target.ownerDocument.defaultView.getSelection(); diff --git a/projects/packages/forms/src/blocks/contact-form/util/plugin-management.js b/projects/packages/forms/src/blocks/contact-form/util/plugin-management.js index cb69803d47e85..566c0b80e7619 100644 --- a/projects/packages/forms/src/blocks/contact-form/util/plugin-management.js +++ b/projects/packages/forms/src/blocks/contact-form/util/plugin-management.js @@ -4,7 +4,7 @@ import apiFetch from '@wordpress/api-fetch'; /** * Returns a list of all active plugins on the site. * - * @returns {Promise} Resolves to a list of plugins, or reject if not retrievable (like on a wpcom simple site or a site running an older version of WP) + * @return {Promise} Resolves to a list of plugins, or reject if not retrievable (like on a wpcom simple site or a site running an older version of WP) */ export async function getPlugins() { // Bail early on WordPress.com Simple sites. @@ -26,7 +26,7 @@ export async function getPlugins() { * Install and activate a plugin from the WordPress.org plugin directory. * * @param {string} slug - The slug of the plugin we want to activate. - * @returns {Promise} Resolves to true if the plugin has been successfully activated, or reject. + * @return {Promise} Resolves to true if the plugin has been successfully activated, or reject. */ export async function installAndActivatePlugin( slug ) { // Bail early on WordPress.com Simple sites. @@ -54,7 +54,7 @@ export async function installAndActivatePlugin( slug ) { * Activate a plugin from the WordPress.org plugin directory. * * @param {string} pluginFile - The plugin long slug (slug/index-file, without the .php suffix) we want to activate. - * @returns {Promise} Resolves to true if the plugin has been successfully activated, or reject. + * @return {Promise} Resolves to true if the plugin has been successfully activated, or reject. */ export async function activatePlugin( pluginFile ) { // Bail early on WordPress.com Simple sites. diff --git a/projects/packages/forms/src/blocks/contact-form/util/register-jetpack-block.js b/projects/packages/forms/src/blocks/contact-form/util/register-jetpack-block.js index b37c4576a9404..7cb638afda301 100644 --- a/projects/packages/forms/src/blocks/contact-form/util/register-jetpack-block.js +++ b/projects/packages/forms/src/blocks/contact-form/util/register-jetpack-block.js @@ -9,11 +9,11 @@ import { addFilter } from '@wordpress/hooks'; /** * Registers a gutenberg block if the availability requirements are met. * - * @param {string} name - The block's name. - * @param {object} settings - The block's settings. - * @param {object} childBlocks - The block's child blocks. - * @param {boolean} prefix - Should this block be prefixed with `jetpack/`? - * @returns {object|boolean} Either false if the block is not available, or the results of `registerBlockType` + * @param {string} name - The block's name. + * @param {object} settings - The block's settings. + * @param {object} childBlocks - The block's child blocks. + * @param {boolean} prefix - Should this block be prefixed with `jetpack/`? + * @return {object|boolean} Either false if the block is not available, or the results of `registerBlockType` */ export default function registerJetpackBlock( name, settings, childBlocks = [], prefix = true ) { const { available, details, unavailableReason } = getJetpackExtensionAvailability( name ); diff --git a/projects/packages/forms/src/dashboard/components/switch-transition/index.js b/projects/packages/forms/src/dashboard/components/switch-transition/index.js index 9f8fe81a9b632..f202ea046bd5a 100644 --- a/projects/packages/forms/src/dashboard/components/switch-transition/index.js +++ b/projects/packages/forms/src/dashboard/components/switch-transition/index.js @@ -9,12 +9,12 @@ import { CSSTransition, TransitionGroup } from 'react-transition-group'; * the old and the current version of the component, which adds some complexity. * This component aims to encapsulate that and provide a straight forward interface for switch transtions. * - * @param {object} props - Props passed down to the wrapper div. - * @param {string} props.activeViewKey - Identifier for the currently active view. - * @param {Array} props.children - Children. - * @param {number} props.duration - Duration of the transition. - * @param {object} ref - Reference to the currently active wrapper element. - * @returns {Element} React element. + * @param {object} props - Props passed down to the wrapper div. + * @param {string} props.activeViewKey - Identifier for the currently active view. + * @param {Array} props.children - Children. + * @param {number} props.duration - Duration of the transition. + * @param {object} ref - Reference to the currently active wrapper element. + * @return {Element} React element. */ const SwitchTransition = ( { activeViewKey, children, duration, ...props }, ref ) => { const [ viewKey, setViewKey ] = useState( activeViewKey ); diff --git a/projects/packages/forms/src/dashboard/data/responses.js b/projects/packages/forms/src/dashboard/data/responses.js index ed6cffb3da74b..cec436af09865 100644 --- a/projects/packages/forms/src/dashboard/data/responses.js +++ b/projects/packages/forms/src/dashboard/data/responses.js @@ -13,7 +13,7 @@ import { isNil, mapValues, omitBy, pick } from 'lodash'; * @param {string} query.status - Post status. * @param {number} query.limit - Maximum results limit. * @param {number} query.offset - Offset for results paging. - * @returns {Promise} Request promise. + * @return {Promise} Request promise. */ export const fetchResponses = query => { const queryString = new URLSearchParams( @@ -34,9 +34,9 @@ export const fetchResponses = query => { /** * Performs a bulk action on responses. * - * @param {Array} responseIds - The list of responses to be updated. - * @param {string} action - The action to be executed. - * @returns {Promise} Request promise. + * @param {Array} responseIds - The list of responses to be updated. + * @param {string} action - The action to be executed. + * @return {Promise} Request promise. */ export const doBulkAction = ( responseIds, action ) => { return apiFetch( { diff --git a/projects/packages/forms/src/dashboard/inbox/bulk-actions-menu.js b/projects/packages/forms/src/dashboard/inbox/bulk-actions-menu.js index 1862eb4b76fad..1c602fd4876d1 100644 --- a/projects/packages/forms/src/dashboard/inbox/bulk-actions-menu.js +++ b/projects/packages/forms/src/dashboard/inbox/bulk-actions-menu.js @@ -19,7 +19,7 @@ import { useFeedbackQuery } from './use-feedback-query'; * Custom temporary handler for check-for-spam action based on grunion_check_for_spam. * * @param {number} offset - Offset for the query. - * @returns {Promise} Promise that resolves once checking for spam has finished. + * @return {Promise} Promise that resolves once checking for spam has finished. */ const checkForSpam = ( offset = 0 ) => { const limit = 100; diff --git a/projects/packages/forms/src/dashboard/inbox/export-modal/util.js b/projects/packages/forms/src/dashboard/inbox/export-modal/util.js index b41ef0a178824..c90103247fe59 100644 --- a/projects/packages/forms/src/dashboard/inbox/export-modal/util.js +++ b/projects/packages/forms/src/dashboard/inbox/export-modal/util.js @@ -3,11 +3,11 @@ import { config } from '../../'; /** * Makes an export request. * - * @param {string} action - Action name. - * @param {string} nonceName - Nonce name. - * @param {object} query - Query parameters. - * @param {Array} selection - Selected IDs. - * @returns {Promise} - Request promise. + * @param {string} action - Action name. + * @param {string} nonceName - Nonce name. + * @param {object} query - Query parameters. + * @param {Array} selection - Selected IDs. + * @return {Promise} - Request promise. */ export const exportResponses = ( action, nonceName, query, selection ) => { const data = new FormData(); diff --git a/projects/packages/forms/src/dashboard/state/actions.js b/projects/packages/forms/src/dashboard/state/actions.js index a0966fca5a6e7..5f95e6450467c 100644 --- a/projects/packages/forms/src/dashboard/state/actions.js +++ b/projects/packages/forms/src/dashboard/state/actions.js @@ -18,7 +18,7 @@ import { * * @param {Function} apply - The function to apply the dispatch to. * @param {Array} args - Arguments to be passed onto the function. - * @returns {object} Action object. + * @return {object} Action object. */ export const dispatchAsync = ( apply, args = [] ) => ( { type: ASYNC_ROUTINE_DISPATCH, @@ -29,11 +29,11 @@ export const dispatchAsync = ( apply, args = [] ) => ( { /** * Handles the entire flow for fetching responses asynchronously. * - * @param {object} query - Query. - * @param {object} options - Options. + * @param {object} query - Query. + * @param {object} options - Options. * @param {boolean} options.append - Whether to append the responses to the existing set or replace it. Defaults to false. - * @yields {object} Action object. - * @returns {object} Action object. + * @yield {object} Action object. + * @return {object} Action object. */ export function* fetchResponses( query, options = {} ) { yield { type: RESPONSES_FETCH, append: options.append, query }; @@ -60,9 +60,9 @@ export function* fetchResponses( query, options = {} ) { /** * Removes the given responses from the current set. * - * @param {Array} responseIds - Response IDs to remove. - * @param {string} status - Current of the responses to be removed. - * @returns {object} Action object. + * @param {Array} responseIds - Response IDs to remove. + * @param {string} status - Current of the responses to be removed. + * @return {object} Action object. */ export const removeResponses = ( responseIds, status ) => ( { type: RESPONSES_REMOVE, @@ -73,8 +73,8 @@ export const removeResponses = ( responseIds, status ) => ( { /** * Updates the currently selected responses. * - * @param {Array} selectedResponses - Selected responses. - * @returns {object} Action object. + * @param {Array} selectedResponses - Selected responses. + * @return {object} Action object. */ export const selectResponses = selectedResponses => ( { type: RESPONSES_SELECTION_SET, @@ -85,7 +85,7 @@ export const selectResponses = selectedResponses => ( { * Set the application loading state. * * @param {boolean} loading - The loading state. - * @returns {object} Action object. + * @return {object} Action object. */ export const setLoading = loading => ( { type: RESPONSES_LOADING_SET, @@ -96,7 +96,7 @@ export const setLoading = loading => ( { * Add to current tab total numbers. * * @param {object} tabTotals - Totals to add. - * @returns {object} Action object, + * @return {object} Action object, */ export const addTabTotals = tabTotals => ( { type: RESPONSES_TAB_TOTALS_ADD, diff --git a/projects/packages/jetpack-mu-wpcom/bin/sync-newspack-blocks-formatter.js b/projects/packages/jetpack-mu-wpcom/bin/sync-newspack-blocks-formatter.js index 46fbbff4156d4..2f1b818dcb694 100644 --- a/projects/packages/jetpack-mu-wpcom/bin/sync-newspack-blocks-formatter.js +++ b/projects/packages/jetpack-mu-wpcom/bin/sync-newspack-blocks-formatter.js @@ -32,7 +32,7 @@ module.exports = function transformer( file, api ) { /** * Whether the node is a function call with the specific name * - * @param node - The AST node + * @param node - The AST node * @param functionName - The function name we want to check */ function isFunctionCallWithName( node, functionName ) { diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/jetpack-mu-wpcom/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/hooks/use-has-selected-payment-block-once.js b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/hooks/use-has-selected-payment-block-once.js index f8060b9a2d232..2927393b14c3c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/hooks/use-has-selected-payment-block-once.js +++ b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/hooks/use-has-selected-payment-block-once.js @@ -8,7 +8,7 @@ import { useState, useEffect } from '@wordpress/element'; * or jetpack/recurring-payments. * Selecting a block whose direct parent has 'payments' in the name also counts. * This is to account for clicking inside the button in a payments block, for example. - * @returns {boolean} Has the user selected a payments block (or a direct descendant) at least once? + * @return {boolean} Has the user selected a payments block (or a direct descendant) at least once? */ const useHasSelectedPaymentBlockOnce = () => { const [ hasSelectedPaymentsOnce, setHasSelectedPaymentsOnce ] = useState( false ); diff --git a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/index.ts b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/index.ts index 3f00a820d1703..f9fdc9cdda385 100644 --- a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/index.ts +++ b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/index.ts @@ -3,7 +3,7 @@ import debugFactory from 'debug'; /** * Helper to convert CSV of `classes` to an array. * @param classes - String or array of classes to format. - * @returns Array of classes + * @return Array of classes */ export function classParser( classes?: string | string[] ): string[] | null { if ( classes?.length ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/live-resize-modifier.tsx b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/live-resize-modifier.tsx index ab1a14cf8568b..904e7c84d9224 100644 --- a/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/live-resize-modifier.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/common/tour-kit/utils/live-resize-modifier.tsx @@ -38,11 +38,11 @@ type liveResizeModifierFactory = ( * The Popper modifier queues an asynchronous update on the Popper instance whenever either of the * Observers trigger its callback. * - * @param config - The config. + * @param config - The config. * @param config.rootElementSelector - The selector of the root element. - * @param config.mutation - Whether to mutate. - * @param config.resize - Whether to resize. - * @returns custom Popper modifier. + * @param config.mutation - Whether to mutate. + * @param config.resize - Whether to resize. + * @return custom Popper modifier. */ export const liveResizeModifier: liveResizeModifierFactory = ( { rootElementSelector, mutation = false, resize = false }: LiveResizeConfiguration = { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/contextual-tip.js b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/contextual-tip.js index 76c61ce2a4c84..76bb0d696d843 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/contextual-tip.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/contextual-tip.js @@ -7,9 +7,9 @@ import tipsList from './list'; /** * Create the contextual tip. * - * @param {object} props - The function props. - * @param {string} props.searchTerm - Search term text. - * @param {boolean} props.random - Whether to choose a random tooltip on multiple matches. + * @param {object} props - The function props. + * @param {string} props.searchTerm - Search term text. + * @param {boolean} props.random - Whether to choose a random tooltip on multiple matches. * @param {Function} props.canUserCreate - Function to check user permission. */ function ContextualTip( { searchTerm, random = false, canUserCreate } ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/tip-link.js b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/tip-link.js index 2af8179856831..da71674594f02 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/tip-link.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/tip-link.js @@ -5,9 +5,9 @@ const isEditorIFramed = inIframe(); /** * Create the link for the contextual tip. * - * @param {object} props - The function props. - * @param {string} props.children - The tip content. - * @param {string} props.section - The tip context section. + * @param {object} props - The function props. + * @param {string} props.children - The tip content. + * @param {string} props.section - The tip context section. */ export default function ( { children, section } ) { const { hostname } = window.location; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/utils.js b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/utils.js index 49e946ef6eaff..5ba9ee34de76b 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/utils.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/block-inserter-modifications/src/utils.js @@ -1,6 +1,6 @@ /** * Detect if the editor is already iFramed. - * @returns {boolean} `True` is the editor is iFramed. Otherwise, `False`. + * @return {boolean} `True` is the editor is iFramed. Otherwise, `False`. */ export const inIframe = () => { try { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css-preview.js b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css-preview.js index 682a2cd9f3a2f..51bf49d713f2a 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css-preview.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css-preview.js @@ -12,7 +12,7 @@ /** * Refresh custom_css partial, using selective refresh if pre-processor and direct DOM manipulation if otherwise. * - * @returns {jQuery.promise} Promise + * @return {jQuery.promise} Promise */ refresh: function () { const partial = this, diff --git a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css.core-4.9.js b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css.core-4.9.js index 02ef3a9938a91..b29999bab06c3 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css.core-4.9.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/custom-css/custom-css/js/core-customizer-css.core-4.9.js @@ -1,8 +1,8 @@ ( function ( $, customize ) { /** * Helper function to qet a control by ID - * @param {string} controlId - Control ID - * @returns {object} jQuery object of the container + * @param {string} controlId - Control ID + * @return {object} jQuery object of the container */ function _getControl( controlId ) { const control = customize.control.value( controlId ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/jetpack-global-styles/src/dom-updater.js b/projects/packages/jetpack-mu-wpcom/src/features/jetpack-global-styles/src/dom-updater.js index cef284ca2cf91..a6f960680ad7b 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/jetpack-global-styles/src/dom-updater.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/jetpack-global-styles/src/dom-updater.js @@ -4,7 +4,7 @@ import { isEmpty, isEqual } from 'lodash'; /** * DOM updater - * @param {string[]} options - A list of option names to keep track of. + * @param {string[]} options - A list of option names to keep track of. * @param {Function} getOptionValue - A function that given an option name as a string, returns the current option value. */ export default ( options, getOptionValue ) => { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/FrequencyToggle/index.tsx b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/FrequencyToggle/index.tsx index 21fa457afc39a..822b0a8a442e3 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/FrequencyToggle/index.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/FrequencyToggle/index.tsx @@ -17,12 +17,12 @@ type Option = { /** * Frequency toggle component. - * @param {FrequencyToggleProps} props - props - * @param {string} props.name - name of the radio group - * @param {Option[]} props.initialOptions - the options to pick one from - * @param {Function} props.onChange - callback when the selected option changes - * @param {Option[]} props.selectedOption - the currently selected option - * @param {boolean} props.disabled - whether the toggle is disabled + * @param {FrequencyToggleProps} props - props + * @param {string} props.name - name of the radio group + * @param {Option[]} props.initialOptions - the options to pick one from + * @param {Function} props.onChange - callback when the selected option changes + * @param {Option[]} props.selectedOption - the currently selected option + * @param {boolean} props.disabled - whether the toggle is disabled */ export function FrequencyToggle( { name = 'frequency-toggle', diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/email-frequency-group.tsx b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/email-frequency-group.tsx index d612f43431620..0377350606973 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/email-frequency-group.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/email-frequency-group.tsx @@ -20,7 +20,7 @@ interface EmailFrequencyGroupProps { * Runs a media query and returns its value when it changes. * * @param query - the media query to run. - * @returns return value of the media query. + * @return return value of the media query. */ export default function useMediaQuery( query: string ) { const [ match, setMatch ] = useState( window.matchMedia( query ).matches ); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/logged-in.tsx b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/logged-in.tsx index 6be546faa4d05..6021400b71c2b 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/logged-in.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/components/logged-in.tsx @@ -10,7 +10,7 @@ import { NewPostsNotifications } from './new-posts-notifications'; /** * Replace the first occurrence of %s in a string with a parameter. - * @param s - string to replace + * @param s - string to replace * @param param - parameter to replace with */ function sprintf( s: string, param: string ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/hooks/useSocialLogin.tsx b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/hooks/useSocialLogin.tsx index 9a1545b6d6e3d..97c47025de92c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/hooks/useSocialLogin.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/hooks/useSocialLogin.tsx @@ -26,7 +26,7 @@ const addWordPressDomain = window.location.hostname.endsWith( '.wordpress.com' ) /** * Hook to retrieve user info from server, handle social login, and logout functionality. * - * @returns {object} login, loginWindowRef, logout - login is a function to open the social login popup, loginWindowRef is a reference to the login popup window, and logout is a function to logout the user. + * @return {object} login, loginWindowRef, logout - login is a function to open the social login popup, loginWindowRef is a reference to the login popup window, and logout is a function to logout the user. */ export default function useSocialLogin() { const [ loginWindowRef, setLoginWindowRef ] = useState< Window >(); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/utils.ts b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/utils.ts index 4d9bf4bed18c5..8041dafa7ff2d 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/utils.ts +++ b/projects/packages/jetpack-mu-wpcom/src/features/verbum-comments/src/utils.ts @@ -62,7 +62,7 @@ export function isFastConnection() { * Get how many times the user saw the subscription modal. * * @param {number} uid - The user ID associated with the subscription modal. - * @returns {number} - The number of times the user saw the subscription modal. + * @return {number} - The number of times the user saw the subscription modal. */ export function getSubscriptionModalViewCount( uid: number ) { const cookieName = 'verbum_subscription_modal_counter_' + uid; @@ -77,8 +77,8 @@ export function getSubscriptionModalViewCount( uid: number ) { * Set the view count for the subscription modal in a cookie. * * @param {number} count - The view count to be set. - * @param {number} uid - The user ID associated with the subscription modal. - * @returns {void} + * @param {number} uid - The user ID associated with the subscription modal. + * @return {void} */ export function setSubscriptionModalViewCount( count: number, uid: number ) { const cookieName = 'verbum_subscription_modal_counter_' + uid; @@ -89,8 +89,8 @@ export function setSubscriptionModalViewCount( count: number, uid: number ) { * and if the user already view this modal > 5 times. * * @param {boolean} alreadySubscribed - boolean - * @param {number} uid - The user ID associated with the subscription modal. - * @returns {string} - The string that will be used to determine if the modal should be shown. + * @param {number} uid - The user ID associated with the subscription modal. + * @return {string} - The string that will be used to determine if the modal should be shown. */ export function shouldShowSubscriptionModal( alreadySubscribed: boolean, uid: number ) { const { subscribeToBlog } = VerbumComments; @@ -118,8 +118,8 @@ export function shouldShowSubscriptionModal( alreadySubscribed: boolean, uid: nu * Wraps a textarea with a setter that calls onChange when the value changes. * * @param {HTMLTextAreaElement} textarea - the textarea to wrap. - * @param {event} onChange - the callback to call when .value is set. - * @returns {object} the textarea with a reactive .value setter. + * @param {event} onChange - the callback to call when .value is set. + * @return {object} the textarea with a reactive .value setter. */ export function makeReactiveTextArea( textarea: HTMLTextAreaElement, @@ -145,7 +145,7 @@ export function makeReactiveTextArea( * Used by the textarea and editor components. * * @param {string} html - The contents of the comment textarea. - * @returns {boolean} indicating if the editor content is empty. + * @return {boolean} indicating if the editor content is empty. */ export function isEmptyEditor( html: string ) { const parser = new DOMParser(); @@ -196,7 +196,7 @@ export const setUserInfoCookie = ( userData: UserInfo ) => { /** * Get the user info from the cookie. * - * @returns {UserInfo} the user info. + * @return {UserInfo} the user info. */ export const getUserInfoCookie = () => { let userData: UserInfo = { service: 'guest' }; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/inline-support-link.tsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/inline-support-link.tsx index e6afd8ea29145..4aa6100f3e490 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/inline-support-link.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-description-links/src/inline-support-link.tsx @@ -17,11 +17,11 @@ interface Props { /** * Create the block description link. * - * @param {Props} props - The component props. + * @param {Props} props - The component props. * @param {string | ReactElement>} props.children - The component children. - * @param {string} props.title - Block title. - * @param {string} props.url - Support link URL. - * @param {number} props.postId - Post ID. + * @param {string} props.title - Block title. + * @param {string} props.url - Support link URL. + * @param {number} props.postId - Post ID. */ export default function DescriptionSupportLink( { children, diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logo.tsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logo.tsx index b3d72b5eae882..cf1900f2b5444 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logo.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logo.tsx @@ -18,7 +18,7 @@ interface Props { * * InlineSocialLogosSprite must be included on the page where this is used * @param props - The props of the component, - * @returns A Social Logo SVG + * @return A Social Logo SVG */ function InlineSocialLogo( props: Assign< React.SVGProps< SVGSVGElement >, Props > ) { const { size = 24, icon, className, ...otherProps } = props; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logos-sprite.tsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logos-sprite.tsx index c0c5e9388cdad..4068aba7fcd38 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logos-sprite.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/sharing-modal/inline-social-logos-sprite.tsx @@ -2,7 +2,7 @@ * A hidden inline svg sprite of social logos. * * Sprite was coppied from https://wordpress.com/calypso/images/social-logos-d55401f99bb02ebd6cf4.svg - * @returns see above. + * @return see above. */ const InlineSocialLogosSprite = () => { return ( diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-modal/wpcom-nux.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-modal/wpcom-nux.js index 6fb72e578b66c..535833b504b64 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-modal/wpcom-nux.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-modal/wpcom-nux.js @@ -68,7 +68,7 @@ function WpcomNux() { /** * This function returns a collection of NUX slide data - * @returns { Array } a collection of props + * @return { Array } a collection of props */ function getWpcomNuxPages() { return [ @@ -113,13 +113,13 @@ function getWpcomNuxPages() { /** * Display the Nux page * - * @param props - The props of the component. - * @param props.pageNumber - The number of page. - * @param props.isLastPage - Whether the current page is the last one. + * @param props - The props of the component. + * @param props.pageNumber - The number of page. + * @param props.isLastPage - Whether the current page is the last one. * @param props.alignBottom - Whether to align bottom. - * @param props.heading - The text of heading. + * @param props.heading - The text of heading. * @param props.description - The text of description. - * @param props.imgSrc - The src of image. + * @param props.imgSrc - The src of image. */ function NuxPage( { pageNumber, isLastPage, alignBottom = false, heading, description, imgSrc } ) { useEffect( () => { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/tour-launch.jsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/tour-launch.jsx index 1df746ef992b5..6789b4e5ed931 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/tour-launch.jsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/tour-launch.jsx @@ -80,7 +80,7 @@ function LaunchWpcomWelcomeTour() { /** * Display the welcome tour. * - * @param props - The props of the component. + * @param props - The props of the component. * @param props.siteIntent - The intent of the site. */ function WelcomeTour( { siteIntent } ) { diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/use-tour-steps.tsx b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/use-tour-steps.tsx index 6d0ad267c70c1..aefd0873a4a75 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/use-tour-steps.tsx +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-block-editor-nux/src/welcome-tour/use-tour-steps.tsx @@ -68,11 +68,11 @@ function getTourAssets( key: string ): TourAsset | undefined { /** * Get the steps of the tour * - * @param localeSlug - The slug of the locale. + * @param localeSlug - The slug of the locale. * @param referencePositioning - The reference positioning. - * @param isSiteEditor - Whether is the site editor. - * @param themeName - The name of the theme. - * @param siteIntent - The intent of the current site. + * @param isSiteEditor - Whether is the site editor. + * @param themeName - The name of the theme. + * @param siteIntent - The intent of the current site. */ function useTourSteps( localeSlug: string, diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/edit.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/edit.js index 6c937f5921544..a3753fd9cfdf8 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/edit.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/edit.js @@ -12,10 +12,10 @@ const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss'; /** * Assigns timezone to a date without altering it - * @param {string} date - a date in YYYY-MM-DDTHH:mm:ss format + * @param {string} date - a date in YYYY-MM-DDTHH:mm:ss format * @param {number} offset - the offset in hours * @param {string} format - the format of the date - * @returns {object} a moment instance + * @return {object} a moment instance */ function assignTimezone( date, offset, format = TIMEZONELESS_FORMAT ) { // passing the `true` flag to `utcOffset` keeps the date unaltered, only adds a tz diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/view.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/view.js index dc58638193102..d17346aa9b3a0 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/view.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-blocks/event-countdown/view.js @@ -50,9 +50,9 @@ domReady( function () { * Countdown element passed in as the dom node to search * within, supporting multiple events per page * - * @param ts - The timestamp of the countdown + * @param ts - The timestamp of the countdown * @param elem - The element of the countdown container - * @param id - The ID of the countdown + * @param id - The ID of the countdown */ function updateCountdown( ts, elem, id ) { const now = Date.now(); diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/wpcom-global-styles-view.js b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/wpcom-global-styles-view.js index cd1f47cb5d357..e0544227ad5cd 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/wpcom-global-styles-view.js +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-global-styles/wpcom-global-styles-view.js @@ -6,7 +6,7 @@ import './wpcom-global-styles-view.scss'; /** * Records a Tracks click event. * @param button - {string} Identifier of the button that has been clicked. - * @param props - {object} Additional props to track. + * @param props - {object} Additional props to track. */ function recordEvent( button, props = {} ) { wpcomTrackEvent( 'wpcom_launchbar_button_click', { diff --git a/projects/packages/my-jetpack/_inc/admin.jsx b/projects/packages/my-jetpack/_inc/admin.jsx index eca4f0dc31915..7ccb559796a71 100644 --- a/projects/packages/my-jetpack/_inc/admin.jsx +++ b/projects/packages/my-jetpack/_inc/admin.jsx @@ -38,7 +38,7 @@ import './style.module.scss'; /** * Component to scroll window to top on route change. * - * @returns {null} Null. + * @return {null} Null. */ function ScrollToTop() { const location = useLocation(); diff --git a/projects/packages/my-jetpack/_inc/components/add-license-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/add-license-screen/index.jsx index 380b8974da44c..9ba650d42a6cc 100644 --- a/projects/packages/my-jetpack/_inc/components/add-license-screen/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/add-license-screen/index.jsx @@ -17,7 +17,7 @@ import GoBackLink from '../go-back-link'; /** * The AddLicenseScreen component of the My Jetpack app. * - * @returns {object} The AddLicenseScreen component. + * @return {object} The AddLicenseScreen component. */ export default function AddLicenseScreen() { const { recordEvent } = useAnalytics(); diff --git a/projects/packages/my-jetpack/_inc/components/connections-section/index.jsx b/projects/packages/my-jetpack/_inc/components/connections-section/index.jsx index 126d2f5977c60..ffb1da1e64cd9 100644 --- a/projects/packages/my-jetpack/_inc/components/connections-section/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/connections-section/index.jsx @@ -8,7 +8,7 @@ import ConnectionStatusCard from '../connection-status-card'; /** * Plan section component. * - * @returns {object} ConnectionsSection React component. + * @return {object} ConnectionsSection React component. */ export default function ConnectionsSection() { const { apiRoot, apiNonce, topJetpackMenuItemUrl, connectedPlugins } = useMyJetpackConnection(); diff --git a/projects/packages/my-jetpack/_inc/components/go-back-link/index.js b/projects/packages/my-jetpack/_inc/components/go-back-link/index.js index 3eb499905798e..ee97389628066 100644 --- a/projects/packages/my-jetpack/_inc/components/go-back-link/index.js +++ b/projects/packages/my-jetpack/_inc/components/go-back-link/index.js @@ -7,10 +7,10 @@ import styles from './styles.module.scss'; /** * Simple component that renders a go back link * - * @param {object} props - Component props. + * @param {object} props - Component props. * @param {Function} props.onClick - A callback to execute on click - * @param {boolean} props.reload - Whether to reload the page after going back - * @returns {object} GoBackLink component. + * @param {boolean} props.reload - Whether to reload the page after going back + * @return {object} GoBackLink component. */ function GoBackLink( { onClick = () => {}, reload } ) { const to = reload ? '/?reload=true' : '/'; diff --git a/projects/packages/my-jetpack/_inc/components/golden-token/tooltip/index.jsx b/projects/packages/my-jetpack/_inc/components/golden-token/tooltip/index.jsx index 88c844ff0a174..fc8d06fa816e1 100644 --- a/projects/packages/my-jetpack/_inc/components/golden-token/tooltip/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/golden-token/tooltip/index.jsx @@ -14,10 +14,10 @@ import './style.global.scss'; * We created this one because is (at the time of writing) * hardcoded to only support Grid icons, and we're on a rather tight deadline. * - * @param {object} props - Component properties. + * @param {object} props - Component properties. * @param {string} props.productName - A product/plan name. - * @param {string} props.giftedDate - The date the product/plan was gifted. - * @returns {object} - A Golden Token Tooltip. + * @param {string} props.giftedDate - The date the product/plan was gifted. + * @return {object} - A Golden Token Tooltip. */ export function GoldenTokenTooltip( { productName, giftedDate } ) { const [ isVisible, setIsVisible ] = useState( false ); diff --git a/projects/packages/my-jetpack/_inc/components/idc-modal/index.js b/projects/packages/my-jetpack/_inc/components/idc-modal/index.js index 3424afa186288..c3184daa30be8 100644 --- a/projects/packages/my-jetpack/_inc/components/idc-modal/index.js +++ b/projects/packages/my-jetpack/_inc/components/idc-modal/index.js @@ -5,7 +5,7 @@ import styles from './styles.module.scss'; /** * Wrapper for the IDC Screen to display it in a modal. * - * @returns {React.Component|null} The IDC Screen modal component. + * @return {React.Component|null} The IDC Screen modal component. */ function IDCModal() { const [ isOpen, setOpen ] = useState( true ); diff --git a/projects/packages/my-jetpack/_inc/components/jetpack-manage-banner/index.jsx b/projects/packages/my-jetpack/_inc/components/jetpack-manage-banner/index.jsx index ea79f689ae88c..c3d0c519ac04b 100644 --- a/projects/packages/my-jetpack/_inc/components/jetpack-manage-banner/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/jetpack-manage-banner/index.jsx @@ -7,9 +7,9 @@ import jetpackManageIcon from './jetpack-manage.svg'; /** * Jetpack Manager Banner component that renders a banner with CTAs. * - * @param {object} props - Component props. + * @param {object} props - Component props. * @param {boolean} props.isAgencyAccount - Whether users account is an Agency account or not. - * @returns {object} The JetpackManageBanner component. + * @return {object} The JetpackManageBanner component. */ const JetpackManageBanner = props => { // eslint-disable-next-line no-unused-vars diff --git a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx index b5cce5aa05b65..7885e276023cb 100644 --- a/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/my-jetpack-screen/index.jsx @@ -74,7 +74,7 @@ const GlobalNotice = ( { message, title, options } ) => { /** * The My Jetpack App Main Screen. * - * @returns {object} The MyJetpackScreen component. + * @return {object} The MyJetpackScreen component. */ export default function MyJetpackScreen() { useExperiment( 'explat_test_jetpack_implementation_aa_test' ); diff --git a/projects/packages/my-jetpack/_inc/components/plans-section/index.jsx b/projects/packages/my-jetpack/_inc/components/plans-section/index.jsx index 8b5b2fa9767bd..24bc2d495aaa5 100644 --- a/projects/packages/my-jetpack/_inc/components/plans-section/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/plans-section/index.jsx @@ -19,7 +19,7 @@ import styles from './style.module.scss'; * * @param {object} props - Component props. * @param {object} props.purchase - Purchase object. - * @returns {object} PlanSection react component. + * @return {object} PlanSection react component. */ function PlanSection( { purchase = {} } ) { const { product_name } = purchase; @@ -34,12 +34,12 @@ function PlanSection( { purchase = {} } ) { /** * Plan expiry component. * - * @param {object} purchase - WPCOM purchase object. - * @param {string} purchase.product_name - A product name. + * @param {object} purchase - WPCOM purchase object. + * @param {string} purchase.product_name - A product name. * @param {string} purchase.subscribed_date - A subscribed date. - * @param {string} purchase.expiry_message - An expiry message. - * @param {string} purchase.partner_slug - A partner that issued the purchase. - * @returns {object} - A plan expiry component. + * @param {string} purchase.expiry_message - An expiry message. + * @param {string} purchase.partner_slug - A partner that issued the purchase. + * @return {object} - A plan expiry component. */ function PlanExpiry( purchase ) { const { expiry_message, product_name, subscribed_date } = purchase; @@ -67,7 +67,7 @@ function PlanExpiry( purchase ) { * * @param {object} props - Component props. * @param {number} props.numberOfPurchases - Count of purchases in purchases array. - * @returns {object} PlanSectionHeader react component. + * @return {object} PlanSectionHeader react component. */ function PlanSectionHeader( { numberOfPurchases = 0 } ) { return ( @@ -85,7 +85,7 @@ function PlanSectionHeader( { numberOfPurchases = 0 } ) { * * @param {object} props - Component props. * @param {number} props.numberOfPurchases - Count of purchases in purchases array. - * @returns {object} PlanSectionFooter react component. + * @return {object} PlanSectionFooter react component. */ function PlanSectionFooter( { numberOfPurchases } ) { const { recordEvent } = useAnalytics(); @@ -160,7 +160,7 @@ function PlanSectionFooter( { numberOfPurchases } ) { /** * Plan section component. * - * @returns {object} PlansSection React component. + * @return {object} PlansSection React component. */ export default function PlansSection() { const userIsAdmin = !! getMyJetpackWindowInitialState( 'userIsAdmin' ); diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/boost-card/use-boost-tooltip-copy.ts b/projects/packages/my-jetpack/_inc/components/product-cards-section/boost-card/use-boost-tooltip-copy.ts index d96222a33b3df..5c06b4fa1d0aa 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/boost-card/use-boost-tooltip-copy.ts +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/boost-card/use-boost-tooltip-copy.ts @@ -5,10 +5,10 @@ import type { ReactElement } from 'react'; /** * Gets the translated tooltip copy based on the Boost letter grade and other factors. * - * @param {object} props - React props - * @param {string} props.speedLetterGrade - The Boost score letter grade. + * @param {object} props - React props + * @param {string} props.speedLetterGrade - The Boost score letter grade. * @param {number|null} props.boostScoreIncrease - The number of points the score increased. - * @returns {ReactElement | string} A translated JSX Element or string. + * @return {ReactElement | string} A translated JSX Element or string. */ export function useBoostTooltipCopy( { speedLetterGrade, diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/auto-firewall-status.tsx b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/auto-firewall-status.tsx index c1d4428e3eecb..fb1b07a94d4c1 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/auto-firewall-status.tsx +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/auto-firewall-status.tsx @@ -33,10 +33,10 @@ export const AutoFirewallStatus = () => { /** * WafStatus component * - * @param {PropsWithChildren} props - The component props + * @param {PropsWithChildren} props - The component props * @param {'active' | 'inactive' | 'off'} props.status - The status of the WAF * - * @returns {ReactElement} rendered component + * @return {ReactElement} rendered component */ function WafStatus( { status }: { status: 'active' | 'inactive' | 'off' } ) { const slug = 'protect'; diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/logins-blocked-status.tsx b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/logins-blocked-status.tsx index 99c3dc054bf12..1727f56293a08 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/logins-blocked-status.tsx +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/logins-blocked-status.tsx @@ -40,10 +40,10 @@ export const LoginsBlockedStatus = () => { /** * BlockedStatus component * - * @param {PropsWithChildren} props - The component props + * @param {PropsWithChildren} props - The component props * @param {'active' | 'inactive' | 'off'} props.status - The status of Brute Force Protection * - * @returns {ReactElement} rendered component + * @return {ReactElement} rendered component */ function BlockedStatus( { status }: { status: 'active' | 'inactive' | 'off' } ) { const { diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx index de2df84f68cc1..ebf80a9fdfb6e 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/scan-threats-status.tsx @@ -68,11 +68,11 @@ export const ScanAndThreatStatus = () => { /** * ThreatStatus component * - * @param {PropsWithChildren} props - The component props - * @param {number} props.numThreats - The number of threats - * @param {number} props.criticalThreatCount - The number of critical threats + * @param {PropsWithChildren} props - The component props + * @param {number} props.numThreats - The number of threats + * @param {number} props.criticalThreatCount - The number of critical threats * - * @returns {ReactElement} rendered component + * @return {ReactElement} rendered component */ function ThreatStatus( { numThreats, @@ -167,10 +167,10 @@ function ThreatStatus( { /** * ScanStatus component * - * @param {PropsWithChildren} props - The component props + * @param {PropsWithChildren} props - The component props * @param {'success' | 'partial' | 'off'} props.status - The number of threats * - * @returns { ReactElement} rendered component + * @return { ReactElement} rendered component */ function ScanStatus( { status }: { status: 'success' | 'partial' | 'off' } ) { const tooltipContent = useProtectTooltipCopy(); diff --git a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/use-protect-tooltip-copy.ts b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/use-protect-tooltip-copy.ts index 7077ed8ba0fd9..6f95e251ea099 100644 --- a/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/use-protect-tooltip-copy.ts +++ b/projects/packages/my-jetpack/_inc/components/product-cards-section/protect-card/use-protect-tooltip-copy.ts @@ -22,7 +22,7 @@ export type TooltipContent = { /** * Gets the translated tooltip copy based on Protect Scan details. * - * @returns {TooltipContent} An object containing each tooltip's title and text content. + * @return {TooltipContent} An object containing each tooltip's title and text content. */ export function useProtectTooltipCopy(): TooltipContent { const slug = PRODUCT_SLUGS.PROTECT; diff --git a/projects/packages/my-jetpack/_inc/components/product-detail-card/index.jsx b/projects/packages/my-jetpack/_inc/components/product-detail-card/index.jsx index 9c26ea29d51b6..97156dabd0fb4 100644 --- a/projects/packages/my-jetpack/_inc/components/product-detail-card/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-detail-card/index.jsx @@ -28,7 +28,7 @@ import styles from './style.module.scss'; * @param {string} props.value - Product price * @param {string} props.currency - Product current code * @param {string} props.isOld - True when the product price is old - * @returns {object} Price react component. + * @return {object} Price react component. */ function Price( { value, currency, isOld } ) { if ( ! value || ! currency ) { @@ -57,19 +57,19 @@ function Price( { value, currency, isOld } ) { /** * Product Detail component. * - * @param {object} props - Component props. - * @param {string} props.slug - Product slug - * @param {Function} props.onClick - Callback for Call To Action button click - * @param {Function} props.trackButtonClick - Function to call for tracking clicks on Call To Action button - * @param {string} props.className - A className to be concat with default ones - * @param {boolean} props.preferProductName - Use product name instead of title - * @param {React.ReactNode} props.supportingInfo - Complementary links or support/legal text - * @param {string} [props.ctaButtonLabel] - The label for the Call To Action button - * @param {boolean} [props.hideTOS] - Whether to hide the Terms of Service text - * @param {number} [props.quantity] - The quantity of the product to purchase - * @param {boolean} [props.highlightLastFeature] - Whether to highlight the last feature of the list of features - * @param {boolean} [props.isFetching] - Whether the product is being fetched - * @returns {object} ProductDetailCard react component. + * @param {object} props - Component props. + * @param {string} props.slug - Product slug + * @param {Function} props.onClick - Callback for Call To Action button click + * @param {Function} props.trackButtonClick - Function to call for tracking clicks on Call To Action button + * @param {string} props.className - A className to be concat with default ones + * @param {boolean} props.preferProductName - Use product name instead of title + * @param {React.ReactNode} props.supportingInfo - Complementary links or support/legal text + * @param {string} [props.ctaButtonLabel] - The label for the Call To Action button + * @param {boolean} [props.hideTOS] - Whether to hide the Terms of Service text + * @param {number} [props.quantity] - The quantity of the product to purchase + * @param {boolean} [props.highlightLastFeature] - Whether to highlight the last feature of the list of features + * @param {boolean} [props.isFetching] - Whether the product is being fetched + * @return {object} ProductDetailCard react component. */ const ProductDetailCard = ( { slug, @@ -237,7 +237,7 @@ const ProductDetailCard = ( { * * @param {object} props - Component props. * @param {string} props.slug - Product icon slug - * @returns {object} Icon Product component. + * @return {object} Icon Product component. */ function ProductIcon( { slug: iconSlug } ) { const ProIcon = getIconBySlug( iconSlug ); diff --git a/projects/packages/my-jetpack/_inc/components/product-detail-card/stories/broken/utils.js b/projects/packages/my-jetpack/_inc/components/product-detail-card/stories/broken/utils.js index ddc04e81ed8ff..cb1429d50b8b1 100644 --- a/projects/packages/my-jetpack/_inc/components/product-detail-card/stories/broken/utils.js +++ b/projects/packages/my-jetpack/_inc/components/product-detail-card/stories/broken/utils.js @@ -26,7 +26,7 @@ const mapResponse = { * Helper function that returns the story mock data. * * @param {string} product - Product slug - * @returns {Array} Story mock data + * @return {Array} Story mock data */ export function getMockData( product ) { const isArray = product.constructor === Array; @@ -59,7 +59,7 @@ export function getMockData( product ) { /** * Return all product mocked data. * - * @returns {Array} All products mocked data. + * @return {Array} All products mocked data. */ export function getAllMockData() { return getMockData( [ ...Object.keys( mapResponse ) ] ); @@ -68,7 +68,7 @@ export function getAllMockData() { /** * Return product slugs list * - * @returns {Array} product slugs list. + * @return {Array} product slugs list. */ export function getProductSlugs() { return [ 'anti-spam', 'backup', 'boost', 'crm', 'extras', 'scan', 'search', 'videopress' ]; diff --git a/projects/packages/my-jetpack/_inc/components/product-detail-table/index.jsx b/projects/packages/my-jetpack/_inc/components/product-detail-table/index.jsx index 27e6dc6a8c66e..b637021725c0e 100644 --- a/projects/packages/my-jetpack/_inc/components/product-detail-table/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-detail-table/index.jsx @@ -29,7 +29,7 @@ import { useRedirectToReferrer } from '../../hooks/use-redirect-to-referrer'; * @param {string} props.tier - Product tier slug, i.e. 'free' or 'upgraded'. * @param {Function} props.trackProductButtonClick - Tracks click event for the product button. * @param {boolean} props.preferProductName - Whether to show the product name instead of the title. - * @returns {object} - ProductDetailTableColumn component. + * @return {object} - ProductDetailTableColumn component. */ const ProductDetailTableColumn = ( { cantInstallPlugin, @@ -235,7 +235,7 @@ ProductDetailTableColumn.propTypes = { * @param {Function} props.trackProductButtonClick - Tracks click event for the product button. * @param {boolean} props.isFetching - True if there is a pending request to load the product. * @param {boolean} props.preferProductName - Whether to show the product name instead of the title. - * @returns {object} - ProductDetailTable react component. + * @return {object} - ProductDetailTable react component. */ const ProductDetailTable = ( { slug, diff --git a/projects/packages/my-jetpack/_inc/components/product-detail-table/stories/broken/utils.js b/projects/packages/my-jetpack/_inc/components/product-detail-table/stories/broken/utils.js index cc3fc1c46fb15..46211eb0eb690 100644 --- a/projects/packages/my-jetpack/_inc/components/product-detail-table/stories/broken/utils.js +++ b/projects/packages/my-jetpack/_inc/components/product-detail-table/stories/broken/utils.js @@ -10,7 +10,7 @@ const mapResponse = { * Helper function that returns the story mock data. * * @param {string} product - Product slug - * @returns {Array} Story mock data + * @return {Array} Story mock data */ export function getMockData( product ) { const isArray = product.constructor === Array; @@ -43,7 +43,7 @@ export function getMockData( product ) { /** * Return all product mocked data. * - * @returns {Array} All products mocked data. + * @return {Array} All products mocked data. */ export function getAllMockData() { return getMockData( [ ...Object.keys( mapResponse ) ] ); @@ -52,7 +52,7 @@ export function getAllMockData() { /** * Return product slugs list * - * @returns {Array} product slugs list. + * @return {Array} product slugs list. */ export function getProductSlugs() { return [ 'boost', 'protect', 'social' ]; diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx index 645c680087767..294b0a5838a71 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/index.jsx @@ -39,22 +39,22 @@ import videoPressImage from './videopress.png'; /** * Product Interstitial component. * - * @param {object} props - Component props. - * @param {string} props.slug - Product slug - * @param {string} props.bundle - Bundle including this product - * @param {object} props.children - Product additional content - * @param {string} props.existingLicenseKeyUrl - URL to enter an existing license key (e.g. Akismet) - * @param {boolean} props.installsPlugin - Whether the interstitial button installs a plugin* - * @param {React.ReactNode} props.supportingInfo - Complementary links or support/legal text - * @param {boolean} props.preferProductName - Use product name instead of title - * @param {string} props.imageContainerClassName - Append a class to the image container - * @param {string} [props.ctaButtonLabel] - The label for the Call To Action button - * @param {boolean} [props.hideTOS] - Whether to hide the Terms of Service text - * @param {number} [props.quantity] - The quantity of the product to purchase - * @param {number} [props.directCheckout] - Whether to go straight to the checkout page, e.g. for products with usage tiers - * @param {boolean} [props.highlightLastFeature] - Whether to highlight the last feature in the list of features - * @param {object} [props.ctaCallback] - Callback when the product CTA is clicked. Triggered before any activation/checkout process occurs - * @returns {object} ProductInterstitial react component. + * @param {object} props - Component props. + * @param {string} props.slug - Product slug + * @param {string} props.bundle - Bundle including this product + * @param {object} props.children - Product additional content + * @param {string} props.existingLicenseKeyUrl - URL to enter an existing license key (e.g. Akismet) + * @param {boolean} props.installsPlugin - Whether the interstitial button installs a plugin* + * @param {React.ReactNode} props.supportingInfo - Complementary links or support/legal text + * @param {boolean} props.preferProductName - Use product name instead of title + * @param {string} props.imageContainerClassName - Append a class to the image container + * @param {string} [props.ctaButtonLabel] - The label for the Call To Action button + * @param {boolean} [props.hideTOS] - Whether to hide the Terms of Service text + * @param {number} [props.quantity] - The quantity of the product to purchase + * @param {number} [props.directCheckout] - Whether to go straight to the checkout page, e.g. for products with usage tiers + * @param {boolean} [props.highlightLastFeature] - Whether to highlight the last feature in the list of features + * @param {object} [props.ctaCallback] - Callback when the product CTA is clicked. Triggered before any activation/checkout process occurs + * @return {object} ProductInterstitial react component. */ export default function ProductInterstitial( { bundle, @@ -287,7 +287,7 @@ export default function ProductInterstitial( { /** * AntiSpamInterstitial component * - * @returns {object} AntiSpamInterstitial react component. + * @return {object} AntiSpamInterstitial react component. */ export function AntiSpamInterstitial() { const slug = 'anti-spam'; @@ -308,7 +308,7 @@ export function AntiSpamInterstitial() { /** * BackupInterstitial component * - * @returns {object} BackupInterstitial react component. + * @return {object} BackupInterstitial react component. */ export function BackupInterstitial() { return ; @@ -317,7 +317,7 @@ export function BackupInterstitial() { /** * BoostInterstitial component * - * @returns {object} BoostInterstitial react component. + * @return {object} BoostInterstitial react component. */ export function BoostInterstitial() { return ( @@ -330,7 +330,7 @@ export function BoostInterstitial() { /** * CreatorInterstitial component * - * @returns {object} CreatorInterstitial react component. + * @return {object} CreatorInterstitial react component. */ export function CreatorInterstitial() { return ; @@ -339,7 +339,7 @@ export function CreatorInterstitial() { /** * CRMInterstitial component * - * @returns {object} CRMInterstitial react component. + * @return {object} CRMInterstitial react component. */ export function CRMInterstitial() { return ( @@ -352,7 +352,7 @@ export function CRMInterstitial() { /** * ExtrasInterstitial component * - * @returns {object} ExtrasInterstitial react component. + * @return {object} ExtrasInterstitial react component. */ export function ExtrasInterstitial() { return ( @@ -365,14 +365,14 @@ export function ExtrasInterstitial() { /** * JetpackAiInterstitial component * - * @returns {object} JetpackAiInterstitial react component. + * @return {object} JetpackAiInterstitial react component. */ export { default as JetpackAiInterstitial } from './jetpack-ai'; /** * ProtectInterstitial component * - * @returns {object} ProtectInterstitial react component. + * @return {object} ProtectInterstitial react component. */ export function ProtectInterstitial() { return ; @@ -381,7 +381,7 @@ export function ProtectInterstitial() { /** * ScanInterstitial component * - * @returns {object} ScanInterstitial react component. + * @return {object} ScanInterstitial react component. */ export function ScanInterstitial() { return ; @@ -390,7 +390,7 @@ export function ScanInterstitial() { /** * SocialInterstitial component * - * @returns {object} SocialInterstitial react component. + * @return {object} SocialInterstitial react component. */ export function SocialInterstitial() { return ( @@ -409,7 +409,7 @@ export function SocialInterstitial() { /** * SearchInterstitial component * - * @returns {object} SearchInterstitial react component. + * @return {object} SearchInterstitial react component. */ export function SearchInterstitial() { const { detail } = useProduct( 'search' ); @@ -438,7 +438,7 @@ export function SearchInterstitial() { /** * StatsInterstitial component * - * @returns {object} StatsInterstitial react component. + * @return {object} StatsInterstitial react component. */ export function StatsInterstitial() { return ( @@ -462,7 +462,7 @@ export function StatsInterstitial() { /** * VideoPressInterstitial component * - * @returns {object} VideoPressInterstitial react component. + * @return {object} VideoPressInterstitial react component. */ export function VideoPressInterstitial() { return ( diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/index.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/index.jsx index 2e0f1520e9a7b..c6a9245b281c1 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/index.jsx @@ -16,7 +16,7 @@ const debug = debugFactory( 'my-jetpack:product-interstitial:jetpack-ai' ); /** * JetpackAiInterstitial component * - * @returns {object} JetpackAiInterstitial react component. + * @return {object} JetpackAiInterstitial react component. */ export default function JetpackAiInterstitial() { const slug = 'jetpack-ai'; diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/more-requests.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/more-requests.jsx index 93a7cc268efed..458e1fcd21e7a 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/more-requests.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/more-requests.jsx @@ -25,9 +25,9 @@ import styles from './style.module.scss'; /** * JetpackAIInterstitialMoreRequests component * - * @param {object} props - Component props. + * @param {object} props - Component props. * @param {Function} props.onClickGoBack - onClick handler for the "Back" button. - * @returns {object} JetpackAIInterstitialMoreRequests react component. + * @return {object} JetpackAIInterstitialMoreRequests react component. */ export function JetpackAIInterstitialMoreRequests( { onClickGoBack = () => {} } ) { const title = __( 'Do you need more requests for Jetpack AI Assistant?', 'jetpack-my-jetpack' ); diff --git a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx index 62c0a1a724f9f..0f8f37370ac74 100644 --- a/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx +++ b/projects/packages/my-jetpack/_inc/components/product-interstitial/jetpack-ai/product-page.jsx @@ -31,7 +31,7 @@ const debug = debugFactory( 'my-jetpack:product-interstitial:jetpack-ai-product- /** * Product Page for Jetpack AI - * @returns {object} React component for the product page + * @return {object} React component for the product page */ export default function () { const { onClickGoBack } = useGoBack( 'jetpack-ai' ); diff --git a/projects/packages/my-jetpack/_inc/components/redeem-token-screen/index.jsx b/projects/packages/my-jetpack/_inc/components/redeem-token-screen/index.jsx index 8e56fd964dfd8..81504d09c53a2 100644 --- a/projects/packages/my-jetpack/_inc/components/redeem-token-screen/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/redeem-token-screen/index.jsx @@ -8,7 +8,7 @@ import { includesLifetimePurchase } from '../../utils/is-lifetime-purchase'; /** * The RedeemToken component of the My Jetpack app. * - * @returns {object} The RedeemTokenScreen component. + * @return {object} The RedeemTokenScreen component. */ export default function RedeemTokenScreen() { const { userConnectionData } = useMyJetpackConnection(); diff --git a/projects/packages/my-jetpack/_inc/components/stats-section/cards.jsx b/projects/packages/my-jetpack/_inc/components/stats-section/cards.jsx index 1f5d30f4e194f..baf0e5512423b 100644 --- a/projects/packages/my-jetpack/_inc/components/stats-section/cards.jsx +++ b/projects/packages/my-jetpack/_inc/components/stats-section/cards.jsx @@ -12,7 +12,7 @@ import styles from './style.module.scss'; * @param {object} props.counts - Counts object for the current period. * @param {object} props.previousCounts - Counts object for the previous period. * - * @returns {object} StatsCards React component. + * @return {object} StatsCards React component. */ const StatsCards = ( { counts, previousCounts } ) => { return ( diff --git a/projects/packages/my-jetpack/_inc/components/stats-section/count-comparison-card.jsx b/projects/packages/my-jetpack/_inc/components/stats-section/count-comparison-card.jsx index be70f993ff234..78768eae092ca 100644 --- a/projects/packages/my-jetpack/_inc/components/stats-section/count-comparison-card.jsx +++ b/projects/packages/my-jetpack/_inc/components/stats-section/count-comparison-card.jsx @@ -30,12 +30,12 @@ export const percentCalculator = ( part, whole ) => { /** * CountComparisonCard component. * - * @param {object} props - Component props. - * @param {number} props.count - Current count. - * @param {number} props.previousCount - Previous count. - * @param {React.ReactNode} props.icon - Icon to display. - * @param {React.ReactNode} props.heading - Card heading. - * @returns {object} CountComparisonCard React component. + * @param {object} props - Component props. + * @param {number} props.count - Current count. + * @param {number} props.previousCount - Previous count. + * @param {React.ReactNode} props.icon - Icon to display. + * @param {React.ReactNode} props.heading - Card heading. + * @return {object} CountComparisonCard React component. */ const CountComparisonCard = ( { count = 0, previousCount = 0, icon, heading } ) => { const difference = subtract( count, previousCount ); diff --git a/projects/packages/my-jetpack/_inc/components/welcome-banner/index.jsx b/projects/packages/my-jetpack/_inc/components/welcome-banner/index.jsx index fe64c838cfb78..c40848b4610d7 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-banner/index.jsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-banner/index.jsx @@ -13,7 +13,7 @@ import styles from './style.module.scss'; /** * Component that renders the Welcome banner on My Jetpack. * - * @returns {object} The WelcomeBanner component. + * @return {object} The WelcomeBanner component. */ const WelcomeBanner = () => { const { recordEvent } = useAnalytics(); diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx index 358260fce50a4..6c1111551ce38 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx @@ -19,11 +19,11 @@ type ConnectionStepProps = { /** * Component that renders the Welcome banner on My Jetpack. * - * @param {object} props - ConnectioStepProps - * @param {Function} props.onActivateSite - Alias for handleRegisterSite + * @param {object} props - ConnectioStepProps + * @param {Function} props.onActivateSite - Alias for handleRegisterSite * @param {Function} props.onUpdateWelcomeFlowExperiment - Updating the welcomeFlowExperiment state - * @param {boolean} props.isActivating - Alias for siteIsRegistering - * @returns {object} The ConnectionStep component. + * @param {boolean} props.isActivating - Alias for siteIsRegistering + * @return {object} The ConnectionStep component. */ const ConnectionStep = ( { onActivateSite, diff --git a/projects/packages/my-jetpack/_inc/data/use-jetpack-api-query.ts b/projects/packages/my-jetpack/_inc/data/use-jetpack-api-query.ts index afb9b2d8428da..d99a9a890cb2a 100644 --- a/projects/packages/my-jetpack/_inc/data/use-jetpack-api-query.ts +++ b/projects/packages/my-jetpack/_inc/data/use-jetpack-api-query.ts @@ -9,10 +9,10 @@ import { getMyJetpackWindowRestState } from './utils/get-my-jetpack-window-state * and provides react-query's powerful features like caching and automatic refetching. * * @template T The type of data expected to be returned by the query function. - * @param {object} params - The parameters for configuring the API query. - * @param {string} params.name - The unique name for the query. This name, along with the optional `explicitKey`, forms the cache key for the query's result. - * @param {Function} params.queryFn - The function to fetch data from the API. It receives a configured instance of `restApi` and must return a promise that resolves to the data of type `T`. - * @param {string} [params.errorMessage] - Optional. A custom error message to be displayed in case the query fails. This message overrides the default error handling behavior. + * @param {object} params - The parameters for configuring the API query. + * @param {string} params.name - The unique name for the query. This name, along with the optional `explicitKey`, forms the cache key for the query's result. + * @param {Function} params.queryFn - The function to fetch data from the API. It receives a configured instance of `restApi` and must return a promise that resolves to the data of type `T`. + * @param {string} [params.errorMessage] - Optional. A custom error message to be displayed in case the query fails. This message overrides the default error handling behavior. */ type QueryParams< T > = { name: string; diff --git a/projects/packages/my-jetpack/_inc/data/use-simple-mutation.ts b/projects/packages/my-jetpack/_inc/data/use-simple-mutation.ts index c0694c3d7f21b..15d9229894c03 100644 --- a/projects/packages/my-jetpack/_inc/data/use-simple-mutation.ts +++ b/projects/packages/my-jetpack/_inc/data/use-simple-mutation.ts @@ -16,12 +16,12 @@ export type APIFetchOptionsWithQueryParams = APIFetchOptions & { * an error notice if the mutation encounters an error. * * @template T The type of data expected to be returned by the mutation. - * @param {object} params - The parameters for executing the mutation. - * @param {string} params.name - A unique name for the mutation, used as part of the mutation key. - * @param {APIFetchOptions} params.query - The options to be passed to the API fetch function for the mutation. - * @param {Pick} [params.options] - Optional. Mutation options from react-query, currently supports only the 'onSuccess' option. - * @param {string} [params.errorMessage] - Optional. A custom error message that can be displayed if the mutation fails. - * @returns {UseMutationResult} The result object from the useMutation hook, containing data and state information about the mutation (e.g., isPending, isError). + * @param {object} params - The parameters for executing the mutation. + * @param {string} params.name - A unique name for the mutation, used as part of the mutation key. + * @param {APIFetchOptions} params.query - The options to be passed to the API fetch function for the mutation. + * @param {Pick} [params.options] - Optional. Mutation options from react-query, currently supports only the 'onSuccess' option. + * @param {string} [params.errorMessage] - Optional. A custom error message that can be displayed if the mutation fails. + * @return {UseMutationResult} The result object from the useMutation hook, containing data and state information about the mutation (e.g., isPending, isError). */ type QueryParams< T, E, V > = { name: string; diff --git a/projects/packages/my-jetpack/_inc/data/use-simple-query.ts b/projects/packages/my-jetpack/_inc/data/use-simple-query.ts index 40fecc6af4adc..541ec6b8ed4af 100644 --- a/projects/packages/my-jetpack/_inc/data/use-simple-query.ts +++ b/projects/packages/my-jetpack/_inc/data/use-simple-query.ts @@ -13,12 +13,12 @@ import type { APIFetchOptions } from '@wordpress/api-fetch'; * GET requests. For anything else - use useSimpleMutation. * * @template T The type of data expected from the query function. - * @param {object} params - The parameters for executing the query. - * @param {string} params.name - A unique name for the query, used as part of the query key. - * @param {APIFetchOptions} params.query - The options to be passed to the API fetch function. - * @param {Pick} [params.options] - Optional. Query options from react-query, currently supports only the 'enabled' option. - * @param {string} [params.errorMessage] - Optional. A custom error message that can be displayed if the query fails. - * @returns {UseQueryResult} The result object from the useQuery hook, containing data and state information about the query (e.g., isLoading, isError). + * @param {object} params - The parameters for executing the query. + * @param {string} params.name - A unique name for the query, used as part of the query key. + * @param {APIFetchOptions} params.query - The options to be passed to the API fetch function. + * @param {Pick} [params.options] - Optional. Query options from react-query, currently supports only the 'enabled' option. + * @param {string} [params.errorMessage] - Optional. A custom error message that can be displayed if the query fails. + * @return {UseQueryResult} The result object from the useQuery hook, containing data and state information about the query (e.g., isLoading, isError). */ type QueryParams = { name: string; diff --git a/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts index a6409e984ac89..75d0f62e04787 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-analytics/index.ts @@ -37,8 +37,8 @@ const useAnalytics = () => { /** * Like tracks.recordEvent but provides specifics to My Jetpack * - * @param {string} event - event name - * @param {object} properties - event propeties + * @param {string} event - event name + * @param {object} properties - event propeties */ const recordEvent = useCallback< TracksRecordEvent >( ( event, properties ) => { jetpackAnalytics.tracks.recordEvent( event, { diff --git a/projects/packages/my-jetpack/_inc/hooks/use-go-back/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-go-back/index.ts index 76a9efc72bc57..eab90ddca8323 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-go-back/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-go-back/index.ts @@ -13,7 +13,7 @@ import useMyJetpackNavigate from '../use-my-jetpack-navigate'; * Custom React hook to handle back link click with analytics. * * @param {string} slug - My Jetpack product slug. - * @returns {object} Object with back link click handler with analytics. + * @return {object} Object with back link click handler with analytics. */ export function useGoBack( { slug }: { slug: string } ) { const { recordEvent } = useAnalytics(); diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts index 0758aeea169db..f73fabb01128d 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-connection/index.ts @@ -7,7 +7,7 @@ import { /** * React custom hook to get the site purchases data. * - * @returns {object} site purchases data + * @return {object} site purchases data */ type MyJetpackConnection = { diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-navigate/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-navigate/index.ts index 9e088d8593c6c..b35c1d9a2bbfd 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-navigate/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-navigate/index.ts @@ -7,7 +7,7 @@ import type { NavigateOptions } from 'react-router-dom'; * Custom My Jetpack navigator hook * * @param {string} route - route to navigate to - * @returns {Function} - navigate function + * @return {Function} - navigate function */ export default function useMyJetpackNavigate( route: ( typeof MyJetpackRoutes )[ keyof typeof MyJetpackRoutes ] diff --git a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-return-to-page/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-return-to-page/index.ts index 14096205ccdc8..b95d63fc13aa0 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-return-to-page/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-my-jetpack-return-to-page/index.ts @@ -7,7 +7,7 @@ import { useSearchParams } from 'react-router-dom'; * it's easier on people to be sent back to a different page * (e.g., the license activation form). * - * @returns {string} the URL of a My Jetpack page that should be displayed after connection. + * @return {string} the URL of a My Jetpack page that should be displayed after connection. */ const useMyJetpackReturnToPage = () => { const [ searchParams ] = useSearchParams(); diff --git a/projects/packages/my-jetpack/_inc/hooks/use-redirect-to-referrer/index.ts b/projects/packages/my-jetpack/_inc/hooks/use-redirect-to-referrer/index.ts index 6e9f753fdbd24..b4e31df88e457 100644 --- a/projects/packages/my-jetpack/_inc/hooks/use-redirect-to-referrer/index.ts +++ b/projects/packages/my-jetpack/_inc/hooks/use-redirect-to-referrer/index.ts @@ -1,7 +1,7 @@ /** * React custom hook to get the request referrer URL when `redirect_to_referrer` parameter is present. * - * @returns {string | null} referrer URL or null if not flagged. + * @return {string | null} referrer URL or null if not flagged. */ export function useRedirectToReferrer() { // Get the current URL query string. diff --git a/projects/packages/my-jetpack/_inc/utils/get-manage-your-plan-url.ts b/projects/packages/my-jetpack/_inc/utils/get-manage-your-plan-url.ts index 0e77b97787318..70301860fa120 100644 --- a/projects/packages/my-jetpack/_inc/utils/get-manage-your-plan-url.ts +++ b/projects/packages/my-jetpack/_inc/utils/get-manage-your-plan-url.ts @@ -5,7 +5,7 @@ import { getMyJetpackWindowInitialState } from '../data/utils/get-my-jetpack-win /** * Return the redurect URL, according to the Jetpack redurects source. * - * @returns {string} the redirect URL + * @return {string} the redirect URL */ const getManageYourPlanUrl = () => { const { siteSuffix: site = '', blogID } = getMyJetpackWindowInitialState(); diff --git a/projects/packages/my-jetpack/_inc/utils/get-purchase-plan-url.ts b/projects/packages/my-jetpack/_inc/utils/get-purchase-plan-url.ts index 545edef8d3a6e..c59e959222efa 100644 --- a/projects/packages/my-jetpack/_inc/utils/get-purchase-plan-url.ts +++ b/projects/packages/my-jetpack/_inc/utils/get-purchase-plan-url.ts @@ -8,7 +8,7 @@ import { getMyJetpackWindowInitialState } from '../data/utils/get-my-jetpack-win /** * Return the redurect URL for purchasing a plan, according to the Jetpack redurects source. * - * @returns {string} the redirect URL + * @return {string} the redirect URL */ const getPurchasePlanUrl = () => { const { diff --git a/projects/packages/my-jetpack/_inc/utils/is-jetpack-plugin-active.ts b/projects/packages/my-jetpack/_inc/utils/is-jetpack-plugin-active.ts index 2b0942d4ba902..90c2030b7a1b3 100644 --- a/projects/packages/my-jetpack/_inc/utils/is-jetpack-plugin-active.ts +++ b/projects/packages/my-jetpack/_inc/utils/is-jetpack-plugin-active.ts @@ -3,7 +3,7 @@ import { getMyJetpackWindowInitialState } from '../data/utils/get-my-jetpack-win /** * Check if the Jetpack plugin is active or not. * - * @returns {boolean} Returns true if the Jetpack plugin is active, otherwise false. + * @return {boolean} Returns true if the Jetpack plugin is active, otherwise false. */ export const isJetpackPluginActive = () => { const { plugins } = getMyJetpackWindowInitialState() || {}; diff --git a/projects/packages/my-jetpack/_inc/utils/is-lifetime-purchase.ts b/projects/packages/my-jetpack/_inc/utils/is-lifetime-purchase.ts index 6bca6493c11bf..8e208ae5f39a5 100644 --- a/projects/packages/my-jetpack/_inc/utils/is-lifetime-purchase.ts +++ b/projects/packages/my-jetpack/_inc/utils/is-lifetime-purchase.ts @@ -3,9 +3,9 @@ import type { Purchase } from '../data/types'; /** * Check if a purchase is considered "Lifetime". * - * @param {Purchase} purchase - A WPCOM purchase object. - * @param {string} purchase.partner_slug - A partner that issued the purchase. - * @returns {boolean} Returns true if a purchase is considered a lifetime purchase. + * @param {Purchase} purchase - A WPCOM purchase object. + * @param {string} purchase.partner_slug - A partner that issued the purchase. + * @return {boolean} Returns true if a purchase is considered a lifetime purchase. */ export const isLifetimePurchase = ( { partner_slug }: Purchase ) => { if ( ! partner_slug ) { @@ -20,7 +20,7 @@ export const isLifetimePurchase = ( { partner_slug }: Purchase ) => { * Look for a lifetime purchase in an array of purchases. * * @param {Array} purchases - An array of WPCOM purchase objects. - * @returns {boolean} Returns true if one of the purchase is considered a lifetime purchase. + * @return {boolean} Returns true if one of the purchase is considered a lifetime purchase. */ export function includesLifetimePurchase( purchases: Array< Purchase > ) { if ( ! Array.isArray( purchases ) ) { diff --git a/projects/packages/my-jetpack/_inc/utils/side-load-tracks.ts b/projects/packages/my-jetpack/_inc/utils/side-load-tracks.ts index 66ac82d5d9035..b594555436a5b 100644 --- a/projects/packages/my-jetpack/_inc/utils/side-load-tracks.ts +++ b/projects/packages/my-jetpack/_inc/utils/side-load-tracks.ts @@ -8,7 +8,7 @@ declare global { /** * Function to get the current year and week number. * - * @returns {string} The current year and week number. + * @return {string} The current year and week number. */ function getCurrentYearAndWeek() { const date = new Date(); @@ -32,7 +32,7 @@ function getCurrentYearAndWeek() { * and appends it to the document's head. * * @param {string} src - The URL of the script to load. - * @returns {Promise} A promise that resolves once the script has loaded. + * @return {Promise} A promise that resolves once the script has loaded. */ function loadScript( src: string ): Promise< void > { return new Promise( ( resolve, reject ) => { @@ -53,7 +53,7 @@ function loadScript( src: string ): Promise< void > { * and then loads the tracking script from the specified URL. Once the script has loaded, * the provided callback function is called. * - * @returns {Promise} A promise that resolves once the Tracks has been side loaded. + * @return {Promise} A promise that resolves once the Tracks has been side loaded. */ export default function sideloadTracks(): Promise< void > { window._tkq = window._tkq || []; diff --git a/projects/packages/my-jetpack/_inc/utils/time-since.ts b/projects/packages/my-jetpack/_inc/utils/time-since.ts index 2c8c025d369b1..825f834e57656 100644 --- a/projects/packages/my-jetpack/_inc/utils/time-since.ts +++ b/projects/packages/my-jetpack/_inc/utils/time-since.ts @@ -4,7 +4,7 @@ import { sprintf, _n, __ } from '@wordpress/i18n'; * Time Since * * @param {number} date - The past date (timestamp) to compare to the current date. - * @returns {string} - A description of the amount of time between a date and now, i.e. "5 minutes ago". + * @return {string} - A description of the amount of time between a date and now, i.e. "5 minutes ago". */ export function timeSince( date: number ) { const now = new Date(); diff --git a/projects/packages/my-jetpack/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/my-jetpack/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/search/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/search/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/search/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/search/src/customberg/components/app-wrapper/index.jsx b/projects/packages/search/src/customberg/components/app-wrapper/index.jsx index ec18ad43222d2..91386e378eacd 100644 --- a/projects/packages/search/src/customberg/components/app-wrapper/index.jsx +++ b/projects/packages/search/src/customberg/components/app-wrapper/index.jsx @@ -27,7 +27,7 @@ const PROPS_FROM_WINDOW = { /** * Component for wrapping Jetpack Instant Search application. * - * @returns {Element} component instance + * @return {Element} component instance */ export default function AppWrapper() { const { diff --git a/projects/packages/search/src/customberg/components/header/index.jsx b/projects/packages/search/src/customberg/components/header/index.jsx index 30c62d367ce06..5c783f2082074 100644 --- a/projects/packages/search/src/customberg/components/header/index.jsx +++ b/projects/packages/search/src/customberg/components/header/index.jsx @@ -7,9 +7,9 @@ import './styles.scss'; /** * Component for showing the Gutenberg-style header. * - * @param {object} props - component properties. + * @param {object} props - component properties. * @param {Function} props.enableSidebar - Enables the sidebar upon invocation. - * @returns {Element} component instance + * @return {Element} component instance */ function Header( { enableSidebar } ) { // translators: Product name 'Jetpack Search' should not be translated diff --git a/projects/packages/search/src/customberg/components/layout/index.jsx b/projects/packages/search/src/customberg/components/layout/index.jsx index 3a96b4a95e469..002e5b8382408 100644 --- a/projects/packages/search/src/customberg/components/layout/index.jsx +++ b/projects/packages/search/src/customberg/components/layout/index.jsx @@ -10,7 +10,7 @@ import './styles.scss'; /** * Top-level component for the Gutenberg-style Jetpack Search customization interface. * - * @returns {Element} component instance + * @return {Element} component instance */ export default function Layout() { const { isLargeViewport } = useSelect( select => ( { diff --git a/projects/packages/search/src/customberg/components/layout/interface.jsx b/projects/packages/search/src/customberg/components/layout/interface.jsx index c1f2af139aba7..3a1e0e5d2682c 100644 --- a/projects/packages/search/src/customberg/components/layout/interface.jsx +++ b/projects/packages/search/src/customberg/components/layout/interface.jsx @@ -8,7 +8,7 @@ import './styles.scss'; * Wraps the InterfaceSkeleton component with necessary parameters. * * @param {object} props - component properties. - * @returns {Element} component instance + * @return {Element} component instance */ export default function Interface( props ) { const { enabledSidebarName, enableSidebar, disableSidebar } = props; diff --git a/projects/packages/search/src/customberg/components/save-button/index.jsx b/projects/packages/search/src/customberg/components/save-button/index.jsx index 97f42027077ce..95f2475abcb44 100644 --- a/projects/packages/search/src/customberg/components/save-button/index.jsx +++ b/projects/packages/search/src/customberg/components/save-button/index.jsx @@ -7,7 +7,7 @@ import './styles.scss'; /** * Component for saving pending entity record changes. * - * @returns {Element} component instance + * @return {Element} component instance */ export default function SaveButton() { const { isSaving, hasUnsavedEdits, saveRecords } = useEntityRecordState(); diff --git a/projects/packages/search/src/customberg/components/sidebar/color-control.jsx b/projects/packages/search/src/customberg/components/sidebar/color-control.jsx index a1090708da952..3c9541afe6422 100644 --- a/projects/packages/search/src/customberg/components/sidebar/color-control.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/color-control.jsx @@ -16,11 +16,11 @@ const DEFAULT_COLORS = [ /** * Color control for use in SidebarOptions tab. * - * @param {object} props - component properties. - * @param {boolean} props.disabled - disables the control. + * @param {object} props - component properties. + * @param {boolean} props.disabled - disables the control. * @param {Function} props.onChange - invoked with a new color when the selected color has changed. - * @param {string} props.value - color value prefixed with #. - * @returns {Element} component instance + * @param {string} props.value - color value prefixed with #. + * @return {Element} component instance */ export default function ColorControl( { disabled, value, onChange } ) { const colors = useSelect( select => { diff --git a/projects/packages/search/src/customberg/components/sidebar/excluded-post-types-control.jsx b/projects/packages/search/src/customberg/components/sidebar/excluded-post-types-control.jsx index 4616f8483de54..6e52bac68f12d 100644 --- a/projects/packages/search/src/customberg/components/sidebar/excluded-post-types-control.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/excluded-post-types-control.jsx @@ -11,12 +11,12 @@ const VALID_POST_TYPES = global.JetpackInstantSearchOptions.postTypes; /** * Control for modifying excluded post types. * - * @param {object} props - component properties. - * @param {boolean} props.disabled - disables the control. - * @param {Function} props.onChange - invoked with new array of excluded post types when the selection has been updated. - * @param {object} props.validPostTypes - { [ postTypeId ]: { name: string, singular_name: string } }. - * @param {string} props.value - excluded post types as a CSV. - * @returns {Element} component instance + * @param {object} props - component properties. + * @param {boolean} props.disabled - disables the control. + * @param {Function} props.onChange - invoked with new array of excluded post types when the selection has been updated. + * @param {object} props.validPostTypes - { [ postTypeId ]: { name: string, singular_name: string } }. + * @param {string} props.value - excluded post types as a CSV. + * @return {Element} component instance */ export default function ExcludedPostTypesControl( { disabled, diff --git a/projects/packages/search/src/customberg/components/sidebar/index.jsx b/projects/packages/search/src/customberg/components/sidebar/index.jsx index d56c8067cc222..503e8ac235758 100644 --- a/projects/packages/search/src/customberg/components/sidebar/index.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/index.jsx @@ -12,7 +12,7 @@ import './styles.scss'; * Sidebar implemented via ComplementaryArea component. Renders using the slot/fill paradigm. * * @param {object} props - component properties. - * @returns {Element} component instance + * @return {Element} component instance */ export default function Sidebar( props ) { const { enabledSidebarName, enableSidebar, disableSidebar } = props; diff --git a/projects/packages/search/src/customberg/components/sidebar/sidebar-description.jsx b/projects/packages/search/src/customberg/components/sidebar/sidebar-description.jsx index 4720d87d3ca4b..25e0f3142648e 100644 --- a/projects/packages/search/src/customberg/components/sidebar/sidebar-description.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/sidebar-description.jsx @@ -7,7 +7,7 @@ import { svg as jetpackColophonSvg } from 'instant-search/components/jetpack-col /** * Description tab for the sidebar. * - * @returns {Element} component instance + * @return {Element} component instance */ export default function SidebarDescription() { return ( diff --git a/projects/packages/search/src/customberg/components/sidebar/sidebar-options.jsx b/projects/packages/search/src/customberg/components/sidebar/sidebar-options.jsx index e30abe71c5d1a..48c9c819f50f2 100644 --- a/projects/packages/search/src/customberg/components/sidebar/sidebar-options.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/sidebar-options.jsx @@ -22,7 +22,7 @@ const { isFreePlan = false } = window[ SERVER_OBJECT_NAME ]; /** * Customization/configuration tab for the sidebar. * - * @returns {Element} component instance + * @return {Element} component instance */ export default function SidebarOptions() { // Initializes default values used for FormToggle in order to avoid changing diff --git a/projects/packages/search/src/customberg/components/sidebar/tabs.jsx b/projects/packages/search/src/customberg/components/sidebar/tabs.jsx index 0b49150e706d0..adaae810092ef 100644 --- a/projects/packages/search/src/customberg/components/sidebar/tabs.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/tabs.jsx @@ -6,10 +6,10 @@ import { JP_SEARCH_TAB_IDENTIFIER, OPTIONS_TAB_IDENTIFIER } from 'lib/constants' /** * Sidebar tabs. * - * @param {object} props - Component properties - * @param {string} props.enabledSidebarName - Currently enabled sidebar name. - * @param {Function} props.enableSidebar - Enables the sidebar upon invocation. - * @returns {Element} component instance + * @param {object} props - Component properties + * @param {string} props.enabledSidebarName - Currently enabled sidebar name. + * @param {Function} props.enableSidebar - Enables the sidebar upon invocation. + * @return {Element} component instance */ export default function Tabs( { enabledSidebarName, enableSidebar } ) { return ( @@ -37,12 +37,12 @@ export default function Tabs( { enabledSidebarName, enableSidebar } ) { /** * Sidebar tab. * - * @param {object} props - Component properties + * @param {object} props - Component properties * @param {Function} props.enableSidebar - Callback to enable a specific sidebar by name - * @param {string} props.identifier - Identifier. - * @param {string} props.label - Label. - * @param {boolean} props.isActive - Whether the tab is active. - * @returns {Element} component instance + * @param {string} props.identifier - Identifier. + * @param {string} props.label - Label. + * @param {boolean} props.isActive - Whether the tab is active. + * @return {Element} component instance */ function Tab( { enableSidebar, identifier, label, isActive } ) { const ariaLabel = isActive diff --git a/projects/packages/search/src/customberg/components/sidebar/theme-control.jsx b/projects/packages/search/src/customberg/components/sidebar/theme-control.jsx index 3064275d863c1..c3f82cc0a6b49 100644 --- a/projects/packages/search/src/customberg/components/sidebar/theme-control.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/theme-control.jsx @@ -8,11 +8,11 @@ import ThemeIcon from './theme-icon'; /** * Theme control for use in SidebarOptions tab. * - * @param {object} props - component properties. - * @param {boolean} props.disabled - disables the control. + * @param {object} props - component properties. + * @param {boolean} props.disabled - disables the control. * @param {Function} props.onChange - invoked with new theme value when a button is pressed. - * @param {string} props.value - 'dark' or 'light'. - * @returns {Element} component instance + * @param {string} props.value - 'dark' or 'light'. + * @return {Element} component instance */ export default function ThemeControl( { disabled, value, onChange } ) { return ( diff --git a/projects/packages/search/src/customberg/components/sidebar/theme-icon.jsx b/projects/packages/search/src/customberg/components/sidebar/theme-icon.jsx index c016ed59554a1..699678cf6a276 100644 --- a/projects/packages/search/src/customberg/components/sidebar/theme-icon.jsx +++ b/projects/packages/search/src/customberg/components/sidebar/theme-icon.jsx @@ -1,9 +1,9 @@ /** * Theme icon for use in SidebarOptions tab. * - * @param {object} props - component properties. + * @param {object} props - component properties. * @param {string} props.theme - 'dark' or 'light'. - * @returns {Element} component instance + * @return {Element} component instance */ export default function ThemeIcon( { theme } ) { const fill = theme === 'dark' ? '#000' : '#fff'; diff --git a/projects/packages/search/src/customberg/hooks/use-entity-record-state.js b/projects/packages/search/src/customberg/hooks/use-entity-record-state.js index a6b01f537c421..914fa105b4325 100644 --- a/projects/packages/search/src/customberg/hooks/use-entity-record-state.js +++ b/projects/packages/search/src/customberg/hooks/use-entity-record-state.js @@ -4,7 +4,7 @@ import { useCallback } from 'react'; /** * Fetches relevant entity record states for use in the configurator. * - * @returns {object} relevant entity record values. + * @return {object} relevant entity record values. */ export default function useEntityRecordState() { const { saveEntityRecord, undo, redo } = useDispatch( 'core' ); diff --git a/projects/packages/search/src/customberg/hooks/use-loading-state.js b/projects/packages/search/src/customberg/hooks/use-loading-state.js index d470f0e1325ac..62876f8caecd4 100644 --- a/projects/packages/search/src/customberg/hooks/use-loading-state.js +++ b/projects/packages/search/src/customberg/hooks/use-loading-state.js @@ -3,7 +3,7 @@ import { useSelect } from '@wordpress/data'; /** * Fetches loading state for site values. * - * @returns {object} isLoading state. + * @return {object} isLoading state. */ export default function useSiteLoadingState() { const site = useSelect( select => select( 'core' ).getSite() ); diff --git a/projects/packages/search/src/customberg/hooks/use-search-options.js b/projects/packages/search/src/customberg/hooks/use-search-options.js index c309b75961174..8c7fa3ff7bdc4 100644 --- a/projects/packages/search/src/customberg/hooks/use-search-options.js +++ b/projects/packages/search/src/customberg/hooks/use-search-options.js @@ -8,7 +8,7 @@ const VALID_POST_TYPES = global.JetpackInstantSearchOptions.postTypes; /** * Fetches values and setters for various search configuration values. * - * @returns {object} values and setters + * @return {object} values and setters */ export default function useSearchOptions() { const [ theme, setTheme ] = useEntityProp( 'root', 'site', 'jetpack_search_color_theme' ); diff --git a/projects/packages/search/src/dashboard/components/dashboard/wrapped-dashboard.jsx b/projects/packages/search/src/dashboard/components/dashboard/wrapped-dashboard.jsx index fd93e09b97a5c..49313904258ac 100644 --- a/projects/packages/search/src/dashboard/components/dashboard/wrapped-dashboard.jsx +++ b/projects/packages/search/src/dashboard/components/dashboard/wrapped-dashboard.jsx @@ -11,7 +11,7 @@ import { STORE_ID } from 'store'; /** * Return appropriate components. * - * @returns {React.Component} WrappedDashboard component. + * @return {React.Component} WrappedDashboard component. */ export default function WrappedDashboard() { const { isFullyConnected } = useConnection(); @@ -53,7 +53,7 @@ export default function WrappedDashboard() { /** * Returns AfterConnectionPage component if site is fully connected otherwise UpsellPage component. * - * @returns {React.Component} NewWrappedDashboard component. + * @return {React.Component} NewWrappedDashboard component. */ function WrappedDashboard202208() { const { isFullyConnected } = useConnection(); @@ -69,7 +69,7 @@ function WrappedDashboard202208() { /** * Returns SearchDashboardPage component if supports search otherwise UpsellPage component * - * @returns {React.Component} AfterConnectionPage component. + * @return {React.Component} AfterConnectionPage component. */ function AfterConnectionPage() { useSelect( select => select( STORE_ID ).getSearchPlanInfo(), [] ); diff --git a/projects/packages/search/src/dashboard/components/donut-meter-container/index.jsx b/projects/packages/search/src/dashboard/components/donut-meter-container/index.jsx index 7c7400174bc70..32dbbae8afd53 100644 --- a/projects/packages/search/src/dashboard/components/donut-meter-container/index.jsx +++ b/projects/packages/search/src/dashboard/components/donut-meter-container/index.jsx @@ -44,14 +44,14 @@ const usageInfoMessage = ( current, limit ) => { /** * Returns a DonutMeterContainer describing resource usage. * - * @param {object} props - Props - * @param {number} props.current - totalCount to the DonutMeter - * @param {number} props.limit - segmentCount to the DonutMeter - * @param {string} props.title - title to the DonutMeter + * @param {object} props - Props + * @param {number} props.current - totalCount to the DonutMeter + * @param {number} props.limit - segmentCount to the DonutMeter + * @param {string} props.title - title to the DonutMeter * @param {Function} props.iconClickedCallback - handler for click on "info" icon * @param {Function} props.linkClickedCallback - handler for click on "details" link - * @param {object} props.tooltip - tooltip data - * @returns {React.Component} DonutMeterContainer component + * @param {object} props.tooltip - tooltip data + * @return {React.Component} DonutMeterContainer component */ const DonutMeterContainer = ( { current = 0, diff --git a/projects/packages/search/src/dashboard/components/global-notices/index.jsx b/projects/packages/search/src/dashboard/components/global-notices/index.jsx index 52a0ba088d35f..26a7e10e96c0a 100644 --- a/projects/packages/search/src/dashboard/components/global-notices/index.jsx +++ b/projects/packages/search/src/dashboard/components/global-notices/index.jsx @@ -8,7 +8,7 @@ import './style.scss'; * NoticesList component * * @param {*} props - Props - * @returns {React.Component} - NoticesList component + * @return {React.Component} - NoticesList component */ export default function NoticesList( props = { handleLocalNoticeDismissClick: null, notices: Object.freeze( [] ) } diff --git a/projects/packages/search/src/dashboard/components/global-notices/store/actions.js b/projects/packages/search/src/dashboard/components/global-notices/store/actions.js index a2ff9a7c6304c..719abb03b593c 100644 --- a/projects/packages/search/src/dashboard/components/global-notices/store/actions.js +++ b/projects/packages/search/src/dashboard/components/global-notices/store/actions.js @@ -8,10 +8,10 @@ export const REMOVE_NOTICE = 'REMOVE_NOTICE'; /** * Create global notice * - * @param {*} status - success, error, info or warning. - * @param {*} text - the text to show. + * @param {*} status - success, error, info or warning. + * @param {*} text - the text to show. * @param {*} options - Options. - * @returns {object} - action object. + * @return {object} - action object. */ export function createNotice( status, text, options = {} ) { const notice = { @@ -34,7 +34,7 @@ export function createNotice( status, text, options = {} ) { * Remove notice by ID * * @param {*} noticeId - noticeID. - * @returns {object} - action object. + * @return {object} - action object. */ export function removeNotice( noticeId ) { return { type: REMOVE_NOTICE, notice: { id: noticeId } }; diff --git a/projects/packages/search/src/dashboard/components/loading/index.jsx b/projects/packages/search/src/dashboard/components/loading/index.jsx index a43566b4293e7..58ca795c6a948 100644 --- a/projects/packages/search/src/dashboard/components/loading/index.jsx +++ b/projects/packages/search/src/dashboard/components/loading/index.jsx @@ -6,7 +6,7 @@ import './style.scss'; /** * Defines a centerized spinner * - * @returns {React.Component} Loading component. + * @return {React.Component} Loading component. */ export default function Loading() { return ; diff --git a/projects/packages/search/src/dashboard/components/mocked-search/index.jsx b/projects/packages/search/src/dashboard/components/mocked-search/index.jsx index 2f770ed97d3c8..f14b83bd64a7c 100644 --- a/projects/packages/search/src/dashboard/components/mocked-search/index.jsx +++ b/projects/packages/search/src/dashboard/components/mocked-search/index.jsx @@ -5,10 +5,10 @@ import MockedLegacySearch from './mocked-legacy-search'; /** * Mocked Search component, which shows mocked Instant Search or legacy Search interface. * - * @param {object} props - Component properties. + * @param {object} props - Component properties. * @param {boolean} props.supportsOnlyClassicSearch - true if site has plan that supports only Classic Search. - * @param {boolean} props.supportsInstantSearch - true if site has plan that supports Instant Search. - * @returns {React.Component} Mocked Search interface component. + * @param {boolean} props.supportsInstantSearch - true if site has plan that supports Instant Search. + * @return {React.Component} Mocked Search interface component. */ export default function MockedSearch( { supportsInstantSearch = true, diff --git a/projects/packages/search/src/dashboard/components/mocked-search/mocked-instant-search.jsx b/projects/packages/search/src/dashboard/components/mocked-search/mocked-instant-search.jsx index 005616706ab74..8b3de6d7e21e2 100644 --- a/projects/packages/search/src/dashboard/components/mocked-search/mocked-instant-search.jsx +++ b/projects/packages/search/src/dashboard/components/mocked-search/mocked-instant-search.jsx @@ -7,7 +7,7 @@ import './mocked-instant-search.scss'; /** * Generate mocked instant search dialog * - * @returns {React.Component} Mocked Search instant dialog component. + * @return {React.Component} Mocked Search instant dialog component. */ export default function MockedInstantSearch() { return ( diff --git a/projects/packages/search/src/dashboard/components/mocked-search/mocked-legacy-search.jsx b/projects/packages/search/src/dashboard/components/mocked-search/mocked-legacy-search.jsx index 402b2b6de7908..4ca4d8be4bcfd 100644 --- a/projects/packages/search/src/dashboard/components/mocked-search/mocked-legacy-search.jsx +++ b/projects/packages/search/src/dashboard/components/mocked-search/mocked-legacy-search.jsx @@ -6,7 +6,7 @@ import './mocked-legacy-search.scss'; /** * Generate mocked search dialog * - * @returns {React.Component} Mocked Search dialog component. + * @return {React.Component} Mocked Search dialog component. */ export default function MockedLegacySearch() { return ( diff --git a/projects/packages/search/src/dashboard/components/module-control/index.jsx b/projects/packages/search/src/dashboard/components/module-control/index.jsx index 995e0906176ac..8b031f0d00ade 100644 --- a/projects/packages/search/src/dashboard/components/module-control/index.jsx +++ b/projects/packages/search/src/dashboard/components/module-control/index.jsx @@ -30,21 +30,21 @@ const WIDGETS_EDITOR_URL = 'widgets.php'; /** * Search settings component to be used within the Performance section. * - * @param {object} props - Component properties. - * @param {string} props.domain - Calypso slug. - * @param {string} props.siteAdminUrl - site admin URL. - * @param {Function} props.updateOptions - function to update settings. - * @param {boolean} props.isDisabledFromOverLimit - true if the subscription is invalid to manipulate controls. - * @param {boolean} props.isSavingEitherOption - true if Saving options. - * @param {boolean} props.isModuleEnabled - true if Search module is enabled. - * @param {boolean} props.isInstantSearchEnabled - true if Instant Search is enabled. - * @param {boolean} props.isInstantSearchPromotionActive - true if search promotion is active. - * @param {boolean} props.supportsOnlyClassicSearch - true if site has plan that supports only Classic Search. - * @param {boolean} props.supportsSearch - true if site has plan that supports either Classic or Instant Search. - * @param {boolean} props.supportsInstantSearch - true if site has plan that supports Instant Search. - * @param {boolean} props.isTogglingModule - true if toggling Search module. - * @param {boolean} props.isTogglingInstantSearch - true if toggling Instant Search option. - * @returns {React.Component} Search settings component. + * @param {object} props - Component properties. + * @param {string} props.domain - Calypso slug. + * @param {string} props.siteAdminUrl - site admin URL. + * @param {Function} props.updateOptions - function to update settings. + * @param {boolean} props.isDisabledFromOverLimit - true if the subscription is invalid to manipulate controls. + * @param {boolean} props.isSavingEitherOption - true if Saving options. + * @param {boolean} props.isModuleEnabled - true if Search module is enabled. + * @param {boolean} props.isInstantSearchEnabled - true if Instant Search is enabled. + * @param {boolean} props.isInstantSearchPromotionActive - true if search promotion is active. + * @param {boolean} props.supportsOnlyClassicSearch - true if site has plan that supports only Classic Search. + * @param {boolean} props.supportsSearch - true if site has plan that supports either Classic or Instant Search. + * @param {boolean} props.supportsInstantSearch - true if site has plan that supports Instant Search. + * @param {boolean} props.isTogglingModule - true if toggling Search module. + * @param {boolean} props.isTogglingInstantSearch - true if toggling Instant Search option. + * @return {React.Component} Search settings component. */ export default function SearchModuleControl( { siteAdminUrl, diff --git a/projects/packages/search/src/dashboard/components/pages/connection-page.jsx b/projects/packages/search/src/dashboard/components/pages/connection-page.jsx index b4a2f826f3c0c..4faf56de2f094 100644 --- a/projects/packages/search/src/dashboard/components/pages/connection-page.jsx +++ b/projects/packages/search/src/dashboard/components/pages/connection-page.jsx @@ -12,9 +12,9 @@ import './connection-page.scss'; /** * defines ConnectionPage. * - * @param {object} props - Component properties. + * @param {object} props - Component properties. * @param {string} props.isLoading - should page show Loading spinner. - * @returns {React.Component} ConnectionPage component. + * @return {React.Component} ConnectionPage component. */ export default function ConnectionPage( { isLoading = false } ) { useSelect( select => select( STORE_ID ).getSearchPricing(), [] ); diff --git a/projects/packages/search/src/dashboard/components/pages/dashboard-page.jsx b/projects/packages/search/src/dashboard/components/pages/dashboard-page.jsx index cb51ada5d6f64..597bea7f68f6f 100644 --- a/projects/packages/search/src/dashboard/components/pages/dashboard-page.jsx +++ b/projects/packages/search/src/dashboard/components/pages/dashboard-page.jsx @@ -23,9 +23,9 @@ import './dashboard-page.scss'; /** * SearchDashboard component definition. * - * @param {object} props - Component properties. + * @param {object} props - Component properties. * @param {string} props.isLoading - should page show Loading spinner. - * @returns {React.Component} Search dashboard component. + * @return {React.Component} Search dashboard component. */ export default function DashboardPage( { isLoading = false } ) { useSelect( select => select( STORE_ID ).getSearchPlanInfo(), [] ); diff --git a/projects/packages/search/src/dashboard/components/pages/upsell-page/index.jsx b/projects/packages/search/src/dashboard/components/pages/upsell-page/index.jsx index 9add3c70d9f27..0f1f94230161c 100644 --- a/projects/packages/search/src/dashboard/components/pages/upsell-page/index.jsx +++ b/projects/packages/search/src/dashboard/components/pages/upsell-page/index.jsx @@ -32,9 +32,9 @@ const JETPACK_SEARCH__LINK = 'https://jetpack.com/upgrade/search'; /** * defines UpsellPage. * - * @param {object} props - Component properties. + * @param {object} props - Component properties. * @param {string} props.isLoading - should page show Loading spinner. - * @returns {React.Component} UpsellPage component. + * @return {React.Component} UpsellPage component. */ export default function UpsellPage( { isLoading = false } ) { // Introduce the gate for new pricing with URL parameter `new_pricing_202208=1` diff --git a/projects/packages/search/src/dashboard/components/price/index.jsx b/projects/packages/search/src/dashboard/components/price/index.jsx index 69c949feac372..7c70647d11e3c 100644 --- a/projects/packages/search/src/dashboard/components/price/index.jsx +++ b/projects/packages/search/src/dashboard/components/price/index.jsx @@ -5,12 +5,12 @@ import React from 'react'; /** * React component to render a Price composition. * - * @param {object} props - Component props. - * @param {number} props.amount - Amount. - * @param {string} props.currency - Currency code (e.g. 'USD'). + * @param {object} props - Component props. + * @param {number} props.amount - Amount. + * @param {string} props.currency - Currency code (e.g. 'USD'). * @param {boolean} props.hidePriceFraction - Whether or not to hide the fraction. - * @param {string} props.tag - Topmost element tag. - * @returns {React.ReactNode} - Price react component. + * @param {string} props.tag - Topmost element tag. + * @return {React.ReactNode} - Price react component. */ const Price = ( { amount, currency, hidePriceFraction, tag = 'span' } ) => { const { symbol, integer, fraction } = getCurrencyObject( amount, currency ); diff --git a/projects/packages/search/src/dashboard/components/record-meter/index.jsx b/projects/packages/search/src/dashboard/components/record-meter/index.jsx index 8e1628f522583..874ede380add2 100644 --- a/projects/packages/search/src/dashboard/components/record-meter/index.jsx +++ b/projects/packages/search/src/dashboard/components/record-meter/index.jsx @@ -10,13 +10,13 @@ import './style.scss'; /** * Generate Record Meter showing how many records the user has indexed * - * @param {object} props - Props - * @param {number} props.postCount - Post count number of posts in total - * @param {object} props.postTypeBreakdown - Post type breakdown (post type => number of posts) - * @param {object} props.postTypes - Post types (post type label => post type slug) + * @param {object} props - Props + * @param {number} props.postCount - Post count number of posts in total + * @param {object} props.postTypeBreakdown - Post type breakdown (post type => number of posts) + * @param {object} props.postTypes - Post types (post type label => post type slug) * @param {number} props.tierMaximumRecords - Max number of records allowed in user's current tier - * @param {string} props.lastIndexedDate - The date on which the site was last indexed in ISO 8601 format - * @returns {React.Component} RecordMeter React component + * @param {string} props.lastIndexedDate - The date on which the site was last indexed in ISO 8601 format + * @return {React.Component} RecordMeter React component */ export default function RecordMeter( { postCount, diff --git a/projects/packages/search/src/dashboard/components/record-meter/lib/record-info.js b/projects/packages/search/src/dashboard/components/record-meter/lib/record-info.js index ea4811790d144..b7277e72a0be9 100644 --- a/projects/packages/search/src/dashboard/components/record-meter/lib/record-info.js +++ b/projects/packages/search/src/dashboard/components/record-meter/lib/record-info.js @@ -4,11 +4,11 @@ const PALETTE = require( '@automattic/color-studio' ); /** * Convert provided information into a chart-consumable data form * - * @param {number} postCount - The total count of indexed post records + * @param {number} postCount - The total count of indexed post records * @param {object} postTypeBreakdown - Post type breakdown (post type => number of posts) - * @param {string} lastIndexedDate - The date on which the site was last indexed as a string - * @param {object} postTypes - Post types (post type label => post type slug) - * @returns {object} data in correct form to use in chart and notice-box + * @param {string} lastIndexedDate - The date on which the site was last indexed as a string + * @param {object} postTypes - Post types (post type label => post type slug) + * @return {object} data in correct form to use in chart and notice-box */ export default function getRecordInfo( postCount, postTypeBreakdown, lastIndexedDate, postTypes ) { const maxPostTypeCount = 5; // this value determines when to cut off displaying post times & compound into an 'other' @@ -108,8 +108,8 @@ export default function getRecordInfo( postCount, postTypeBreakdown, lastIndexed * adds the appropriate labels the post type breakdown * * @param {Array} postTypeBreakdown - an array of the different post types with their counts - * @param {Array} postTypes - an array of the different post types labels matched with their slugs - * @returns {object} updated postTypeBreakdown containing the post type slug, label, and count + * @param {Array} postTypes - an array of the different post types labels matched with their slugs + * @return {object} updated postTypeBreakdown containing the post type slug, label, and count */ export function addLabelsToPostTypeBreakdown( postTypeBreakdown, postTypes ) { const postTypeBreakdownWithLabels = postTypeBreakdown.map( postType => { @@ -127,10 +127,10 @@ export function addLabelsToPostTypeBreakdown( postTypeBreakdown, postTypes ) { * split post types into those being displayed, * and those combined into the 'other' category * - * @param {Array} postTypeBreakdown - an array of the different post types with their counts - * @param {number} numItems - count of different post types - * @param {number} maxPostTypeCount - the max number of records to display before combining the rest into the 'other' category - * @returns {object} containing included items with post type and count, and other items, split. + * @param {Array} postTypeBreakdown - an array of the different post types with their counts + * @param {number} numItems - count of different post types + * @param {number} maxPostTypeCount - the max number of records to display before combining the rest into the 'other' category + * @return {object} containing included items with post type and count, and other items, split. */ export function splitUsablePostTypes( postTypeBreakdown, numItems, maxPostTypeCount ) { const count = maxPostTypeCount <= numItems ? maxPostTypeCount : numItems; @@ -145,7 +145,7 @@ export function splitUsablePostTypes( postTypeBreakdown, numItems, maxPostTypeCo * combine remaining item count for use in 'other' category * * @param {Array} otherItems - array of items, with their counts, to be combined into 'other' - * @returns {number} sum of all 'other' item counts + * @return {number} sum of all 'other' item counts */ export function combineOtherCount( otherItems ) { let runningTotal = 0; @@ -159,10 +159,10 @@ export function combineOtherCount( otherItems ) { /** * return chart-ready data * - * @param {object} data - data object with the count for the post type item + * @param {object} data - data object with the count for the post type item * @param {string} color - color code to be used for the chart item - * @param {string} name - name of post type for the label - * @returns {object} chart ready data with data, label and background color. + * @param {string} name - name of post type for the label + * @return {object} chart ready data with data, label and background color. */ export function createData( data, color, name ) { return { diff --git a/projects/packages/search/src/dashboard/components/record-meter/notice-box.jsx b/projects/packages/search/src/dashboard/components/record-meter/notice-box.jsx index 9baca63e04d99..6e9d71d0c5863 100644 --- a/projects/packages/search/src/dashboard/components/record-meter/notice-box.jsx +++ b/projects/packages/search/src/dashboard/components/record-meter/notice-box.jsx @@ -60,13 +60,13 @@ const getNotices = ( tierMaximumRecords = null ) => { /** * Returns a notice box for displaying notices about record count and plan limits * - * @param {object} props - Props - * @param {number} props.recordCount - Current count of user's total records - * @param {number} props.recordLimit - Max number of records allowed in user's current tier + * @param {object} props - Props + * @param {number} props.recordCount - Current count of user's total records + * @param {number} props.recordLimit - Max number of records allowed in user's current tier * @param {boolean} props.hasBeenIndexed - True if site has a last indexed date - * @param {boolean} props.hasValidData - True if data is present and in valid form - * @param {boolean} props.hasItems - True if there is at least one indexed record - * @returns {React.Component} notice box component. + * @param {boolean} props.hasValidData - True if data is present and in valid form + * @param {boolean} props.hasItems - True if there is at least one indexed record + * @return {React.Component} notice box component. */ export function NoticeBox( props ) { const activeNoticeIds = []; diff --git a/projects/packages/search/src/dashboard/components/record-meter/record-count.jsx b/projects/packages/search/src/dashboard/components/record-meter/record-count.jsx index 55ddadef1e0df..659532cc92517 100644 --- a/projects/packages/search/src/dashboard/components/record-meter/record-count.jsx +++ b/projects/packages/search/src/dashboard/components/record-meter/record-count.jsx @@ -11,7 +11,7 @@ const DOCS_URL = 'https://jetpack.com/support/search/jetpack-search-record-meter * Returns record count component showing current records indexed and max records available for tier. * * @param {object} props - current record count and plan record limit. - * @returns {React.Component} record count component. + * @return {React.Component} record count component. */ export function RecordCount( props ) { if ( ! props.recordCount ) { diff --git a/projects/packages/search/src/dashboard/components/search-promotion/index.jsx b/projects/packages/search/src/dashboard/components/search-promotion/index.jsx index d56604f2b9b0b..6b13120622402 100644 --- a/projects/packages/search/src/dashboard/components/search-promotion/index.jsx +++ b/projects/packages/search/src/dashboard/components/search-promotion/index.jsx @@ -6,7 +6,7 @@ import './style.scss'; /** * SearchPromotion component definition. * - * @returns {React.Component} SearchPromotion component. + * @return {React.Component} SearchPromotion component. */ export default function SearchPromotion() { return ( diff --git a/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx b/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx index dc0eeee3fbb4a..df266550d91ba 100644 --- a/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx +++ b/projects/packages/search/src/dashboard/components/upsell-nudge/index.jsx @@ -7,7 +7,7 @@ import './style.scss'; * Upsell nudge component * * @param {object} props - Props - * @returns {React.Component} - Upsell nudge component. + * @return {React.Component} - Upsell nudge component. */ export default function InstantSearchUpsellNudge( props = { upgrade: true } ) { return ( diff --git a/projects/packages/search/src/dashboard/hooks/use-connection.jsx b/projects/packages/search/src/dashboard/hooks/use-connection.jsx index 8bd1cedd86000..18c9a3e653240 100644 --- a/projects/packages/search/src/dashboard/hooks/use-connection.jsx +++ b/projects/packages/search/src/dashboard/hooks/use-connection.jsx @@ -5,7 +5,7 @@ import { STORE_ID as SEARCH_STORE_ID } from 'store'; /** * Expose the `connectionStatus`, `isFullyConnected` state object * - * @returns {object} connectionStatus, isFullyConnected + * @return {object} connectionStatus, isFullyConnected */ export default function useConnection() { const connectionStatus = useSelect( select => ( { diff --git a/projects/packages/search/src/dashboard/hooks/use-product-checkout-workflow.jsx b/projects/packages/search/src/dashboard/hooks/use-product-checkout-workflow.jsx index 272fce7009d46..cd2d03ac8f2b1 100644 --- a/projects/packages/search/src/dashboard/hooks/use-product-checkout-workflow.jsx +++ b/projects/packages/search/src/dashboard/hooks/use-product-checkout-workflow.jsx @@ -17,15 +17,15 @@ const { * Custom hook that performs the needed steps * to concrete the checkout workflow. * - * @param {object} props - The props passed to the hook. - * @param {string} props.productSlug - The WordPress product slug. - * @param {string} props.redirectUri - The URI to redirect to after checkout. - * @param {string} [props.siteSuffix] - The site suffix. - * @param {string} [props.blogID] - The blog ID. + * @param {object} props - The props passed to the hook. + * @param {string} props.productSlug - The WordPress product slug. + * @param {string} props.redirectUri - The URI to redirect to after checkout. + * @param {string} [props.siteSuffix] - The site suffix. + * @param {string} [props.blogID] - The blog ID. * @param {Function} props.siteProductAvailabilityHandler - The function used to check whether the site already has the requested product. This will be checked after registration and the checkout page will be skipped if the promise returned resloves true. - * @param {Function} props.from - The plugin slug initiated the flow. - * @param {Function} props.isWpcom - Whether it's WPCOM site. - * @returns {Function} - The useEffect hook. + * @param {Function} props.from - The plugin slug initiated the flow. + * @param {Function} props.isWpcom - Whether it's WPCOM site. + * @return {Function} - The useEffect hook. */ export default function useProductCheckoutWorkflow( { productSlug, @@ -78,7 +78,7 @@ export default function useProductCheckoutWorkflow( { * Handler to run the checkout workflow. * * @param {Event} [event] - Event that dispatched run - * @returns {void} Nothing. + * @return {void} Nothing. */ const run = event => { event && event.preventDefault(); diff --git a/projects/packages/search/src/dashboard/store/actions/jetpack-settings.js b/projects/packages/search/src/dashboard/store/actions/jetpack-settings.js index 4f38a4783473b..290f9d723af3c 100644 --- a/projects/packages/search/src/dashboard/store/actions/jetpack-settings.js +++ b/projects/packages/search/src/dashboard/store/actions/jetpack-settings.js @@ -21,8 +21,8 @@ export const TOGGLE_SEARCH_MODULE = 'TOGGLE_SEARCH_MODULE'; * Yield actions to update Search Settings * * @param {object} settings - settings to apply. - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* updateJetpackSettings( settings ) { try { @@ -49,7 +49,7 @@ export function* updateJetpackSettings( settings ) { /** * Set state updating action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingJetpackSettings() { return setJetpackSettings( { is_updating: true } ); @@ -58,7 +58,7 @@ export function setUpdatingJetpackSettings() { /** * Set state updating finished * - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setUpdatingJetpackSettingsDone() { return setJetpackSettings( { is_updating: false } ); @@ -68,7 +68,7 @@ export function setUpdatingJetpackSettingsDone() { * Set Jetpack settings action * * @param {object} options - Jetpack settings. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setJetpackSettings( options ) { return { type: SET_JETPACK_SETTINGS, options }; diff --git a/projects/packages/search/src/dashboard/store/actions/search-pricing.js b/projects/packages/search/src/dashboard/store/actions/search-pricing.js index d814ffb502030..ad094237a4582 100644 --- a/projects/packages/search/src/dashboard/store/actions/search-pricing.js +++ b/projects/packages/search/src/dashboard/store/actions/search-pricing.js @@ -4,7 +4,7 @@ export const SET_SEARCH_PRICING = 'SET_SEARCH_PRICING'; * Action to set search pricing * * @param {*} options - pricing object. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setSearchPricing( options ) { return { diff --git a/projects/packages/search/src/dashboard/store/actions/site-plan.js b/projects/packages/search/src/dashboard/store/actions/site-plan.js index dcff857e7c30b..2910c59ce0f7e 100644 --- a/projects/packages/search/src/dashboard/store/actions/site-plan.js +++ b/projects/packages/search/src/dashboard/store/actions/site-plan.js @@ -6,7 +6,7 @@ export const SET_SEARCH_PLAN_INFO = 'SET_SEARCH_PLAN_INFO'; * Action to set plan info * * @param {*} options - plan info. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setSearchPlanInfo( options ) { return { diff --git a/projects/packages/search/src/dashboard/store/actions/site-stats.js b/projects/packages/search/src/dashboard/store/actions/site-stats.js index f5459901ebf0b..a530aac68a533 100644 --- a/projects/packages/search/src/dashboard/store/actions/site-stats.js +++ b/projects/packages/search/src/dashboard/store/actions/site-stats.js @@ -4,7 +4,7 @@ export const SET_SEARCH_STATS = 'SET_SEARCH_STATS'; * Action to set site stats (e.g. record usage) * * @param {*} options - stats. - * @returns {object} - an action object. + * @return {object} - an action object. */ export function setSearchStats( options ) { return { diff --git a/projects/packages/search/src/dashboard/store/controls.js b/projects/packages/search/src/dashboard/store/controls.js index e7d37a9efe2f4..0788789c2c3da 100644 --- a/projects/packages/search/src/dashboard/store/controls.js +++ b/projects/packages/search/src/dashboard/store/controls.js @@ -9,7 +9,7 @@ export const FETCH_SEARCH_PRICING = 'FETCH_SEARCH_PRICING'; /** * fetchJetpackSettings action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchJetpackSettings = () => { return { @@ -21,7 +21,7 @@ export const fetchJetpackSettings = () => { * updateJetpackSettings action * * @param {*} settings - Jetpack settings object. - * @returns {object} - an action object. + * @return {object} - an action object. */ export const updateJetpackSettings = settings => { return { @@ -33,8 +33,8 @@ export const updateJetpackSettings = settings => { /** * fetchSearchPlanInfo action * - * @yields {object} - an action object. - * @returns {object} - an search plan object. + * @yield {object} - an action object. + * @return {object} - an search plan object. */ export function* fetchSearchPlanInfo() { const response = yield { @@ -46,7 +46,7 @@ export function* fetchSearchPlanInfo() { /** * fetchSearchStats action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchSearchStats = () => { return { @@ -57,7 +57,7 @@ export const fetchSearchStats = () => { /** * fetchSearchPricing action * - * @returns {object} - an action object. + * @return {object} - an action object. */ export const fetchSearchPricing = () => { return { diff --git a/projects/packages/search/src/dashboard/store/resolvers.js b/projects/packages/search/src/dashboard/store/resolvers.js index 5cf482bf5d1ce..0ce9458a3fb87 100644 --- a/projects/packages/search/src/dashboard/store/resolvers.js +++ b/projects/packages/search/src/dashboard/store/resolvers.js @@ -14,8 +14,8 @@ import { /** * Yield actions to get Search Module Status * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getSearchModuleStatus() { try { @@ -31,8 +31,8 @@ export function* getSearchModuleStatus() { /** * Yield actions to get search plan info * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getSearchPlanInfo() { try { @@ -48,8 +48,8 @@ export function* getSearchPlanInfo() { /** * Yield actions to get search stats * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getSearchStats() { try { @@ -65,8 +65,8 @@ export function* getSearchStats() { /** * Yield actions to get search pricing * - * @yields {object} - an action object. - * @returns {object} - an action object. + * @yield {object} - an action object. + * @return {object} - an action object. */ export function* getSearchPricing() { try { diff --git a/projects/packages/search/src/instant-search/components/path-breadcrumbs.jsx b/projects/packages/search/src/instant-search/components/path-breadcrumbs.jsx index d682e2afee7dc..3ecb7abde49db 100644 --- a/projects/packages/search/src/instant-search/components/path-breadcrumbs.jsx +++ b/projects/packages/search/src/instant-search/components/path-breadcrumbs.jsx @@ -6,7 +6,7 @@ import './path-breadcrumbs.scss'; * Splits URL by slashes for rendering breadcrumbs. * * @param {string} path - String URL. - * @returns {string[]} - Array of strings. + * @return {string[]} - Array of strings. */ function splitDomainPath( path ) { const splits = path.split( '/' ).filter( piece => piece.length > 0 ); diff --git a/projects/packages/search/src/instant-search/components/product-ratings.jsx b/projects/packages/search/src/instant-search/components/product-ratings.jsx index 22e25319fe182..c898e7d7f6772 100644 --- a/projects/packages/search/src/instant-search/components/product-ratings.jsx +++ b/projects/packages/search/src/instant-search/components/product-ratings.jsx @@ -7,11 +7,11 @@ import './product-ratings.scss'; /** * Renders a hook-based component for displaying product ratings. * - * @param {object} props - Component properties. - * @param {number} props.count - Number of ratings. - * @param {number} props.rating - Average rating out of five. + * @param {object} props - Component properties. + * @param {number} props.count - Number of ratings. + * @param {number} props.rating - Average rating out of five. * @param {string} props.permalink - Permalink URL to product page. - * @returns {object} Product rating component. + * @return {object} Product rating component. */ export default function ProductRatings( { rating = 0, count = 0, permalink } ) { return ( diff --git a/projects/packages/search/src/instant-search/components/search-filter.jsx b/projects/packages/search/src/instant-search/components/search-filter.jsx index 516441a2e5ba1..1645cf2e9f11e 100644 --- a/projects/packages/search/src/instant-search/components/search-filter.jsx +++ b/projects/packages/search/src/instant-search/components/search-filter.jsx @@ -10,7 +10,7 @@ import { getCheckedInputNames } from '../lib/dom'; * Get date options given an interval. * * @param {string} interval - Duration interval. - * @returns {object} - Object containing date options. + * @return {object} - Object containing date options. */ function getDateOptions( interval ) { switch ( interval ) { diff --git a/projects/packages/search/src/instant-search/components/search-result-expanded.jsx b/projects/packages/search/src/instant-search/components/search-result-expanded.jsx index 8621a077ee40d..7bb2af8a23cb7 100644 --- a/projects/packages/search/src/instant-search/components/search-result-expanded.jsx +++ b/projects/packages/search/src/instant-search/components/search-result-expanded.jsx @@ -10,7 +10,7 @@ import './search-result-expanded.scss'; * Functional component for expanded search results. * * @param {object} props - Component properties. - * @returns {Element} - Expanded search result component. + * @return {Element} - Expanded search result component. */ export default function SearchResultExpanded( props ) { const { isMultiSite, locale = 'en-US', showPostDate } = props; diff --git a/projects/packages/search/src/instant-search/lib/a11y.js b/projects/packages/search/src/instant-search/lib/a11y.js index 9f7acf1bfb153..eb46bbba04617 100644 --- a/projects/packages/search/src/instant-search/lib/a11y.js +++ b/projects/packages/search/src/instant-search/lib/a11y.js @@ -2,7 +2,7 @@ * Check if the user has specified that they prefer reduced motion * * @see https://www.joshwcomeau.com/react/prefers-reduced-motion/ - * @returns {boolean} Prefers reduced motion? + * @return {boolean} Prefers reduced motion? */ export function getPrefersReducedMotion() { const query = '(prefers-reduced-motion: no-preference)'; diff --git a/projects/packages/search/src/instant-search/lib/api.js b/projects/packages/search/src/instant-search/lib/api.js index 4fd36aa2df50f..45d06872fa8cf 100644 --- a/projects/packages/search/src/instant-search/lib/api.js +++ b/projects/packages/search/src/instant-search/lib/api.js @@ -25,7 +25,7 @@ resetAbortController(); * Builds ElasticSerach aggregations for filters defined by search widgets. * * @param {object[]} widgets - an array of widget configuration objects - * @returns {object} filter aggregations + * @return {object} filter aggregations */ export function buildFilterAggregations( widgets = [] ) { const aggregation = {}; @@ -42,7 +42,7 @@ export function buildFilterAggregations( widgets = [] ) { * Tried to merge the buckets, but which ended up showing too many filters. * * @param {object} newAggregations - New aggregations to operate on. - * @returns {object} - Aggregations with doc_count set to 0. + * @return {object} - Aggregations with doc_count set to 0. */ export function setDocumentCountsToZero( newAggregations ) { newAggregations = newAggregations ?? {}; @@ -63,7 +63,7 @@ export function setDocumentCountsToZero( newAggregations ) { * Builds ElasticSearch aggregations for a given filter. * * @param {object[]} filter - a filter object from a widget configuration object. - * @returns {object} filter aggregations + * @return {object} filter aggregations */ function generateAggregation( filter ) { switch ( filter.type ) { @@ -100,9 +100,9 @@ const DATE_REGEX = /(\d{4})-(\d{2})-(\d{2})/; * Generates a ElasticSearch date range filter. * * @param {string} fieldName - Name of the field (created, modified, etc). - * @param {string} input - Filter value. - * @param {string} type - Date range type (year vs month). - * @returns {object} date filter. + * @param {string} input - Filter value. + * @param {string} type - Date range type (year vs month). + * @return {object} date filter. */ export function generateDateRangeFilter( fieldName, input, type ) { let year, month; @@ -166,7 +166,7 @@ const filterKeyToEsFilter = new Map( [ * Build static filters object * * @param {object} staticFilters - list of static filter key-value. - * @returns {object} - list of selected static filters. + * @return {object} - list of selected static filters. */ function buildStaticFilters( staticFilters ) { const selectedFilters = {}; @@ -185,10 +185,10 @@ function buildStaticFilters( staticFilters ) { /** * Build an ElasticSearch filter object. * - * @param {object} filterQuery - Filter query value object. - * @param {object} adminQueryFilter - Manual ElasticSearch query override. + * @param {object} filterQuery - Filter query value object. + * @param {object} adminQueryFilter - Manual ElasticSearch query override. * @param {string} excludedPostTypes - Post types excluded via the Customizer. - * @returns {object} ElasticSearch filter object. + * @return {object} ElasticSearch filter object. */ function buildFilterObject( filterQuery, adminQueryFilter, excludedPostTypes ) { const filter = { bool: { must: [] } }; @@ -231,7 +231,7 @@ const SORT_QUERY_MAP = new Map( [ * Map sort values to ones compatible with the API. * * @param {string} sort - Sort value. - * @returns {string} Mapped sort value. + * @return {string} Mapped sort value. */ function mapSortToApiValue( sort ) { // Some sorts don't need to be mapped @@ -247,7 +247,7 @@ function mapSortToApiValue( sort ) { * Generate the query string for an API request * * @param {object} options - Options object for the function - * @returns {string} The generated query string. + * @return {string} The generated query string. */ function generateApiQueryString( { aggregations, @@ -348,7 +348,7 @@ function generateApiQueryString( { * Generate an error handler for a given cache key * * @param {string} cacheKey - The cache key to use - * @returns {Function} An error handler to be used with a search request + * @return {Function} An error handler to be used with a search request */ function errorHandlerFactory( cacheKey ) { return function errorHandler( error ) { @@ -374,9 +374,9 @@ function errorHandlerFactory( cacheKey ) { /** * Generate a response handler for a given cache key * - * @param {string} cacheKey - The cache key to use + * @param {string} cacheKey - The cache key to use * @param {number} requestId - Sequential ID used to determine recency of requests. - * @returns {Function} A response handler to be used with a search request + * @return {Function} A response handler to be used with a search request */ function responseHandlerFactory( cacheKey, requestId ) { return function responseHandler( responseJson ) { @@ -400,9 +400,9 @@ function resetAbortController() { /** * Perform a search. * - * @param {object} options - Search options + * @param {object} options - Search options * @param {number} requestId - Sequential ID used to determine recency of requests. - * @returns {Promise} A promise to the JSON response object + * @return {Promise} A promise to the JSON response object */ export function search( options, requestId ) { const key = stringify( Array.from( arguments ) ); diff --git a/projects/packages/search/src/instant-search/lib/array-overlap.js b/projects/packages/search/src/instant-search/lib/array-overlap.js index 6083ae6e74764..c3b1a6cd5c0ba 100644 --- a/projects/packages/search/src/instant-search/lib/array-overlap.js +++ b/projects/packages/search/src/instant-search/lib/array-overlap.js @@ -3,7 +3,7 @@ * * @param {any[]} a1 - First array. * @param {any[]} a2 - Second array. - * @returns {any[]} An array containing only overlaps/intersections. + * @return {any[]} An array containing only overlaps/intersections. */ export default function arrayOverlap( a1, a2 ) { if ( ! Array.isArray( a1 ) ) { diff --git a/projects/packages/search/src/instant-search/lib/colors.js b/projects/packages/search/src/instant-search/lib/colors.js index 8ac33cb9df2ee..880dd4f477d07 100644 --- a/projects/packages/search/src/instant-search/lib/colors.js +++ b/projects/packages/search/src/instant-search/lib/colors.js @@ -2,7 +2,7 @@ * Extracts hex code from a string. Normalizes 3 digit hex into 6 digit hex. * * @param {string} input - String containing hex code, usually prepended with #. - * @returns {string} - Hex code. + * @return {string} - Hex code. */ function extractHexCode( input ) { let output; @@ -22,7 +22,7 @@ function extractHexCode( input ) { * Generates a constrasting color hex code given a color hex code. * * @param {string} input - String containing a hex color code. - * @returns {string} - Hex code for a contrasting color. + * @return {string} - Hex code for a contrasting color. */ export function getConstrastingColor( input ) { // https://gomakethings.com/dynamically-changing-the-text-color-based-on-background-color-contrast-with-vanilla-js/ diff --git a/projects/packages/search/src/instant-search/lib/customize.js b/projects/packages/search/src/instant-search/lib/customize.js index c69657e528ae3..ced17b5001b59 100644 --- a/projects/packages/search/src/instant-search/lib/customize.js +++ b/projects/packages/search/src/instant-search/lib/customize.js @@ -15,7 +15,7 @@ const SETTINGS_TO_STATE_MAP = new Map( [ /** * Detects if the current environment is within WP's Customizer. * - * @returns {boolean} is in customizer. + * @return {boolean} is in customizer. */ export function isInCustomizer() { return typeof window?.wp?.customize === 'function'; diff --git a/projects/packages/search/src/instant-search/lib/dom.js b/projects/packages/search/src/instant-search/lib/dom.js index e9927d5ac8bc2..eda84cf6fda65 100644 --- a/projects/packages/search/src/instant-search/lib/dom.js +++ b/projects/packages/search/src/instant-search/lib/dom.js @@ -2,7 +2,7 @@ * Fetches the names of all checkbox elements contained within the parent element. * * @param {Element} parentDom - Parent element containing one or more checkboxes. - * @returns {string[]} - Names of checkboxes. + * @return {string[]} - Names of checkboxes. */ export function getCheckedInputNames( parentDom ) { return [ ...parentDom.querySelectorAll( 'input[type="checkbox"]' ).values() ] @@ -14,7 +14,7 @@ export function getCheckedInputNames( parentDom ) { * Returns an object containing theme options. Values can be overridden using the optional input parameter. * * @param {object} searchOptions - Search options. - * @returns {object} - Search options. + * @return {object} - Search options. */ export function getThemeOptions( searchOptions ) { const options = { diff --git a/projects/packages/search/src/instant-search/lib/dummy-debug.js b/projects/packages/search/src/instant-search/lib/dummy-debug.js index 900130aba4188..d78406328c842 100644 --- a/projects/packages/search/src/instant-search/lib/dummy-debug.js +++ b/projects/packages/search/src/instant-search/lib/dummy-debug.js @@ -3,6 +3,6 @@ const noop = () => {}; /** * Used to replace `debug` calls in production. * - * @returns {Function} A noop function. + * @return {Function} A noop function. */ export default () => noop; diff --git a/projects/packages/search/src/instant-search/lib/errors.js b/projects/packages/search/src/instant-search/lib/errors.js index e28771f070e74..8a55153c0b54f 100644 --- a/projects/packages/search/src/instant-search/lib/errors.js +++ b/projects/packages/search/src/instant-search/lib/errors.js @@ -4,7 +4,7 @@ import { __, sprintf } from '@wordpress/i18n'; * Returns an error message based on the error code. * * @param {Error} error - Error object - * @returns {*} an error message + * @return {*} an error message */ export function getErrorMessage( error ) { switch ( error?.message ) { diff --git a/projects/packages/search/src/instant-search/lib/filters.js b/projects/packages/search/src/instant-search/lib/filters.js index 8ee4d4dbb4010..f7ded927793c7 100644 --- a/projects/packages/search/src/instant-search/lib/filters.js +++ b/projects/packages/search/src/instant-search/lib/filters.js @@ -27,9 +27,9 @@ export const FILTER_KEYS = Object.freeze( [ /** * Returns an array of valid filter key strings. * - * @param {object[]} widgets - Array of Jetpack Search widget objects inside the overlay sidebar. + * @param {object[]} widgets - Array of Jetpack Search widget objects inside the overlay sidebar. * @param {object[]} widgetsOutsideOverlay - Array of Jetpack Search widget objects outside the overlay sidebar. - * @returns {string[]} filterKeys + * @return {string[]} filterKeys */ export function getFilterKeys( widgets = window[ SERVER_OBJECT_NAME ]?.widgets, @@ -51,7 +51,7 @@ export function getFilterKeys( * Get a list of provided static filters. * * @param {'sidebar'|'tabbed'|undefined} variation - the filter variation to get (tabbed or sidebar), defaults to none (returns every variation). - * @returns {Array} list of available static filters. + * @return {Array} list of available static filters. */ export function getAvailableStaticFilters( variation ) { if ( ! window[ SERVER_OBJECT_NAME ]?.staticFilters ) { @@ -76,7 +76,7 @@ export function getAvailableStaticFilters( variation ) { /** * Get static filter keys. * - * @returns {Array} list of available static filters keys. + * @return {Array} list of available static filters keys. */ export function getStaticFilterKeys() { const staticFilters = getAvailableStaticFilters(); @@ -90,7 +90,7 @@ export function getStaticFilterKeys() { * Returns an array of filter keys selectable from within the overlay. * * @param {object[]} widgets - Array of Jetpack Search widget objects inside the overlay sidebar. - * @returns {string[]} filterKeys + * @return {string[]} filterKeys */ export function getSelectableFilterKeys( widgets = window[ SERVER_OBJECT_NAME ]?.widgets ) { return ( @@ -104,7 +104,7 @@ export function getSelectableFilterKeys( widgets = window[ SERVER_OBJECT_NAME ]? * In other words, they were either selected via filters outside the search sidebar or entered manually. * * @param {object[]} widgets - Array of Jetpack Search widget objects inside the overlay sidebar. - * @returns {string[]} filterKeys + * @return {string[]} filterKeys */ export function getUnselectableFilterKeys( widgets = window[ SERVER_OBJECT_NAME ]?.widgets ) { const selectable = getSelectableFilterKeys( widgets ); @@ -115,7 +115,7 @@ export function getUnselectableFilterKeys( widgets = window[ SERVER_OBJECT_NAME * Returns an array of filter keys from a given widget. * * @param {object} widget - a Jetpack Search widget object - * @returns {string[]} filterKeys + * @return {string[]} filterKeys */ function extractFilterKeys( widget ) { return widget.filters @@ -127,7 +127,7 @@ function extractFilterKeys( widget ) { * Returns a filter key given a filter object. * * @param {object} filter - a Jetpack Search filter object - * @returns {string} filterKeys + * @return {string} filterKeys */ export function mapFilterToFilterKey( filter ) { if ( filter.type === 'date_histogram' ) { @@ -151,7 +151,7 @@ export function mapFilterToFilterKey( filter ) { * Inverse of `mapFilterToFilterKey`. * * @param {string} filterKey - filter key string to be mapped. - * @returns {object} filterObject + * @return {object} filterObject */ export function mapFilterKeyToFilter( filterKey ) { if ( filterKey.includes( 'month' ) ) { @@ -194,7 +194,7 @@ export function mapFilterKeyToFilter( filterKey ) { * Returns the type of the inputted filter object. * * @param {object} filter - filter key string to be mapped. - * @returns {string|undefined} output + * @return {string|undefined} output */ export function mapFilterToType( filter ) { if ( filter.type === 'date_histogram' ) { diff --git a/projects/packages/search/src/instant-search/lib/hooks/use-photon.js b/projects/packages/search/src/instant-search/lib/hooks/use-photon.js index 0e5e3a5be3ecd..8c6f31b0255d2 100644 --- a/projects/packages/search/src/instant-search/lib/hooks/use-photon.js +++ b/projects/packages/search/src/instant-search/lib/hooks/use-photon.js @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react'; * Strips query string values from URLs; photon can't handle them. * * @param {string} url - Image URL - * @returns {string} - Image URL without any query strings. + * @return {string} - Image URL without any query strings. */ function stripQueryString( url ) { if ( ! url ) { @@ -17,11 +17,11 @@ function stripQueryString( url ) { /** * Hook for returning a Photonized image URL given width and height parameters. * - * @param {string} initialSrc - Image URL - * @param {number} width - width in pixels - * @param {number} height - height in pixels + * @param {string} initialSrc - Image URL + * @param {number} width - width in pixels + * @param {number} height - height in pixels * @param {boolean} isPhotonEnabled - Toggle photon on/off - * @returns {string} - Photonized image URL if service is available; initialSrc otherwise. + * @return {string} - Photonized image URL if service is available; initialSrc otherwise. */ export function usePhoton( initialSrc, width, height, isPhotonEnabled = true ) { const [ src, setSrc ] = useState( null ); diff --git a/projects/packages/search/src/instant-search/lib/query-string.js b/projects/packages/search/src/instant-search/lib/query-string.js index 653698786854f..06c21a199cf29 100644 --- a/projects/packages/search/src/instant-search/lib/query-string.js +++ b/projects/packages/search/src/instant-search/lib/query-string.js @@ -7,7 +7,7 @@ import { getFilterKeys, getStaticFilterKeys } from './filters'; * Parses the address bar's query string into an object. * * @param {string} search - raw query string prepended with '?' - * @returns {object} queryObject - a query object. + * @return {object} queryObject - a query object. */ export function getQuery( search = window.location.search ) { return decode( search.substring( 1 ), false, false ); @@ -44,7 +44,7 @@ function pushQueryString( queryString ) { /** * Returns a result format value from the query string. Used to override the site's configured result format. * - * @returns {null|string} resultFormatQuery + * @return {null|string} resultFormatQuery */ export function getResultFormatQuery() { const query = getQuery(); @@ -59,9 +59,9 @@ export function getResultFormatQuery() { /** * Navigates the window to a specified location with all search-related query values stirpped out. * - * @param {string} initialHref - Target location to navigate to via push/replaceState. - * @param {Function} callback - Callback to be invoked if initialHref didn't include any search queries. - * @param {boolean} replaceState - Flag to toggle replaceState or pushState invocation. Useful if this function's being invoked due to history navigation. + * @param {string} initialHref - Target location to navigate to via push/replaceState. + * @param {Function} callback - Callback to be invoked if initialHref didn't include any search queries. + * @param {boolean} replaceState - Flag to toggle replaceState or pushState invocation. Useful if this function's being invoked due to history navigation. */ export function restorePreviousHref( initialHref, callback, replaceState = false ) { if ( history.pushState && history.replaceState ) { diff --git a/projects/packages/search/src/instant-search/lib/sort.js b/projects/packages/search/src/instant-search/lib/sort.js index 4a123fa6fc9f3..a48bcba1c5d94 100644 --- a/projects/packages/search/src/instant-search/lib/sort.js +++ b/projects/packages/search/src/instant-search/lib/sort.js @@ -3,8 +3,8 @@ import { PRODUCT_SORT_OPTIONS, RESULT_FORMAT_PRODUCT, SORT_OPTIONS } from './con /** * Get the available sort options for the provided result format * - * @param {string} resultFormat - Result format - * @returns {Map} - Sort options + * @param {string} resultFormat - Result format + * @return {Map} - Sort options */ export function getSortOptions( resultFormat = null ) { if ( resultFormat !== RESULT_FORMAT_PRODUCT ) { diff --git a/projects/packages/search/src/instant-search/lib/test-helpers/tiny-lru.mock.js b/projects/packages/search/src/instant-search/lib/test-helpers/tiny-lru.mock.js index 4305c88d83134..eb15893eedefe 100644 --- a/projects/packages/search/src/instant-search/lib/test-helpers/tiny-lru.mock.js +++ b/projects/packages/search/src/instant-search/lib/test-helpers/tiny-lru.mock.js @@ -1,7 +1,7 @@ /** * Returns a mocked version of `tiny-lru`. * - * @returns {object} A mocked LRU cache object. + * @return {object} A mocked LRU cache object. */ export default function tinyLruMocked() { return { diff --git a/projects/packages/search/src/instant-search/lib/tracks.js b/projects/packages/search/src/instant-search/lib/tracks.js index 9034f772804a2..7788f27336343 100644 --- a/projects/packages/search/src/instant-search/lib/tracks.js +++ b/projects/packages/search/src/instant-search/lib/tracks.js @@ -31,8 +31,8 @@ export function resetTrackingCookies( forceEnableAnalytics = false ) { /** * Associates the current site with events fired in the future. * - * @param {number|string} siteId - Current site identifier. - * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. + * @param {number|string} siteId - Current site identifier. + * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. */ export function identifySite( siteId, forceEnableAnalytics = false ) { if ( forceEnableAnalytics || isAnalyticsEnabled ) { @@ -43,8 +43,8 @@ export function identifySite( siteId, forceEnableAnalytics = false ) { /** * Fires a general event to Tracks. * - * @param {string} eventName - Name of the event. - * @param {object} properties - Event properties. + * @param {string} eventName - Name of the event. + * @param {object} properties - Event properties. * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. */ export function recordEvent( eventName, properties, forceEnableAnalytics = false ) { @@ -55,7 +55,7 @@ export function recordEvent( eventName, properties, forceEnableAnalytics = false /** * Fires a TrainTracks render event to Tracks. * - * @param {object} properties - Event properties. + * @param {object} properties - Event properties. * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. */ export function recordTrainTracksRender( properties, forceEnableAnalytics = false ) { @@ -65,7 +65,7 @@ export function recordTrainTracksRender( properties, forceEnableAnalytics = fals /** * Fires a TrainTracks interaction event to Tracks. * - * @param {object} properties - Event properties. + * @param {object} properties - Event properties. * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. */ export function recordTrainTracksInteract( properties, forceEnableAnalytics = false ) { @@ -75,7 +75,7 @@ export function recordTrainTracksInteract( properties, forceEnableAnalytics = fa /** * Fires a static filter selection event to Tracks. * - * @param {object} properties - Event properties to send to Tracks. + * @param {object} properties - Event properties to send to Tracks. * @param {boolean} forceEnableAnalytics - Forcibly enable analytics, ignoring the isAnalyticsEnabled flag. */ export function recordStaticFilterSelect( properties, forceEnableAnalytics = false ) { diff --git a/projects/packages/search/src/instant-search/store/actions.js b/projects/packages/search/src/instant-search/store/actions.js index d5d7d59cc187c..252621a6a1434 100644 --- a/projects/packages/search/src/instant-search/store/actions.js +++ b/projects/packages/search/src/instant-search/store/actions.js @@ -2,7 +2,7 @@ * Returns an action object used to make a search result request. * * @param {object} options - Search options. - * @returns {object} Action object. + * @return {object} Action object. */ export function makeSearchRequest( options ) { return { @@ -14,10 +14,10 @@ export function makeSearchRequest( options ) { /** * Returns an action object used to record a successful search request. * - * @param {object} params - Input parameters. - * @param {object} params.options - Action options that generated this API response. + * @param {object} params - Input parameters. + * @param {object} params.options - Action options that generated this API response. * @param {object} params.response - API response. - * @returns {object} Action object. + * @return {object} Action object. */ export function recordSuccessfulSearchRequest( { options, response } ) { return { @@ -31,7 +31,7 @@ export function recordSuccessfulSearchRequest( { options, response } ) { * Returns an action object used to record a failed search request. * * @param {object} error - Error from the failed search request. - * @returns {object} Action object. + * @return {object} Action object. */ export function recordFailedSearchRequest( error ) { return { @@ -43,9 +43,9 @@ export function recordFailedSearchRequest( error ) { /** * Returns an action object used to initialize query value related reducers. * - * @param {object} params - Input parameters. + * @param {object} params - Input parameters. * @param {boolean} params.isHistoryNavigation - True if this action is invoked via history navigation. - * @returns {object} Action object. + * @return {object} Action object. */ export function initializeQueryValues( { isHistoryNavigation = false } = {} ) { return { @@ -57,9 +57,9 @@ export function initializeQueryValues( { isHistoryNavigation = false } = {} ) { /** * Returns an action object used to set a search query value. * - * @param {string} query - Inputted user query. + * @param {string} query - Inputted user query. * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the search query in the location bar. - * @returns {object} Action object. + * @return {object} Action object. */ export function setSearchQuery( query, propagateToWindow = true ) { return { @@ -72,9 +72,9 @@ export function setSearchQuery( query, propagateToWindow = true ) { /** * Returns an action object used to set a search sort value. * - * @param {string} sort - Sort value. + * @param {string} sort - Sort value. * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the query string in the location bar. - * @returns {object} Action object. + * @return {object} Action object. */ export function setSort( sort, propagateToWindow = true ) { return { @@ -87,10 +87,10 @@ export function setSort( sort, propagateToWindow = true ) { /** * Returns an action object used to set a search filter. * - * @param {string} name - Filter name. - * @param {string[]} value - Filter values. - * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the query string in the location bar. - * @returns {object} Action object. + * @param {string} name - Filter name. + * @param {string[]} value - Filter values. + * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the query string in the location bar. + * @return {object} Action object. */ export function setFilter( name, value, propagateToWindow = true ) { return { @@ -104,10 +104,10 @@ export function setFilter( name, value, propagateToWindow = true ) { /** * Returns an action object used to set a static search filter. * - * @param {string} name - Filter name. - * @param {string[]} value - Filter values. - * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the query string in the location bar. - * @returns {object} Action object. + * @param {string} name - Filter name. + * @param {string[]} value - Filter values. + * @param {boolean} propagateToWindow - If true, will tell the effects handler to set the query string in the location bar. + * @return {object} Action object. */ export function setStaticFilter( name, value, propagateToWindow = true ) { return { @@ -122,7 +122,7 @@ export function setStaticFilter( name, value, propagateToWindow = true ) { * Returns an action object used to clear all filter values. * * @param {boolean} propagateToWindow - If true, will tell the effects handler to update the query string in the location bar. - * @returns {object} Action object. + * @return {object} Action object. */ export function clearFilters( propagateToWindow = true ) { return { @@ -134,7 +134,7 @@ export function clearFilters( propagateToWindow = true ) { /** * Returns an action object used to clear all query values. Invoked when the search modal is dismissed. * - * @returns {object} Action object. + * @return {object} Action object. */ export function clearQueryValues() { return { @@ -146,7 +146,7 @@ export function clearQueryValues() { * Returns an action object used to disable query string integration. * Used when search app is used in the Gutenberg context. * - * @returns {object} Action object. + * @return {object} Action object. */ export function disableQueryStringIntegration() { return { diff --git a/projects/packages/search/src/instant-search/store/effects.js b/projects/packages/search/src/instant-search/store/effects.js index 0d9149959c272..92a4f79e81b50 100644 --- a/projects/packages/search/src/instant-search/store/effects.js +++ b/projects/packages/search/src/instant-search/store/effects.js @@ -26,7 +26,7 @@ const debouncedSetQuery = debounce( setQuery, DEBOUNCED_TIME_TO_SET_QUERY_MILLIS * Effect handler which will fetch search results from the API. * * @param {object} action - Action which had initiated the effect handler. - * @param {object} store - Store instance. + * @param {object} store - Store instance. */ function makeSearchAPIRequest( action, store ) { requestCounter++; @@ -50,7 +50,7 @@ function makeSearchAPIRequest( action, store ) { * Initialize query values from the browser's address bar. * * @param {object} action - Action which had initiated the effect handler. - * @param {object} store - Store instance. + * @param {object} store - Store instance. */ function initializeQueryValues( action, store ) { const queryObject = getQuery(); diff --git a/projects/packages/search/src/instant-search/store/reducer/api.js b/projects/packages/search/src/instant-search/store/reducer/api.js index c446c9d7673d8..2742bf129785e 100644 --- a/projects/packages/search/src/instant-search/store/reducer/api.js +++ b/projects/packages/search/src/instant-search/store/reducer/api.js @@ -4,9 +4,9 @@ let cachedAggregations = {}; /** * Reducer for recording if the previous search request yielded an error. * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function hasError( state = false, action ) { switch ( action.type ) { @@ -23,9 +23,9 @@ export function hasError( state = false, action ) { /** * Reducer for recording search request state. * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function isLoading( state = false, action ) { switch ( action.type ) { @@ -42,9 +42,9 @@ export function isLoading( state = false, action ) { /** * Reducer for recording search results. * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function response( state = {}, action ) { switch ( action.type ) { diff --git a/projects/packages/search/src/instant-search/store/reducer/history.js b/projects/packages/search/src/instant-search/store/reducer/history.js index 93b7252b48cb4..2a5aee1138864 100644 --- a/projects/packages/search/src/instant-search/store/reducer/history.js +++ b/projects/packages/search/src/instant-search/store/reducer/history.js @@ -1,9 +1,9 @@ /** * Returns true if the query string change was performed by a history navigation. * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function isHistoryNavigation( state = false, action ) { switch ( action.type ) { diff --git a/projects/packages/search/src/instant-search/store/reducer/query-string.js b/projects/packages/search/src/instant-search/store/reducer/query-string.js index d56918485918b..1536cf6b686bc 100644 --- a/projects/packages/search/src/instant-search/store/reducer/query-string.js +++ b/projects/packages/search/src/instant-search/store/reducer/query-string.js @@ -4,9 +4,9 @@ import { getFilterKeys, getStaticFilterKeys } from '../../lib/filters'; /** * Reducer for keeping track of the user's inputted search query * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function searchQuery( state = null, action ) { switch ( action.type ) { @@ -22,9 +22,9 @@ export function searchQuery( state = null, action ) { /** * Reducer for keeping track of the user's selected sort type * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function sort( state = null, action ) { switch ( action.type ) { @@ -44,9 +44,9 @@ export function sort( state = null, action ) { /** * Reducer for keeping track of the user's selected filter value * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function filters( state = {}, action ) { switch ( action.type ) { @@ -77,9 +77,9 @@ export function filters( state = {}, action ) { /** * Reducer for keeping track of the user's selected static filter value * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {object} action - Dispatched action. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function staticFilters( state = {}, action ) { switch ( action.type ) { diff --git a/projects/packages/search/src/instant-search/store/reducer/server-options.js b/projects/packages/search/src/instant-search/store/reducer/server-options.js index 256bff0bc768d..71153c51e3710 100644 --- a/projects/packages/search/src/instant-search/store/reducer/server-options.js +++ b/projects/packages/search/src/instant-search/store/reducer/server-options.js @@ -4,7 +4,7 @@ import { SERVER_OBJECT_NAME } from '../../lib/constants'; * Reducer for storing server-generated values in the Redux store. * * @param {object} state - Current state. - * @returns {object} Updated state. + * @return {object} Updated state. */ export function serverOptions( state = window[ SERVER_OBJECT_NAME ] ?? {} ) { return state; diff --git a/projects/packages/search/src/instant-search/store/selectors.js b/projects/packages/search/src/instant-search/store/selectors.js index e7d87b8712ea2..eebe508b96047 100644 --- a/projects/packages/search/src/instant-search/store/selectors.js +++ b/projects/packages/search/src/instant-search/store/selectors.js @@ -5,7 +5,7 @@ import { getUnselectableFilterKeys, mapFilterKeyToFilter } from '../lib/filters' * Get the stored API response. * * @param {object} state - Current state. - * @returns {object} Response object. + * @return {object} Response object. */ export function getResponse( state ) { return state.response; @@ -15,7 +15,7 @@ export function getResponse( state ) { * Get the hasError flag. * * @param {object} state - Current state. - * @returns {boolean} hasError - Whether the API returned an erroneous response. + * @return {boolean} hasError - Whether the API returned an erroneous response. */ export function hasError( state ) { return state.hasError; @@ -25,7 +25,7 @@ export function hasError( state ) { * Get the hasNextPage flag. * * @param {object} state - Current state. - * @returns {boolean} hasNextPage - Whether the API contains a page handle for a subsequent page. + * @return {boolean} hasNextPage - Whether the API contains a page handle for a subsequent page. */ export function hasNextPage( state ) { return ! hasError( state ) && getResponse( state )?.page_handle; @@ -35,7 +35,7 @@ export function hasNextPage( state ) { * Get the isLoading flag. * * @param {object} state - Current state. - * @returns {boolean} isLoading - Whether the API request is still loading. + * @return {boolean} isLoading - Whether the API request is still loading. */ export function isLoading( state ) { return state.isLoading; @@ -45,7 +45,7 @@ export function isLoading( state ) { * Get the search query. * * @param {object} state - Current state. - * @returns {string} searchQuery - The search query entered by the user. + * @return {string} searchQuery - The search query entered by the user. */ export function getSearchQuery( state ) { return state.searchQuery; @@ -54,9 +54,9 @@ export function getSearchQuery( state ) { /** * Get the sort key. * - * @param {object} state - Current state. + * @param {object} state - Current state. * @param {string?} defaultSort - Default sort order specified via the Customizer. - * @returns {string} sort - The selected sort key for the search interface. + * @return {string} sort - The selected sort key for the search interface. */ export function getSort( state, defaultSort ) { // Default non-string defaultSort to 'relevance' @@ -70,7 +70,7 @@ export function getSort( state, defaultSort ) { * Get the filters. * * @param {object} state - Current state. - * @returns {object} filters - An object mapping filter keys and its selected values. + * @return {object} filters - An object mapping filter keys and its selected values. */ export function getFilters( state ) { return state.filters; @@ -80,7 +80,7 @@ export function getFilters( state ) { * Get the selected static filters. * * @param {object} state - Current state. - * @returns {object} filters - An object mapping filter keys and its selected values. + * @return {object} filters - An object mapping filter keys and its selected values. */ export function getStaticFilters( state ) { return state.staticFilters; @@ -90,7 +90,7 @@ export function getStaticFilters( state ) { * Checks if any filters have been selected. * * @param {object} state - Current state. - * @returns {object} hasFilters - true if any filter has been selected. + * @return {object} hasFilters - true if any filter has been selected. */ export function hasFilters( state ) { return Object.keys( state.filters ).length > 0; @@ -100,7 +100,7 @@ export function hasFilters( state ) { * Checks if any static filters have been selected. * * @param {object} state - Current state. - * @returns {object} hasStaticFilters - true if any filter has been selected. + * @return {object} hasStaticFilters - true if any filter has been selected. */ function hasStaticFilters( state ) { return Object.keys( state.staticFilters ).length > 0; @@ -110,7 +110,7 @@ function hasStaticFilters( state ) { * Checks if there is an active search-related query values. * * @param {object} state - Current state. - * @returns {object} hasActiveQuery - true if any search-related query value has been defined. + * @return {object} hasActiveQuery - true if any search-related query value has been defined. */ export function hasActiveQuery( state ) { return ( @@ -127,7 +127,7 @@ export function hasActiveQuery( state ) { * This is used to render a single SearchFilters component for all filters selected outside the search overlay. * * @param {object} state - Redux state tree. - * @returns {{ filters: object[] }} pseudoWidget - contains `filters`, an array of filter objects selected outside the search overlay. + * @return {{ filters: object[] }} pseudoWidget - contains `filters`, an array of filter objects selected outside the search overlay. */ export function getWidgetOutsideOverlay( state ) { // Both of these values should default to [] when empty; they should never be falsy. @@ -146,7 +146,7 @@ export function getWidgetOutsideOverlay( state ) { * Returns true if the query string change was performed by a history navigation. * * @param {object} state - Current state. - * @returns {boolean} isHistoryNavigation. + * @return {boolean} isHistoryNavigation. */ export function isHistoryNavigation( state ) { return state.isHistoryNavigation; diff --git a/projects/packages/search/tools/define-palette-colors-as-static-variables.js b/projects/packages/search/tools/define-palette-colors-as-static-variables.js index 66f6daf021742..28d2401e7505d 100644 --- a/projects/packages/search/tools/define-palette-colors-as-static-variables.js +++ b/projects/packages/search/tools/define-palette-colors-as-static-variables.js @@ -5,7 +5,7 @@ const webpack = require( 'webpack' ); /** * Returns an instance of the DefinePlugin that adds color-studio colors as literals. * - * @returns {object} DefinePlugin instance. + * @return {object} DefinePlugin instance. */ function definePaletteColorsAsStaticVariables() { return new webpack.DefinePlugin( { diff --git a/projects/packages/search/tools/webpack.instant.config.js b/projects/packages/search/tools/webpack.instant.config.js index 156163122a08b..b971d5b1602c3 100644 --- a/projects/packages/search/tools/webpack.instant.config.js +++ b/projects/packages/search/tools/webpack.instant.config.js @@ -14,7 +14,7 @@ const webpack = jetpackWebpackConfig.webpack; * This enables us to alias Preact to all React imports. * * @param {string} request - Requested module - * @returns {(string|string[]|undefined)} Script global + * @return {(string|string[]|undefined)} Script global */ function requestToExternal( request ) { // Ensure that React will be aliased to preact/compat by preventing externalization. diff --git a/projects/packages/videopress/changelog/update-jsdoc-comments-for-wp-coding-standards b/projects/packages/videopress/changelog/update-jsdoc-comments-for-wp-coding-standards new file mode 100644 index 0000000000000..0e655b2b8b7a3 --- /dev/null +++ b/projects/packages/videopress/changelog/update-jsdoc-comments-for-wp-coding-standards @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Reformat jsdoc comments. No change to meaning or functionality. + + diff --git a/projects/packages/videopress/src/client/admin/components/clipboard-button-input/index.tsx b/projects/packages/videopress/src/client/admin/components/clipboard-button-input/index.tsx index 40816b7886905..9eaf2a927b95c 100644 --- a/projects/packages/videopress/src/client/admin/components/clipboard-button-input/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/clipboard-button-input/index.tsx @@ -16,7 +16,7 @@ import type React from 'react'; * ClipboardButtionInput component * * @param {ClipboardButtonInput} props - Component props. - * @returns {React.ReactNode} - ClipboardButtonInput react component. + * @return {React.ReactNode} - ClipboardButtonInput react component. */ const ClipboardButtonInput: React.FC< ClipboardButtonInputProps > = ( { text, diff --git a/projects/packages/videopress/src/client/admin/components/global-notice/index.tsx b/projects/packages/videopress/src/client/admin/components/global-notice/index.tsx index 48962e1fbcd21..b73a161ff25ea 100644 --- a/projects/packages/videopress/src/client/admin/components/global-notice/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/global-notice/index.tsx @@ -47,14 +47,14 @@ const getIconByLevel = ( level: NoticeStatusProp ) => { /** * VideoPress Logo component * - * @param {object} props - Component props - * @param {NoticeStatusProp} props.status - Notice status severity - * @param {boolean} props.isDismissible - Whether the notice is dismissible - * @param {string} props.className - Additional class name - * @param {Function} props.onRemove - Callback when the notice is removed - * @param {React.ReactNode} props.children - Notice content - * @param {Array} props.actions - Notice actions - * @returns {React.ReactElement} Component template + * @param {object} props - Component props + * @param {NoticeStatusProp} props.status - Notice status severity + * @param {boolean} props.isDismissible - Whether the notice is dismissible + * @param {string} props.className - Additional class name + * @param {Function} props.onRemove - Callback when the notice is removed + * @param {React.ReactNode} props.children - Notice content + * @param {Array} props.actions - Notice actions + * @return {React.ReactElement} Component template */ export default function GlobalNotice( { status = 'error', diff --git a/projects/packages/videopress/src/client/admin/components/input/index.tsx b/projects/packages/videopress/src/client/admin/components/input/index.tsx index b52134162226d..9fefc055d8b4c 100644 --- a/projects/packages/videopress/src/client/admin/components/input/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/input/index.tsx @@ -89,7 +89,7 @@ const InputWrapper = ( { * Input component * * @param {InputProps} props - Component props. - * @returns {React.ReactNode} - Input react component. + * @return {React.ReactNode} - Input react component. */ export const Input = ( { name, @@ -120,7 +120,7 @@ export const Input = ( { * Search Input component * * @param {InputProps} props - Component props. - * @returns {React.ReactNode} - Input react component. + * @return {React.ReactNode} - Input react component. */ export const SearchInput = ( { placeholder = __( 'Search your library', 'jetpack-videopress-pkg' ), diff --git a/projects/packages/videopress/src/client/admin/components/pagination/index.tsx b/projects/packages/videopress/src/client/admin/components/pagination/index.tsx index b35cc5ee1fa47..e4e74173dc8c6 100644 --- a/projects/packages/videopress/src/client/admin/components/pagination/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/pagination/index.tsx @@ -33,7 +33,7 @@ const Ellipsis = () => ( * Pagination component * * @param {PaginationProps} props - Component props. - * @returns {React.ReactNode} - Pagination react component. + * @return {React.ReactNode} - Pagination react component. */ const Pagination: React.FC< PaginationProps > = ( { className, diff --git a/projects/packages/videopress/src/client/admin/components/publish-first-video-popover/index.tsx b/projects/packages/videopress/src/client/admin/components/publish-first-video-popover/index.tsx index 3fde0068f123a..f53ba1eac829a 100644 --- a/projects/packages/videopress/src/client/admin/components/publish-first-video-popover/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/publish-first-video-popover/index.tsx @@ -22,7 +22,7 @@ import type React from 'react'; * Publish First Video Popover component * * @param {PublishFirstVideoPopoverProps} props - Component props. - * @returns {React.ReactNode} - PublishFirstVideoPopover react component. + * @return {React.ReactNode} - PublishFirstVideoPopover react component. */ const PublishFirstVideoPopover = ( { id, diff --git a/projects/packages/videopress/src/client/admin/components/site-settings-section/index.tsx b/projects/packages/videopress/src/client/admin/components/site-settings-section/index.tsx index 2e67f771a9f7c..636f31e52e7db 100644 --- a/projects/packages/videopress/src/client/admin/components/site-settings-section/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/site-settings-section/index.tsx @@ -20,7 +20,7 @@ import type React from 'react'; * VideoPress SettingsSection component * * @param {SiteSettingsSectionProps} props - Component props. - * @returns {React.ReactElement} Component template + * @return {React.ReactElement} Component template */ const SiteSettingsSection: React.FC< SiteSettingsSectionProps > = ( { videoPressVideosPrivateForSite, diff --git a/projects/packages/videopress/src/client/admin/components/video-card/error.tsx b/projects/packages/videopress/src/client/admin/components/video-card/error.tsx index 30b259c82c4eb..f5bd1732c2beb 100644 --- a/projects/packages/videopress/src/client/admin/components/video-card/error.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-card/error.tsx @@ -30,7 +30,7 @@ import type React from 'react'; * Video Card Error component * * @param {VideoCardProps} props - Component props. - * @returns {React.ReactNode} - VideoCardError react component. + * @return {React.ReactNode} - VideoCardError react component. */ export const VideoCardError = ( { title, id }: VideoCardProps ) => { const { dismissErroredVideo } = useDispatch( STORE_ID ); diff --git a/projects/packages/videopress/src/client/admin/components/video-card/index.tsx b/projects/packages/videopress/src/client/admin/components/video-card/index.tsx index 62f31bca64821..6f2d53098ee6c 100644 --- a/projects/packages/videopress/src/client/admin/components/video-card/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-card/index.tsx @@ -60,7 +60,7 @@ const QuickActions = ( { * Video Card component * * @param {VideoCardProps} props - Component props. - * @returns {React.ReactNode} - VideoCard react component. + * @return {React.ReactNode} - VideoCard react component. */ export const VideoCard = ( { title, diff --git a/projects/packages/videopress/src/client/admin/components/video-grid/index.tsx b/projects/packages/videopress/src/client/admin/components/video-grid/index.tsx index 5d3af2d6b1e7c..1f184fe3c2563 100644 --- a/projects/packages/videopress/src/client/admin/components/video-grid/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-grid/index.tsx @@ -15,7 +15,7 @@ import type React from 'react'; * Video Grid component * * @param {VideoGridProps} props - Component props. - * @returns {React.ReactNode} - VideoGrid react component. + * @return {React.ReactNode} - VideoGrid react component. */ const VideoGrid = ( { videos, count = 6, onVideoDetailsClick, loading }: VideoGridProps ) => { const gridVideos = videos.slice( 0, count ); diff --git a/projects/packages/videopress/src/client/admin/components/video-stats-group/index.tsx b/projects/packages/videopress/src/client/admin/components/video-stats-group/index.tsx index a6e9151650019..6bab26428ef01 100644 --- a/projects/packages/videopress/src/client/admin/components/video-stats-group/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-stats-group/index.tsx @@ -26,7 +26,7 @@ const Stats = ( { label, value = 0 }: { label: string; value: number } ) => { * Video Stats Group component * * @param {VideoStatsGroupProps} props - Component props. - * @returns {React.ReactNode} - VideoStatsGroup react component. + * @return {React.ReactNode} - VideoStatsGroup react component. */ const VideoStatsGroup = ( { className, diff --git a/projects/packages/videopress/src/client/admin/components/video-storage-meter/index.tsx b/projects/packages/videopress/src/client/admin/components/video-storage-meter/index.tsx index 7e383239ddc47..2cc98688c61ea 100644 --- a/projects/packages/videopress/src/client/admin/components/video-storage-meter/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-storage-meter/index.tsx @@ -23,7 +23,7 @@ import type React from 'react'; * Video Storage Meter component * * @param {VideoStorageMeterProps} props - Component props. - * @returns {React.ReactNode} - VideoStorageMeter react component. + * @return {React.ReactNode} - VideoStorageMeter react component. */ const VideoStorageMeter: React.FC< VideoStorageMeterProps > = ( { className, diff --git a/projects/packages/videopress/src/client/admin/components/video-thumbnail-selector-modal/index.tsx b/projects/packages/videopress/src/client/admin/components/video-thumbnail-selector-modal/index.tsx index 33f5b13799905..4b3451c08e3a1 100644 --- a/projects/packages/videopress/src/client/admin/components/video-thumbnail-selector-modal/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-thumbnail-selector-modal/index.tsx @@ -18,7 +18,7 @@ import { VideoThumbnailSelectorModalProps } from './types'; * Video Thumbnail Selector component * * @param {VideoThumbnailSelectorModalProps} props - Component props. - * @returns {ReactNode} - VideoThumbnailSelector react component. + * @return {ReactNode} - VideoThumbnailSelector react component. */ const VideoThumbnailSelectorModal = ( { url, diff --git a/projects/packages/videopress/src/client/admin/components/video-thumbnail/index.tsx b/projects/packages/videopress/src/client/admin/components/video-thumbnail/index.tsx index c0f728d216c0b..5fb30edbebfb8 100644 --- a/projects/packages/videopress/src/client/admin/components/video-thumbnail/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-thumbnail/index.tsx @@ -163,7 +163,7 @@ const ErrorThumbnail = ( { isRow } ) => ( * React component to display video thumbnail. * * @param {VideoThumbnailProps} props - Component props. - * @returns {React.ReactNode} - VideoThumbnail react component. + * @return {React.ReactNode} - VideoThumbnail react component. */ const VideoThumbnail = forwardRef< HTMLDivElement, VideoThumbnailProps >( ( diff --git a/projects/packages/videopress/src/client/admin/components/video-upload-area/index.tsx b/projects/packages/videopress/src/client/admin/components/video-upload-area/index.tsx index 006d1f85db45b..6631bba41c3ef 100644 --- a/projects/packages/videopress/src/client/admin/components/video-upload-area/index.tsx +++ b/projects/packages/videopress/src/client/admin/components/video-upload-area/index.tsx @@ -22,7 +22,7 @@ import type { ReactNode } from 'react'; * Video Upload Area component * * @param {VideoUploadAreaProps} props - Component props. - * @returns {ReactNode} - VideoUploadArea react component. + * @return {ReactNode} - VideoUploadArea react component. */ const VideoUploadArea = ( { className, onSelectFiles }: VideoUploadAreaProps ) => { const [ isSm ] = useBreakpointMatch( 'sm' ); diff --git a/projects/packages/videopress/src/client/admin/hooks/use-plan/index.ts b/projects/packages/videopress/src/client/admin/hooks/use-plan/index.ts index 5d6118cb450f6..cb5f785e79f57 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-plan/index.ts +++ b/projects/packages/videopress/src/client/admin/hooks/use-plan/index.ts @@ -43,7 +43,7 @@ export const usePlan = (): usePlanProps => { * Check if the user has a plan that includes VideoPress * * @param {string} productSlug - wpcom prtoduct slug - * @returns {boolean} true if the product is owned by the user + * @return {boolean} true if the product is owned by the user */ function hasPurchase( productSlug ) { return purchasesCamelCase.some( product => product.productSlug === productSlug ); diff --git a/projects/packages/videopress/src/client/admin/hooks/use-playback-token/index.ts b/projects/packages/videopress/src/client/admin/hooks/use-playback-token/index.ts index d569e64781d07..706a3b7376c9a 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-playback-token/index.ts +++ b/projects/packages/videopress/src/client/admin/hooks/use-playback-token/index.ts @@ -12,7 +12,7 @@ import { VideopressSelectors, VideoPressVideo } from '../../types'; * React custom hook to get the the video's playback token. * * @param {VideoPressVideo} video - The VideoPress video - * @returns {object} Playback token + * @return {object} Playback token */ export default function usePlaybackToken( video: VideoPressVideo ) { const videoNeedsPlaybackToken = video.needsPlaybackToken; diff --git a/projects/packages/videopress/src/client/admin/hooks/use-search-params/index.ts b/projects/packages/videopress/src/client/admin/hooks/use-search-params/index.ts index 5b5518ddbf293..346c4b81df69c 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-search-params/index.ts +++ b/projects/packages/videopress/src/client/admin/hooks/use-search-params/index.ts @@ -14,8 +14,8 @@ export const useSearchParams = () => { * Gets a given parameter from the search query. * * @param {SearchParamNameProp} parameterName - The name of the parameter to get from the query string. - * @param {string} defaultValue - The default value to return if the given parameter is not set on the query string. - * @returns {string|null} The value of the parameter if it's set. The defaultValue if the parameter is not set. + * @param {string} defaultValue - The default value to return if the given parameter is not set on the query string. + * @return {string|null} The value of the parameter if it's set. The defaultValue if the parameter is not set. */ const getParam = ( parameterName: SearchParamNameProp, defaultValue: string = null ): string => { return searchParams.has( parameterName ) ? searchParams.get( parameterName ) : defaultValue; @@ -25,7 +25,7 @@ export const useSearchParams = () => { * Sets a given parameter on the search query data, but does not refresh the URL. * * @param {SearchParamNameProp} parameterName - The name of the parameter to set on the query string. - * @param {string} value - The value to be set for the parameter on the query string. + * @param {string} value - The value to be set for the parameter on the query string. */ const setParam = ( parameterName: SearchParamNameProp, value: string = null ) => { searchParams.set( parameterName, value ); diff --git a/projects/packages/videopress/src/client/admin/hooks/use-users/index.js b/projects/packages/videopress/src/client/admin/hooks/use-users/index.js index baf4788e6ed28..40606fdf68040 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-users/index.js +++ b/projects/packages/videopress/src/client/admin/hooks/use-users/index.js @@ -10,7 +10,7 @@ import { STORE_ID } from '../../../state/constants'; /** * React custom hook to get the Users. * - * @returns {object} Users + * @return {object} Users */ export default function useUsers() { // Data diff --git a/projects/packages/videopress/src/client/admin/hooks/use-video/index.ts b/projects/packages/videopress/src/client/admin/hooks/use-video/index.ts index 449c2acf1c9a4..69e66b2bce62a 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-video/index.ts +++ b/projects/packages/videopress/src/client/admin/hooks/use-video/index.ts @@ -12,9 +12,9 @@ import { VideopressSelectors, VideoPressVideo } from '../../types'; /** * React custom hook to get specific video. * - * @param {number} id - Video ID + * @param {number} id - Video ID * @param {boolean} addAtEnd - Whether to add the video to the end of the list if not loaded. - * @returns {object} video + * @return {object} video */ export default function useVideo( id: number | string, addAtEnd = false ) { const dispatch = useDispatch( STORE_ID ); diff --git a/projects/packages/videopress/src/client/admin/hooks/use-videos/index.js b/projects/packages/videopress/src/client/admin/hooks/use-videos/index.js index 7f9e876bff5b4..dbdcdba987d2c 100644 --- a/projects/packages/videopress/src/client/admin/hooks/use-videos/index.js +++ b/projects/packages/videopress/src/client/admin/hooks/use-videos/index.js @@ -10,7 +10,7 @@ import { STORE_ID } from '../../../state/constants'; /** * React custom hook to get the videos. * - * @returns {object} videos + * @return {object} videos */ export default function useVideos() { // Data @@ -86,7 +86,7 @@ export const useLocalVideos = () => { /** * React custom hook to get the videos query. * - * @returns {object} search query information + * @return {object} search query information */ export const useVideosQuery = () => { // Data diff --git a/projects/packages/videopress/src/client/admin/index.js b/projects/packages/videopress/src/client/admin/index.js index b2ec7fe93a4d8..e6d5735744add 100644 --- a/projects/packages/videopress/src/client/admin/index.js +++ b/projects/packages/videopress/src/client/admin/index.js @@ -21,7 +21,7 @@ initStore(); /** * Component to scroll window to top on route change. * - * @returns {null} Null. + * @return {null} Null. */ function ScrollToTop() { const location = useLocation(); diff --git a/projects/packages/videopress/src/client/admin/mock/index.ts b/projects/packages/videopress/src/client/admin/mock/index.ts index 1c4ac9a579d2c..e59c44fb7aa62 100644 --- a/projects/packages/videopress/src/client/admin/mock/index.ts +++ b/projects/packages/videopress/src/client/admin/mock/index.ts @@ -32,7 +32,7 @@ export const postersArray = [ /** * Return a random poster image * - * @returns {string} Random poster image + * @return {string} Random poster image */ export function randomPoster() { const max = postersArray.length - 1; diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx index 917316140d045..a4ec01bab7afd 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/connect-banner.tsx @@ -23,7 +23,7 @@ type ConnectBannerProps = { * Connect Banner component * * @param {ConnectBannerProps} props - component props - * @returns {React.ReactElement} Connect banner component. + * @return {React.ReactElement} Connect banner component. */ export default function ConnectBanner( { onConnect, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/index.tsx index 4b85e54f0dc57..e6501db60bd1b 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/banner/index.tsx @@ -20,11 +20,11 @@ export type BlockBannerProps = { /** * React component to render a banner above a block. * - * @param {BlockBannerProps} props - Component props. - * @param {React.ReactNode} props.action - Banner action button. - * @param {React.ReactNode} props.children - Banner content. - * @param {React.ReactNode} props.icon - Banner icon. - * @returns {React.ReactElement } Banner component. + * @param {BlockBannerProps} props - Component props. + * @param {React.ReactNode} props.action - Banner action button. + * @param {React.ReactNode} props.children - Banner content. + * @param {React.ReactNode} props.icon - Banner icon. + * @return {React.ReactElement } Banner component. */ export default function BlockBanner( { icon = warning, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.native.js index 720722476f09f..1942e26468ef4 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.native.js @@ -12,10 +12,10 @@ import { Icon, chevronRight } from '@wordpress/icons'; /** * React component that renders the playback bar color settings panel. * - * @param {object} props - Component properties. - * @param {object} props.attributes - Block attributes. + * @param {object} props - Component properties. + * @param {object} props.attributes - Block attributes. * @param {Function} props.setAttributes - Function to set block attributes. - * @returns {import('react').ReactElement} - Playback bar color settings panel. + * @return {import('react').ReactElement} - Playback bar color settings panel. */ export default function ColorPanel( { attributes, setAttributes } ) { const [ showSubSheet, setShowSubSheet ] = useState( false ); diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.tsx index e51ab5fbfc076..3f7e6474e8fb7 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/color-panel/index.tsx @@ -26,7 +26,7 @@ import type React from 'react'; * Sidebar Control component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} Component template + * @return {React.ReactElement} Component template */ export default function ColorPanel( { clientId, attributes, setAttributes }: VideoControlProps ) { const { useAverageColor, seekbarColor, seekbarLoadingColor, seekbarPlayedColor } = attributes; diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.native.js index 41784a9f423c9..2d68c58936ee0 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.native.js @@ -11,11 +11,11 @@ import VideoNotOwnedWarning from '../video-not-owned-warning'; /** * React component that renders the details settings panel. * - * @param {object} props - Component properties. - * @param {object} props.attributes - Block attributes. - * @param {Function} props.setAttributes - Function to set attributes. + * @param {object} props - Component properties. + * @param {object} props.attributes - Block attributes. + * @param {Function} props.setAttributes - Function to set attributes. * @param {Function} props.videoBelongToSite - Determines if the video belongs to the current site. - * @returns {import('react').ReactElement} - Details panel component. + * @return {import('react').ReactElement} - Details panel component. */ export default function DetailsPanel( { attributes, setAttributes, videoBelongToSite } ) { const { title, description } = attributes; diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx index 9b9fd933cd0aa..52c38b2fcb02b 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/index.tsx @@ -29,7 +29,7 @@ const CHARACTERS_PER_LINE = 31; * React component that renders a Video details control * * @param {DetailsPanelProps} props - Component properties. - * @returns {React.ReactElement} Details panel component. + * @return {React.ReactElement} Details panel component. */ export default function DetailsPanel( { filename, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/learn-how-notice/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/learn-how-notice/index.tsx index c36969161ab69..b8cbf19218d3b 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/learn-how-notice/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/details-panel/learn-how-notice/index.tsx @@ -17,7 +17,7 @@ type LearnHowModalProps = { * React component that renders the Learn How modal * * @param {LearnHowModalProps} props - Component properties. - * @returns {object} Notice component + * @return {object} Notice component */ export default function LearnHowModal( { isOpen, onClose }: LearnHowModalProps ) { if ( ! isOpen ) { diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.native.js index cdb8ac2d2099b..bd8f632905fda 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.native.js @@ -11,10 +11,10 @@ import { Text } from 'react-native'; /** * Sidebar Control component. * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. * @param {Function} props.setAttributes - Function to set attributes. - * @returns {import('react').ReactElement} - Playback block sidebar panel + * @return {import('react').ReactElement} - Playback block sidebar panel */ export default function PlaybackPanel( { attributes, setAttributes } ) { const [ showSubSheet, setShowSubSheet ] = useState( false ); diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.tsx index c7c7311f0afd1..b2636a4fd1f1c 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/playback-panel/index.tsx @@ -18,7 +18,7 @@ import type React from 'react'; * Sidebar Control component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} Playback block sidebar panel + * @return {React.ReactElement} Playback block sidebar panel */ export default function PlaybackPanel( { attributes, setAttributes }: VideoControlProps ) { const { autoplay, loop, muted, controls, playsinline, preload, posterData } = attributes; diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.native.js index 37b2a756f90ac..753f817b08886 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.native.js @@ -27,10 +27,10 @@ const IS_ANDROID = Platform.isAndroid; /** * VideoPlayer react component * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. * @param {boolean} props.isSelected - Whether the block is selected. - * @returns {import('react').ReactElement} - React component. + * @return {import('react').ReactElement} - React component. */ export default function Player( { isSelected, attributes } ) { const { diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.tsx index fac351b80e6d3..c60e8eba1c1f2 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/player/index.tsx @@ -42,8 +42,8 @@ if ( window?.videoPressEditorState?.playerBridgeUrl ) { /** * VideoPlayer react component * - * @param {PlayerProps} props - Component props. - * @returns {React.ReactElement} Playback block sidebar panel + * @param {PlayerProps} props - Component props. + * @return {React.ReactElement} Playback block sidebar panel */ export default function Player( { showCaption, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-image-block-control/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-image-block-control/index.tsx index c7a1175761521..2b4185b1c7d43 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-image-block-control/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-image-block-control/index.tsx @@ -23,7 +23,7 @@ import type React from 'react'; * Simple component that renders info about video poster. * * @param {VideoPosterCardProps} props - Component props. - * @returns {React.ReactElement} VideoPosterCard component + * @return {React.ReactElement} VideoPosterCard component */ export function VideoPosterCard( { poster, className }: VideoPosterCardProps ): React.ReactElement { const notes = createInterpolateElement( @@ -53,7 +53,7 @@ export function VideoPosterCard( { poster, className }: VideoPosterCardProps ): * Poster image control react component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} PosterImageBlockControl block control + * @return {React.ReactElement} PosterImageBlockControl block control */ export default function PosterImageBlockControl( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.native.js index e5277b7599410..73a5fd5cec9a3 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.native.js @@ -4,7 +4,7 @@ export const isVideoFramePosterEnabled = () => /** * Sidebar Control component. * - * @returns {import('react').ReactElement} Component template + * @return {import('react').ReactElement} Component template */ export default function PosterPanel() { return null; diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.tsx index 2a8cfc1519936..86c99a145f4dd 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/poster-panel/index.tsx @@ -92,7 +92,7 @@ if ( window?.videoPressEditorState?.playerBridgeUrl ) { * Sidebar Control component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} Component template + * @return {React.ReactElement} Component template */ export function PosterDropdown( { clientId, @@ -207,7 +207,7 @@ export function PosterDropdown( { * given the iframe's ref. * * @param {React.MutableRefObject< HTMLDivElement >} iFrameRef - iframe ref - * @returns {Window | null} Window object of the iframe + * @return {Window | null} Window object of the iframe */ export const getIframeWindowFromRef = ( iFrameRef: React.MutableRefObject< HTMLDivElement > @@ -230,7 +230,7 @@ type PosterFramePickerProps = { * React component to pick a frame from the VideoPress video * * @param {PosterFramePickerProps} props - Component properties - * @returns { React.ReactElement} React component + * @return { React.ReactElement} React component */ function VideoFramePicker( { guid, @@ -326,7 +326,7 @@ type VideoHoverPreviewControlProps = { * React component to select the video preview options when the user hovers the video * * @param {VideoHoverPreviewControlProps} props - Component properties - * @returns { React.ReactElement} React component + * @return { React.ReactElement} React component */ export function VideoHoverPreviewControl( { previewOnHover = false, @@ -432,7 +432,7 @@ export function VideoHoverPreviewControl( { * Sidebar Control component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} Component template + * @return {React.ReactElement} Component template */ export default function PosterPanel( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.native.js index 5110cf08e69e6..30b516df9438b 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.native.js @@ -14,12 +14,12 @@ import PrivacyAndRatingSettings from './privacy-and-rating-settings'; /** * React component that renders the main privacy and ratings panel. * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. - * @param {Function} props.setAttributes - Function to set block attributes. - * @param {boolean} props.privateEnabledForSite - True if the site's privacy is set to Private. - * @param {boolean} props.videoBelongToSite - Determines if the video belongs to the current site. - * @returns {import('react').ReactElement} - Panel to contain privacy and ratings settings. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. + * @param {Function} props.setAttributes - Function to set block attributes. + * @param {boolean} props.privateEnabledForSite - True if the site's privacy is set to Private. + * @param {boolean} props.videoBelongToSite - Determines if the video belongs to the current site. + * @return {import('react').ReactElement} - Panel to contain privacy and ratings settings. */ export default function PrivacyAndRatingPanel( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.tsx index 140e1d62cafe0..005b2967b61f2 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/index.tsx @@ -12,7 +12,7 @@ import type React from 'react'; * React component that renders the main privacy and ratings panel. * * @param {PrivacyAndRatingPanelProps} props - Component props. - * @returns {React.ReactElement} Panel to contain privacy and ratings settings. + * @return {React.ReactElement} Panel to contain privacy and ratings settings. */ export default function PrivacyAndRatingPanel( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.native.js index 3f615320ae9e2..35af313cf5f7d 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.native.js @@ -20,12 +20,12 @@ import VideoNotOwnedWarning from '../video-not-owned-warning'; /** * React component that renders the settings within the privacy and ratings panel. * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. - * @param {Function} props.setAttributes - Function to set block attributes. - * @param {boolean} props.privateEnabledForSite - True if the site's privacy is set to Private. - * @param {boolean} props.videoBelongToSite - Determines if the video belongs to the current site. - * @returns {import('react').ReactElement} - Settings to change video's privacy and ratings. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. + * @param {Function} props.setAttributes - Function to set block attributes. + * @param {boolean} props.privateEnabledForSite - True if the site's privacy is set to Private. + * @param {boolean} props.videoBelongToSite - Determines if the video belongs to the current site. + * @return {import('react').ReactElement} - Settings to change video's privacy and ratings. */ export default function PrivacyAndRatingSettings( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx index 4137b507ddb3e..1bff6857e5e32 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/privacy-and-rating-panel/privacy-and-rating-settings.tsx @@ -25,7 +25,7 @@ import type React from 'react'; * React component that renders the settings within the privacy and ratings panel. * * @param {PrivacyAndRatingPanelProps} props - Component props. - * @returns {React.ReactElement} Settings to change video's privacy and ratings. + * @return {React.ReactElement} Settings to change video's privacy and ratings. */ export default function PrivacyAndRatingSettings( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/index.tsx index 834922bc216f8..8496f188cb176 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/index.tsx @@ -29,7 +29,7 @@ const debug = debugFactory( 'videopress:tracks:tracks-control' ); * Track Item component. * * @param {TrackItemProps} props - Component props. - * @returns {React.ReactElement} TrackItem react component + * @return {React.ReactElement} TrackItem react component */ function TrackItem( { track, guid, onDelete }: TrackItemProps ): React.ReactElement { const [ isDeleting, setIsDeleting ] = useState( false ); @@ -64,7 +64,7 @@ function TrackItem( { track, guid, onDelete }: TrackItemProps ): React.ReactElem * Track List React component. * * @param {TrackListProps} props - Component props. - * @returns {React.ReactElement} TracksControl block control + * @return {React.ReactElement} TracksControl block control */ function TrackList( { tracks, guid, onTrackListUpdate }: TrackListProps ): React.ReactElement { if ( ! tracks?.length ) { @@ -111,7 +111,7 @@ function TrackList( { tracks, guid, onTrackListUpdate }: TrackListProps ): React * Tracks control react component. * * @param {VideoControlProps} props - Component props. - * @returns {React.ReactElement} TracksControl block control + * @return {React.ReactElement} TracksControl block control */ export default function TracksControl( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/track-form.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/track-form.tsx index 63390b6f8d6a4..c66493e795de6 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/track-form.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/tracks-control/track-form.tsx @@ -40,7 +40,7 @@ const debug = debugFactory( 'videopress:tracks:track-form' ); * Track From component * * @param {TrackFormProps} props - Component props. - * @returns {React.ReactElement} Track form react component. + * @return {React.ReactElement} Track form react component. */ export default function TrackForm( { onCancel, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/video-not-owned-warning/index.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/video-not-owned-warning/index.native.js index 2f70bf4d4a331..e1eb3b842a824 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/video-not-owned-warning/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/video-not-owned-warning/index.native.js @@ -16,7 +16,7 @@ import styles from './styles.scss'; /** * React component that renders a warning message about the video not owned by the site. * - * @returns {import('react').ReactElement} - Details panel component. + * @return {import('react').ReactElement} - Details panel component. */ export default function VideoNotOwnedWarning() { const msgStyle = usePreferredColorSchemeStyle( diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js b/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js index c32b241f3699b..e7c2b99039535 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/components/videopress-uploader/index.js @@ -102,7 +102,7 @@ const VideoPressUploader = ( { * Handler to add a video via an URL. * * @param {string} videoSource - URL of the video to attach - * @param {string} id - Attachment ID if available + * @param {string} id - Attachment ID if available */ function onSelectURL( videoSource, id ) { // If the video source is a VideoPress URL, we can use it directly. @@ -161,7 +161,7 @@ const VideoPressUploader = ( { * Uploading file handler. * * @param {File} media - media file to upload - * @returns {void} + * @return {void} */ function onSelectVideo( media ) { /* diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/deprecated/index.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/deprecated/index.tsx index dfd01fd77f1d6..53c89dd04e73d 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/deprecated/index.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/deprecated/index.tsx @@ -21,9 +21,9 @@ type videoBlockSaveProps = { /** * VideoPress block save function * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. - * @returns {object} - React component. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. + * @return {object} - React component. */ function save( { attributes }: videoBlockSaveProps ): React.ReactNode { const { diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.native.js b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.native.js index 52b53d303cc53..8d61239a476db 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.native.js +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.native.js @@ -35,14 +35,14 @@ import style from './style.scss'; /** * VideoPress block Edit react components * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. - * @param {object} props.clientId - Block client Id. - * @param {Function} props.setAttributes - Function to set block attributes. - * @param {boolean} props.isSelected - Whether block is selected. - * @param {Function} props.onFocus - Callback to notify when block should gain focus. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. + * @param {object} props.clientId - Block client Id. + * @param {Function} props.setAttributes - Function to set block attributes. + * @param {boolean} props.isSelected - Whether block is selected. + * @param {Function} props.onFocus - Callback to notify when block should gain focus. * @param {Function} props.insertBlocksAfter - Function to insert a new block after the current block. - * @returns {import('react').ReactNode} - React component. + * @return {import('react').ReactNode} - React component. */ export default function VideoPressEdit( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx index c80c2cde45a0c..a9a3621cb85cd 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/edit.tsx @@ -96,12 +96,12 @@ export const PlaceholderWrapper = withNotices( function ( { /** * VideoPress block Edit react components * - * @param {object} props - Component props. - * @param {object} props.attributes - Block attributes. + * @param {object} props - Component props. + * @param {object} props.attributes - Block attributes. * @param {Function} props.setAttributes - Function to set block attributes. - * @param {boolean} props.isSelected - Whether the block is selected. - * @param {string} props.clientId - Block client ID. - * @returns {React.ReactNode} - React component. + * @param {boolean} props.isSelected - Whether the block is selected. + * @param {string} props.clientId - Block client ID. + * @return {React.ReactNode} - React component. */ export default function VideoPressEdit( { attributes, diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/index.native.ts b/projects/packages/videopress/src/client/block-editor/blocks/video/index.native.ts index 0d8229e00b595..6e534055e14da 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/index.native.ts +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/index.native.ts @@ -18,7 +18,7 @@ export const { name, title, description, attributes } = metadata; /** * Registers the VideoPress block if the availability requirements are met. * - * @returns {object|boolean} Either false if the block is not available, or the results of `registerBlockType` + * @return {object|boolean} Either false if the block is not available, or the results of `registerBlockType` */ export default function registerVideoPressBlock() { const { available } = getJetpackExtensionAvailability( name ); diff --git a/projects/packages/videopress/src/client/block-editor/blocks/video/view.ts b/projects/packages/videopress/src/client/block-editor/blocks/video/view.ts index d3f0c87e757da..d2cdfd09d9517 100644 --- a/projects/packages/videopress/src/client/block-editor/blocks/video/view.ts +++ b/projects/packages/videopress/src/client/block-editor/blocks/video/view.ts @@ -11,7 +11,7 @@ import './style.scss'; /** * Preview on Hover effect for VideoPress videos. * - * @returns {void} + * @return {void} */ function previewOnHoverEffect(): void { /* diff --git a/projects/packages/videopress/src/client/block-editor/extend/core-video/index.js b/projects/packages/videopress/src/client/block-editor/extend/core-video/index.js index dcc2c84a842e1..d510b59832bac 100644 --- a/projects/packages/videopress/src/client/block-editor/extend/core-video/index.js +++ b/projects/packages/videopress/src/client/block-editor/extend/core-video/index.js @@ -60,7 +60,7 @@ addFilter( * * @param {object} attributes - core/video block attributes * @param {object} defaultAttributes - default core/video block attributes - * @returns {object} The new attributes + * @return {object} The new attributes */ function getVideoPressVideoBlockAttributes( attributes, defaultAttributes ) { const attrs = attributes || defaultAttributes; @@ -84,7 +84,7 @@ function getVideoPressVideoBlockAttributes( attributes, defaultAttributes ) { * * @param {object} props - component props * @param {object} props.BlockListBlock - BlockListBlock - * @returns {React.ReactNode} BlockListBlock if the block is valid, or the recovery warning. + * @return {React.ReactNode} BlockListBlock if the block is valid, or the recovery warning. */ function JetpackCoreVideoDeprecation( { BlockListBlock, ...props } ) { const { block } = props; diff --git a/projects/packages/videopress/src/client/block-editor/extensions/index.ts b/projects/packages/videopress/src/client/block-editor/extensions/index.ts index 5f4f976787aea..5f930b6c74448 100644 --- a/projects/packages/videopress/src/client/block-editor/extensions/index.ts +++ b/projects/packages/videopress/src/client/block-editor/extensions/index.ts @@ -17,7 +17,7 @@ debug( 'Extensions: %o', extensions ); * Helper function to check if a given extension is enabled. * * @param {string} extension - The extension to check. - * @returns {boolean} - Whether the extension is enabled. + * @return {boolean} - Whether the extension is enabled. */ export function isExtensionEnabled( extension: string ) { const vpExtension = extensions.find( ext => ext.name === extension ); @@ -28,7 +28,7 @@ export function isExtensionEnabled( extension: string ) { * Helper function to check if the given extension is beta. * * @param {string} extension - The extension to check. - * @returns {boolean} - Whether the extension is beta. + * @return {boolean} - Whether the extension is beta. */ export function isBetaExtension( extension: string ) { const vpExtension = extensions.find( ext => ext.name === extension ); diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.native.js b/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.native.js index fd833d0e9dcd5..13912820bc75b 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.native.js +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.native.js @@ -63,9 +63,9 @@ const invalidateEmbedResolutionFields = [ * React hook to keep the data in-sync * between the media item and the block attributes. * - * @param {object} attributes - Block attributes. - * @param {Function} setAttributes - Block attributes setter. - * @returns {object} - Hook API object. + * @param {object} attributes - Block attributes. + * @param {Function} setAttributes - Block attributes setter. + * @return {object} - Hook API object. */ export function useSyncMedia( attributes, setAttributes ) { const { id, guid, isPrivate } = attributes; diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.ts b/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.ts index 1b5c16012c758..1376a491118be 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.ts +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-sync-media/index.ts @@ -79,9 +79,9 @@ const invalidateEmbedResolutionFields = [ * Re-arrange the tracks to match the block attribute format. * Also, check if the tracks is out of sync with the media item. * - * @param {VideoDataProps} videoData - Video data, provided by server. + * @param {VideoDataProps} videoData - Video data, provided by server. * @param {VideoBlockAttributes} attributes - Block attributes. - * @returns {VideoBlockAttributes} Video block attributes. + * @return {VideoBlockAttributes} Video block attributes. */ function arrangeTracksAttributes( videoData: VideoDataProps, @@ -143,9 +143,9 @@ function arrangeTracksAttributes( * React hook to keep the data in-sync * between the media item and the block attributes. * - * @param {object} attributes - Block attributes. + * @param {object} attributes - Block attributes. * @param {Function} setAttributes - Block attributes setter. - * @returns {UseSyncMedia} Hook API object. + * @return {UseSyncMedia} Hook API object. */ export function useSyncMedia( attributes: VideoBlockAttributes, diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-video-data-update/index.ts b/projects/packages/videopress/src/client/block-editor/hooks/use-video-data-update/index.ts index c011226792aa2..cac8e968e7427 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-video-data-update/index.ts +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-video-data-update/index.ts @@ -12,7 +12,7 @@ import { VideoId } from '../../blocks/video/types'; * Hook to update the media data by hitting the VideoPress API. * * @param {VideoId} id - Media ID. - * @returns {Function} Update Promise handler. + * @return {Function} Update Promise handler. */ export default function useMediaDataUpdate( id: VideoId ) { const updateMediaItem = data => { diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-video-data/index.ts b/projects/packages/videopress/src/client/block-editor/hooks/use-video-data/index.ts index 12b75a487e8b0..dd2729312b798 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-video-data/index.ts +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-video-data/index.ts @@ -25,7 +25,7 @@ const isUserConnected = getIsUserConnected(); * React hook to fetch the video data from the media library. * * @param {UseVideoDataArgumentsProps} args - Hook arguments object - * @returns {UseVideoDataProps} Hook API object. + * @return {UseVideoDataProps} Hook API object. */ export default function useVideoData( { id, diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-video-player/index.ts b/projects/packages/videopress/src/client/block-editor/hooks/use-video-player/index.ts index 968e551dca5d3..867060303a33e 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-video-player/index.ts +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-video-player/index.ts @@ -17,7 +17,7 @@ const debug = debugFactory( 'videopress:use-video-player' ); * given the iframe's ref. * * @param {React.MutableRefObject< HTMLDivElement >} iFrameRef - iframe ref - * @returns {Window | null} Window object of the iframe + * @return {Window | null} Window object of the iframe */ export const getIframeWindowFromRef = ( iFrameRef: React.MutableRefObject< HTMLDivElement > @@ -31,10 +31,10 @@ export const getIframeWindowFromRef = ( /** * Custom hook to set the player ready to use: * - * @param {React.MutableRefObject< HTMLDivElement >} iFrameRef - useRef of the sandbox wrapper. - * @param {boolean} isRequestingPreview - Whether the preview is being requested. - * @param {UseVideoPlayerOptions} options - Options object. - * @returns {UseVideoPlayer} playerIsReady and playerState + * @param {React.MutableRefObject< HTMLDivElement >} iFrameRef - useRef of the sandbox wrapper. + * @param {boolean} isRequestingPreview - Whether the preview is being requested. + * @param {UseVideoPlayerOptions} options - Options object. + * @return {UseVideoPlayer} playerIsReady and playerState */ const useVideoPlayer = ( iFrameRef: React.MutableRefObject< HTMLDivElement >, diff --git a/projects/packages/videopress/src/client/block-editor/hooks/use-video-poster-data/index.ts b/projects/packages/videopress/src/client/block-editor/hooks/use-video-poster-data/index.ts index 5240d8b140045..e4b835dcc0a63 100644 --- a/projects/packages/videopress/src/client/block-editor/hooks/use-video-poster-data/index.ts +++ b/projects/packages/videopress/src/client/block-editor/hooks/use-video-poster-data/index.ts @@ -23,7 +23,7 @@ const debug = debugFactory( 'videopress:video:use-sync-media' ); * React hook to handle video poster generation based on block attributes changes and post save events. * * @param {VideoBlockAttributes} attributes - Block attributes. - * @returns {boolean} isGeneratingPoster - Whether the poster image is being generated. + * @return {boolean} isGeneratingPoster - Whether the poster image is being generated. */ export function useVideoPosterData( attributes: VideoBlockAttributes ) { // Detect when the post has been just saved. diff --git a/projects/packages/videopress/src/client/block-editor/utils/add-token-iframe-source.js b/projects/packages/videopress/src/client/block-editor/utils/add-token-iframe-source.js index 596cc5b38a5bd..ccecbbf5ea1f6 100644 --- a/projects/packages/videopress/src/client/block-editor/utils/add-token-iframe-source.js +++ b/projects/packages/videopress/src/client/block-editor/utils/add-token-iframe-source.js @@ -1,9 +1,9 @@ /** * Adds token via the query param `metadata_token` into VideoPress iframe's source. * - * @param {string} html - VideoPress iframe HTML. + * @param {string} html - VideoPress iframe HTML. * @param {string} token - Token. - * @returns {string} - VideoPres iframe HTML with source updated with token. + * @return {string} - VideoPres iframe HTML with source updated with token. */ export default function addTokenIntoIframeSource( html, token ) { if ( ! html || ! token ) { diff --git a/projects/packages/videopress/src/client/block-editor/utils/editor-image-url.ts b/projects/packages/videopress/src/client/block-editor/utils/editor-image-url.ts index d93ade4a2ba9b..ad639eaf935ae 100644 --- a/projects/packages/videopress/src/client/block-editor/utils/editor-image-url.ts +++ b/projects/packages/videopress/src/client/block-editor/utils/editor-image-url.ts @@ -9,7 +9,7 @@ const { imagesURLBase = '' } = window?.videoPressEditorState || {}; * Helper function to get the correct image URL. * * @param {string} image - The imported image. - * @returns {string} - The image URL. + * @return {string} - The image URL. */ export default function editorImageURL( image: string ): string { // Get the file name from the image path, including build hash. diff --git a/projects/packages/videopress/src/client/block-editor/utils/is-local-file.native.js b/projects/packages/videopress/src/client/block-editor/utils/is-local-file.native.js index 891f16d60b925..f2adabb730d72 100644 --- a/projects/packages/videopress/src/client/block-editor/utils/is-local-file.native.js +++ b/projects/packages/videopress/src/client/block-editor/utils/is-local-file.native.js @@ -6,8 +6,8 @@ import { isURL, getProtocol } from '@wordpress/url'; /** * Determines if a URL points to a local file. * - * @param {string} url - URL to check. - * @returns {boolean} - True if the URL points to a local file. + * @param {string} url - URL to check. + * @return {boolean} - True if the URL points to a local file. */ export default function isLocalFile( url ) { return !! url && isURL( url ) && getProtocol( url ) === 'file:'; diff --git a/projects/packages/videopress/src/client/block-editor/utils/video.ts b/projects/packages/videopress/src/client/block-editor/utils/video.ts index 200c09259e628..c7e95ed9ffe3b 100644 --- a/projects/packages/videopress/src/client/block-editor/utils/video.ts +++ b/projects/packages/videopress/src/client/block-editor/utils/video.ts @@ -3,7 +3,7 @@ * based on its mime type. * * @param {File} file - File to check. - * @returns {boolean} Whether the file is a video. + * @return {boolean} Whether the file is a video. */ export function isVideoFile( file: File ): boolean { if ( ! file?.type ) { @@ -17,7 +17,7 @@ export function isVideoFile( file: File ): boolean { * Filter an array of files to only include video files. * * @param {File[]} files - Array of files to filter. - * @returns {File[]} Array of video files. + * @return {File[]} Array of video files. */ export function filterVideoFiles( files: File[] ): File[] { return files.filter( isVideoFile ); diff --git a/projects/packages/videopress/src/client/components/timestamp-control/index.tsx b/projects/packages/videopress/src/client/components/timestamp-control/index.tsx index fc6bf56bdec40..d9b6b077dd5c2 100644 --- a/projects/packages/videopress/src/client/components/timestamp-control/index.tsx +++ b/projects/packages/videopress/src/client/components/timestamp-control/index.tsx @@ -26,7 +26,7 @@ import type React from 'react'; * Fallback implementation of useBaseControlProps. * * @param {object} props - The component props. - * @returns {object} - The computed control props. + * @return {object} - The computed control props. */ function useBaseControlPropsFallback( props: Record< string, unknown > ): { baseControlProps: Record< string, unknown >; @@ -112,10 +112,10 @@ type TimeDataProps = { /** * Return the time data based on the given value. * - * @param {number} value - The value to be converted. + * @param {number} value - The value to be converted. * @param {DecimalPlacesProp} decimalPlaces - The number of decimal places to be used. - * @param {number} max - The maximum value. - * @returns {TimeDataProps} The time data. + * @param {number} max - The maximum value. + * @return {TimeDataProps} The time data. */ function getTimeDataByValue( value: number, @@ -287,7 +287,7 @@ export const TimestampInput = ( { * TimestampControl component * * @param {TimestampControlProps} props - Component props. - * @returns {React.ReactElement} TimestampControl react component. + * @return {React.ReactElement} TimestampControl react component. */ export const TimestampControl = ( props: TimestampControlProps ): React.ReactElement => { const { diff --git a/projects/packages/videopress/src/client/hooks/use-resumable-uploader/index.ts b/projects/packages/videopress/src/client/hooks/use-resumable-uploader/index.ts index 05f271a45805e..335c145509cae 100644 --- a/projects/packages/videopress/src/client/hooks/use-resumable-uploader/index.ts +++ b/projects/packages/videopress/src/client/hooks/use-resumable-uploader/index.ts @@ -53,7 +53,7 @@ const useResumableUploader = ( { onProgress, onSuccess, onError } ): UseResumabl * Upload a file * * @param {File} file - the file to upload - * @returns {*} ??? + * @return {*} ??? */ async function uploadHandler( file: File ) { const tokenData = await getMediaToken( 'upload-jwt' ); diff --git a/projects/packages/videopress/src/client/lib/connection/index.ts b/projects/packages/videopress/src/client/lib/connection/index.ts index 42109bfe9c9b7..a5565eec03d72 100644 --- a/projects/packages/videopress/src/client/lib/connection/index.ts +++ b/projects/packages/videopress/src/client/lib/connection/index.ts @@ -17,7 +17,7 @@ const debug = debugFactory( 'videopress:connection' ); * both exposed by the connection class-block-editor-extension.php. * * @see {@link ../class-block-editor-extension.php} - * @returns {boolean} True if the user is connected, false otherwise. + * @return {boolean} True if the user is connected, false otherwise. */ export function isUserConnected(): boolean { if ( siteType === 'simple' ) { @@ -37,7 +37,7 @@ export function isUserConnected(): boolean { /** * Check whether the Jetpack VideoPress module is active. * - * @returns {boolean} True if the module is active, false otherwise. + * @return {boolean} True if the module is active, false otherwise. */ export function isVideoPressModuleActive(): boolean { return window?.videoPressEditorState?.isVideoPressModuleActive === '1'; @@ -51,7 +51,7 @@ export function isVideoPressModuleActive(): boolean { * Note: It's possible to have the module active, * but the user not connected. * - * @returns {boolean} True if the feature is active, false otherwise. + * @return {boolean} True if the feature is active, false otherwise. */ export function isVideoPressActive(): boolean { if ( ! isUserConnected() ) { @@ -64,7 +64,7 @@ export function isVideoPressActive(): boolean { /** * Return whether the standalone plugin is active. * - * @returns {boolean} True if the feature is active, false otherwise. + * @return {boolean} True if the feature is active, false otherwise. */ export function isStandaloneActive(): boolean { return window?.videoPressEditorState?.isStandaloneActive === '1'; diff --git a/projects/packages/videopress/src/client/lib/fetch-video-item/index.ts b/projects/packages/videopress/src/client/lib/fetch-video-item/index.ts index f3758a6be8d33..31181b163fdf1 100644 --- a/projects/packages/videopress/src/client/lib/fetch-video-item/index.ts +++ b/projects/packages/videopress/src/client/lib/fetch-video-item/index.ts @@ -25,13 +25,13 @@ const debug = debugFactory( 'videopress:lib:fetch-video-item' ); /** * Fetches the video item from the v1.1/videos endpoint. * - * @param {object} parameters - The function parameters. - * @param {VideoGUID} parameters.guid - The video GUID. - * @param {boolean} parameters.isPrivate - Whether the video is private. - * @param {string} parameters.token - The token to use in the request. - * @param {boolean} parameters.skipRatingControl - Whether to skip the rating control. - * @param {number} parameters.retries - The number of retries. - * @returns {WPCOMRestAPIVideosGetEndpointResponseProps} Props + * @param {object} parameters - The function parameters. + * @param {VideoGUID} parameters.guid - The video GUID. + * @param {boolean} parameters.isPrivate - Whether the video is private. + * @param {string} parameters.token - The token to use in the request. + * @param {boolean} parameters.skipRatingControl - Whether to skip the rating control. + * @param {number} parameters.retries - The number of retries. + * @return {WPCOMRestAPIVideosGetEndpointResponseProps} Props */ export async function fetchVideoItem( { guid, diff --git a/projects/packages/videopress/src/client/lib/get-media-token/index.native.ts b/projects/packages/videopress/src/client/lib/get-media-token/index.native.ts index 8ed8d2f9643eb..e03eb03c5e4ad 100644 --- a/projects/packages/videopress/src/client/lib/get-media-token/index.native.ts +++ b/projects/packages/videopress/src/client/lib/get-media-token/index.native.ts @@ -19,9 +19,9 @@ type Response = { /** * Request media token data hiting WPCOM API. * - * @param {MediaTokenScopeProps} scope - The scope of the token to request. - * @param {GetMediaTokenArgsProps} args - function arguments. - * @returns {MediaTokenProps} Media token data. + * @param {MediaTokenScopeProps} scope - The scope of the token to request. + * @param {GetMediaTokenArgsProps} args - function arguments. + * @return {MediaTokenProps} Media token data. */ const requestMediaToken = function ( scope: MediaTokenScopeProps, @@ -69,9 +69,9 @@ const requestMediaToken = function ( * * NOTE: In the native version, the token is not persisted. * - * @param {MediaTokenScopeProps} scope - The scope of the token to request. - * @param {GetMediaTokenArgsProps} args - function arguments. - * @returns {MediaTokenProps} Media token data. + * @param {MediaTokenScopeProps} scope - The scope of the token to request. + * @param {GetMediaTokenArgsProps} args - function arguments. + * @return {MediaTokenProps} Media token data. */ async function getMediaToken( scope: MediaTokenScopeProps, diff --git a/projects/packages/videopress/src/client/lib/get-media-token/index.ts b/projects/packages/videopress/src/client/lib/get-media-token/index.ts index 02bcdb02a9adb..8a727ee9ef4e1 100644 --- a/projects/packages/videopress/src/client/lib/get-media-token/index.ts +++ b/projects/packages/videopress/src/client/lib/get-media-token/index.ts @@ -26,9 +26,9 @@ const TOKEN_LIFETIME = 1000 * 60 * 60 * 24; // 24 hours /** * Request media token data hiting the admin-ajax endpoint. * - * @param {MediaTokenScopeProps} scope - The scope of the token to request. - * @param {GetMediaTokenArgsProps} args - function arguments. - * @returns {MediaTokenProps} Media token data. + * @param {MediaTokenScopeProps} scope - The scope of the token to request. + * @param {GetMediaTokenArgsProps} args - function arguments. + * @return {MediaTokenProps} Media token data. */ const requestMediaToken = function ( scope: MediaTokenScopeProps, @@ -123,9 +123,9 @@ const requestMediaToken = function ( * from the localStore in case it is still valid, * otherwise request it from the admin-ajax endpoint. * - * @param {MediaTokenScopeProps} scope - The scope of the token to request. - * @param {GetMediaTokenArgsProps} args - function arguments. - * @returns {MediaTokenProps} Media token data. + * @param {MediaTokenScopeProps} scope - The scope of the token to request. + * @param {GetMediaTokenArgsProps} args - function arguments. + * @return {MediaTokenProps} Media token data. */ async function getMediaToken( scope: MediaTokenScopeProps, diff --git a/projects/packages/videopress/src/client/lib/poster/index.ts b/projects/packages/videopress/src/client/lib/poster/index.ts index c0553c1664146..2192264f6f244 100644 --- a/projects/packages/videopress/src/client/lib/poster/index.ts +++ b/projects/packages/videopress/src/client/lib/poster/index.ts @@ -61,12 +61,12 @@ export const hasVideoPosterGenerated = async function ( guid: VideoGUID ): Promi * Polls the API to check if * the video poster image has been generated. * - * @param {VideoGUID} guid - The video guid. - * @param {object} options - Options for the polling. - * @param {number} options.wait - The time to wait between polls, in milliseconds. - * @param {number} options.attemps - The number of times to poll before giving up. - * @param {boolean} options.initialWait - Whether to wait before the first poll. - * @returns {Promise} Whether the poster image has been generated. + * @param {VideoGUID} guid - The video guid. + * @param {object} options - Options for the polling. + * @param {number} options.wait - The time to wait between polls, in milliseconds. + * @param {number} options.attemps - The number of times to poll before giving up. + * @param {boolean} options.initialWait - Whether to wait before the first poll. + * @return {Promise} Whether the poster image has been generated. */ export async function pollGeneratingPosterImage( guid: VideoGUID, diff --git a/projects/packages/videopress/src/client/lib/token-bridge/index.ts b/projects/packages/videopress/src/client/lib/token-bridge/index.ts index 3ad920b0d6967..06d98561b10c6 100644 --- a/projects/packages/videopress/src/client/lib/token-bridge/index.ts +++ b/projects/packages/videopress/src/client/lib/token-bridge/index.ts @@ -32,7 +32,7 @@ type TokenBrigeEventProps = { /** * Quick docReady implementation. - * @returns {Promise} promise. + * @return {Promise} promise. */ function ready(): Promise< void > { return new Promise( function ( resolve ) { @@ -49,7 +49,7 @@ function ready(): Promise< void > { * Check if the guid has an associated subscriptionPlanId. * * @param {VideoGUID} guid - The guid. - * @returns {Promise} promise. + * @return {Promise} promise. */ async function getSubscriberPlanIdIfExists( guid: VideoGUID ): Promise< number > { await ready(); diff --git a/projects/packages/videopress/src/client/lib/url/index.ts b/projects/packages/videopress/src/client/lib/url/index.ts index 26f1972734bb3..3d1951dcbebbd 100644 --- a/projects/packages/videopress/src/client/lib/url/index.ts +++ b/projects/packages/videopress/src/client/lib/url/index.ts @@ -114,7 +114,7 @@ export const pickGUIDFromUrl: ( url: string ) => null | string = url => { * Check if a string is a valid VideoPress GUID. * * @param {string} value - The string to check. - * @returns {boolean | VideoGUID} Video GUID if the string is valid, false otherwise. + * @return {boolean | VideoGUID} Video GUID if the string is valid, false otherwise. */ export function isVideoPressGuid( value: string ): boolean | VideoGUID { const guid = value.match( /^[a-zA-Z\d]{8}$/ ); @@ -134,9 +134,9 @@ type BuildVideoPressURLProps = { * Build a VideoPress URL from a VideoPress GUID or a VideoPress URL. * The function returns an { url, guid } object, or false. * - * @param {string | VideoGUID} value - The VideoPress GUID or URL. + * @param {string | VideoGUID} value - The VideoPress GUID or URL. * @param {VideoBlockAttributes} attributes - The VideoPress URL options. - * @returns {false | string} VideoPress URL if the string is valid, false otherwise. + * @return {false | string} VideoPress URL if the string is valid, false otherwise. */ export function buildVideoPressURL( value: string | VideoGUID, @@ -167,9 +167,9 @@ export const removeFileNameExtension = ( name: string ) => { * Return the VideoPress video URL * based on the privacy of the video. * - * @param {VideoGUID} guid - The VideoPress GUID. - * @param {boolean} isPrivate - Whether the video is private or not. - * @returns {string} VideoPress URL. + * @param {VideoGUID} guid - The VideoPress GUID. + * @param {boolean} isPrivate - Whether the video is private or not. + * @return {string} VideoPress URL. */ export function getVideoUrlBasedOnPrivacy( guid: VideoGUID, isPrivate: boolean ) { if ( isPrivate ) { @@ -183,7 +183,7 @@ export function getVideoUrlBasedOnPrivacy( guid: VideoGUID, isPrivate: boolean ) * Determines if a given URL is a VideoPress URL. * * @param {string} url - The URL to check. - * @returns {boolean} bool True if the URL is a VideoPress URL, false otherwise. + * @return {boolean} bool True if the URL is a VideoPress URL, false otherwise. */ export function isVideoPressUrl( url: string ): boolean { const pattern = @@ -194,8 +194,8 @@ export function isVideoPressUrl( url: string ): boolean { /** * Pick and map VideoPress block attributes from a VideoPress URL. * - * @param {string} url - The VideoPress URL. - * @returns {VideoBlockAttributes} VideoPress block attributes. + * @param {string} url - The VideoPress URL. + * @return {VideoBlockAttributes} VideoPress block attributes. */ export function pickVideoBlockAttributesFromUrl( url: string ): VideoBlockAttributes { let queryParams: URLSearchParams; diff --git a/projects/packages/videopress/src/client/lib/video-tracks/index.ts b/projects/packages/videopress/src/client/lib/video-tracks/index.ts index c932f5befef88..ec2d41fef5435 100644 --- a/projects/packages/videopress/src/client/lib/video-tracks/index.ts +++ b/projects/packages/videopress/src/client/lib/video-tracks/index.ts @@ -38,9 +38,9 @@ type isAutogeneratedChaterFileParamsProps = { * based on the block attributes. * If the first request fails, it will try again with the token. * - * @param {string} fileUrl - the track file url - * @param {isAutogeneratedChaterFileParamsProps} params - function parameters - * @returns {Promise} true if the file is autogenerated. + * @param {string} fileUrl - the track file url + * @param {isAutogeneratedChaterFileParamsProps} params - function parameters + * @return {Promise} true if the file is autogenerated. */ export async function isAutogeneratedChapterFile( fileUrl: string, @@ -119,8 +119,8 @@ const videoPressUploadTrack = function ( track: UploadTrackDataProps, guid: stri * Uses different methods depending on Jetpack or WPCOM. * * @param {object} track - the track file - * @param {string} guid - the video guid - * @returns {Promise} the api request promise + * @param {string} guid - the video guid + * @return {Promise} the api request promise */ export const uploadTrackForGuid = ( track: UploadTrackDataProps, guid: string ) => { const { kind, srcLang, label, tmpFile } = track; @@ -196,8 +196,8 @@ const videoPressDeleteTrack = function ( { kind, srcLang }, guid ) { * -Uses different methods depending on Jetpack or WPCOM. * * @param {object} track - the track file - * @param {string} guid - the video guid - * @returns {Promise} the api request promise + * @param {string} guid - the video guid + * @return {Promise} the api request promise */ export const deleteTrackForGuid = ( track: DeleteTrackDataProps, guid: string ) => { const { kind, srcLang } = track; diff --git a/projects/packages/videopress/src/client/state/actions.js b/projects/packages/videopress/src/client/state/actions.js index 572d9f1878eca..4fbb1e494a70c 100644 --- a/projects/packages/videopress/src/client/state/actions.js +++ b/projects/packages/videopress/src/client/state/actions.js @@ -210,7 +210,7 @@ const updateVideoPrivacy = * used as a primary hint for the UI to update. * * @param {string|number} id - Video post ID - * @returns {object} Action object + * @return {object} Action object */ const removeVideo = id => { return { type: REMOVE_VIDEO, id }; @@ -220,7 +220,7 @@ const removeVideo = id => { * Thunk action to remove a video from the state, * * @param {string|number} id - Video post ID - * @returns {Function} Thunk action + * @return {Function} Thunk action */ const deleteVideo = id => @@ -264,7 +264,7 @@ const deleteVideo = * Thunk action to upload videos for VideoPress. * * @param {File} file - File to upload - * @returns {Function} Thunk action + * @return {Function} Thunk action */ const uploadVideo = file => @@ -309,7 +309,7 @@ const uploadVideo = * Thunk action to upload local videos for VideoPress. * * @param {object} file - File data - * @returns {Function} Thunk action + * @return {Function} Thunk action */ const uploadVideoFromLibrary = file => @@ -448,7 +448,7 @@ const setVideoPressSettings = videoPressSettings => { * Thunk action to remove a video from the state, * * @param {object} settings - VideoPress settings - * @returns {Function} Thunk action + * @return {Function} Thunk action */ const updateVideoPressSettings = settings => diff --git a/projects/packages/videopress/src/client/state/reducers.js b/projects/packages/videopress/src/client/state/reducers.js index f5b5c1f7ad9d3..f538ceb3f0177 100644 --- a/projects/packages/videopress/src/client/state/reducers.js +++ b/projects/packages/videopress/src/client/state/reducers.js @@ -51,7 +51,7 @@ import { /** * Retunr default query values * - * @returns {object} Full query object. + * @return {object} Full query object. */ export function getDefaultQuery() { return { diff --git a/projects/packages/videopress/src/client/state/resolvers.js b/projects/packages/videopress/src/client/state/resolvers.js index 35709fe0869cb..15c611f6018d4 100644 --- a/projects/packages/videopress/src/client/state/resolvers.js +++ b/projects/packages/videopress/src/client/state/resolvers.js @@ -35,7 +35,7 @@ const { apiRoot } = window?.jetpackVideoPressInitialState || {}; * @param {object} video - Video object. * @param {object} resolveSelect - Containing the store’s selectors pre-bound to state * @param {object} dispatch - Containing the store’s actions pre-bound to state - * @returns {object} Tokenized video data object. + * @return {object} Tokenized video data object. */ async function populateVideoDataWithToken( video, resolveSelect, dispatch ) { if ( ! video.needsPlaybackToken ) { diff --git a/projects/packages/videopress/src/client/state/utils/video-is-private.ts b/projects/packages/videopress/src/client/state/utils/video-is-private.ts index f745a17203634..8e6e11a7913c0 100644 --- a/projects/packages/videopress/src/client/state/utils/video-is-private.ts +++ b/projects/packages/videopress/src/client/state/utils/video-is-private.ts @@ -12,9 +12,9 @@ import { * Determines if a video is private taking into account the video * privacy setting and the site default privacy setting. * - * @param {PrivacySettingProp} privacySetting - The privacy setting for the video - * @param {boolean} privateEnabledForSite - The site default privacy setting, if it's private or not - * @returns {boolean} - true if the video is private, false otherwise + * @param {PrivacySettingProp} privacySetting - The privacy setting for the video + * @param {boolean} privateEnabledForSite - The site default privacy setting, if it's private or not + * @return {boolean} - true if the video is private, false otherwise */ export const videoIsPrivate = ( privacySetting: PrivacySettingProp, diff --git a/projects/packages/videopress/src/client/utils/map-object-keys-to-camel-case/index.ts b/projects/packages/videopress/src/client/utils/map-object-keys-to-camel-case/index.ts index 414d596561bb7..a09f114eeed67 100644 --- a/projects/packages/videopress/src/client/utils/map-object-keys-to-camel-case/index.ts +++ b/projects/packages/videopress/src/client/utils/map-object-keys-to-camel-case/index.ts @@ -2,7 +2,7 @@ * Convert snake case string to camel case string. * * @param {string} string - String to convert. - * @returns {string} - Converted string. + * @return {string} - Converted string. */ export function snakeToCamel( string ) { return string.replace( /([-_][a-z])/gi, $1 => { @@ -14,7 +14,7 @@ export function snakeToCamel( string ) { * Check is the string has snake shape. * * @param {string} string - String to check. - * @returns {boolean} - True if the string has snake shape. + * @return {boolean} - True if the string has snake shape. */ function isSnake( string ) { return string.indexOf( '_' ) !== -1; @@ -25,7 +25,7 @@ function isSnake( string ) { * * @param {object} originalObject - Object to be converted. * @param {boolean} deleteOriginalProp - Whether to delete the original property. False by default. - * @returns {object} - Converted object. + * @return {object} - Converted object. */ export function mapObjectKeysToCamel( originalObject, deleteOriginalProp = false ) { // avoid to override original object diff --git a/projects/packages/videopress/src/client/utils/time/index.ts b/projects/packages/videopress/src/client/utils/time/index.ts index ffbc3d90f080c..0f64dab49e9be 100644 --- a/projects/packages/videopress/src/client/utils/time/index.ts +++ b/projects/packages/videopress/src/client/utils/time/index.ts @@ -3,7 +3,7 @@ * adding hours and minutes only when needed. * * @param {number} ms - The time in milliseconds to format. - * @returns {string} The formatted time string. + * @return {string} The formatted time string. * @example * const formattedTime1 = formatTime(1234567); // Returns "20:34.56" * const formattedTime2 = formatTime(45123); // Returns "45.12" diff --git a/projects/packages/videopress/src/client/utils/video-chapters/extract-video-chapters/index.ts b/projects/packages/videopress/src/client/utils/video-chapters/extract-video-chapters/index.ts index 5f32f34622847..1cbdfbbc3a63c 100644 --- a/projects/packages/videopress/src/client/utils/video-chapters/extract-video-chapters/index.ts +++ b/projects/packages/videopress/src/client/utils/video-chapters/extract-video-chapters/index.ts @@ -3,8 +3,8 @@ import type { VideoPressChapter } from '../types'; /** * Extracts chapter information from a single text line * - * @param {string} line - The line to be processed - * @returns {VideoPressChapter} - Title and start time of the chapter + * @param {string} line - The line to be processed + * @return {VideoPressChapter} - Title and start time of the chapter */ function extractSingleChapter( line: string ): VideoPressChapter | null { const regex = /(?\(?(?