From b0fff4be072f71ed7d478d8b96638805aa0ca041 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Thu, 30 Nov 2023 10:43:21 -0800 Subject: [PATCH] Map: Apply coding standards --- mu-plugins/blocks/google-map/postcss/style.pcss | 2 +- mu-plugins/blocks/google-map/src/components/list.js | 2 -- mu-plugins/blocks/google-map/src/components/main.js | 2 -- mu-plugins/blocks/google-map/src/components/map.js | 2 -- .../blocks/google-map/src/components/marker-content.js | 6 ------ mu-plugins/blocks/google-map/src/components/search.js | 2 -- mu-plugins/blocks/google-map/src/utilities/content.js | 2 +- mu-plugins/blocks/google-map/src/utilities/date-time.js | 2 +- mu-plugins/blocks/google-map/src/utilities/dom.js | 2 +- .../blocks/google-map/src/utilities/google-maps-api.js | 6 +++--- mu-plugins/blocks/google-map/src/utilities/map-styles.js | 3 ++- 11 files changed, 9 insertions(+), 22 deletions(-) diff --git a/mu-plugins/blocks/google-map/postcss/style.pcss b/mu-plugins/blocks/google-map/postcss/style.pcss index 0306833ed..7ea1bc6fd 100644 --- a/mu-plugins/blocks/google-map/postcss/style.pcss +++ b/mu-plugins/blocks/google-map/postcss/style.pcss @@ -45,7 +45,7 @@ & .wporg-map-marker__url a { text-decoration: none; - &:after { + &::after { content: "↗"; margin-left: 5px; font-family: var(--wp--preset--font-family--inter); diff --git a/mu-plugins/blocks/google-map/src/components/list.js b/mu-plugins/blocks/google-map/src/components/list.js index e9334453c..ee4503331 100644 --- a/mu-plugins/blocks/google-map/src/components/list.js +++ b/mu-plugins/blocks/google-map/src/components/list.js @@ -15,8 +15,6 @@ import { formatLocation } from '../utilities/content'; * @param {Object} props * @param {Array} props.markers * @param {number} props.displayLimit - * - * @return {JSX.Element} */ export default function List( { markers, displayLimit } ) { if ( markers.length === 0 ) { diff --git a/mu-plugins/blocks/google-map/src/components/main.js b/mu-plugins/blocks/google-map/src/components/main.js index 0faa9f756..6d6243da8 100644 --- a/mu-plugins/blocks/google-map/src/components/main.js +++ b/mu-plugins/blocks/google-map/src/components/main.js @@ -32,8 +32,6 @@ import { getValidMarkers } from '../utilities/google-maps-api'; * @param {string} props.searchIcon * @param {Array} props.searchFields * @param {number} props.listDisplayLimit - * - * @return {JSX.Element} */ export default function Main( { blockStyle, diff --git a/mu-plugins/blocks/google-map/src/components/map.js b/mu-plugins/blocks/google-map/src/components/map.js index 51bba4427..55f62a370 100644 --- a/mu-plugins/blocks/google-map/src/components/map.js +++ b/mu-plugins/blocks/google-map/src/components/map.js @@ -31,8 +31,6 @@ import { * @param {Array} props.markers * @param {string} props.blockStyle * @param {Object} props.icon - * - * @return {JSX.Element} */ export default function Map( { apiKey, markers: rawMarkers, icon, blockStyle } ) { const [ loaded, setLoaded ] = useState( false ); diff --git a/mu-plugins/blocks/google-map/src/components/marker-content.js b/mu-plugins/blocks/google-map/src/components/marker-content.js index 9a92a3c54..3ebf0dba2 100644 --- a/mu-plugins/blocks/google-map/src/components/marker-content.js +++ b/mu-plugins/blocks/google-map/src/components/marker-content.js @@ -8,8 +8,6 @@ import { formatLocation } from '../utilities/content'; * Render the content for a map marker. * * @param {Object} props - * - * @return {JSX.Element} */ export default function MarkerContent( props ) { const { type } = props; @@ -38,8 +36,6 @@ export default function MarkerContent( props ) { * @param {string} props.url * @param {string} props.timestamp * @param {string} props.location - * - * @return {JSX.Element} */ function WordCampMarker( { id, title, url, timestamp, location } ) { return ( @@ -67,8 +63,6 @@ function WordCampMarker( { id, title, url, timestamp, location } ) { * @param {string} props.meetup * @param {string} props.timestamp * @param {string} props.location - * - * @return {JSX.Element} */ function MeetupMarker( { id, title, url, meetup, timestamp, location } ) { return ( diff --git a/mu-plugins/blocks/google-map/src/components/search.js b/mu-plugins/blocks/google-map/src/components/search.js index 5a7677e5a..b1f65f565 100644 --- a/mu-plugins/blocks/google-map/src/components/search.js +++ b/mu-plugins/blocks/google-map/src/components/search.js @@ -10,8 +10,6 @@ import { __, _x } from '@wordpress/i18n'; * @param {string} props.searchQuery * @param {Function} props.onQueryChange * @param {string} props.iconURL - * - * @return {JSX.Element} */ export default function Search( { searchQuery, onQueryChange, iconURL } ) { return ( diff --git a/mu-plugins/blocks/google-map/src/utilities/content.js b/mu-plugins/blocks/google-map/src/utilities/content.js index b78bd6474..4c4877193 100644 --- a/mu-plugins/blocks/google-map/src/utilities/content.js +++ b/mu-plugins/blocks/google-map/src/utilities/content.js @@ -15,7 +15,7 @@ import { __, sprintf } from '@wordpress/i18n'; * * @param {string} location * - * @return {string} + * @return {string} The formatted location. */ export function formatLocation( location ) { if ( 'online' === location ) { diff --git a/mu-plugins/blocks/google-map/src/utilities/date-time.js b/mu-plugins/blocks/google-map/src/utilities/date-time.js index b3bf640bc..7b252b1de 100644 --- a/mu-plugins/blocks/google-map/src/utilities/date-time.js +++ b/mu-plugins/blocks/google-map/src/utilities/date-time.js @@ -10,7 +10,7 @@ * * @param {number} timestamp * - * @return {string} + * @return {string} The formatted date and time. */ export function getEventDateTime( timestamp ) { const eventDate = new Date( timestamp * 1000 ); diff --git a/mu-plugins/blocks/google-map/src/utilities/dom.js b/mu-plugins/blocks/google-map/src/utilities/dom.js index 3e8fe7d3d..1c3ac8122 100644 --- a/mu-plugins/blocks/google-map/src/utilities/dom.js +++ b/mu-plugins/blocks/google-map/src/utilities/dom.js @@ -11,7 +11,7 @@ import { createRoot, flushSync } from '@wordpress/element'; * * @param {JSX.Element} element * - * @return {string} + * @return {string} The HTML for the given element. */ export default function getElementHTML( element ) { const div = document.createElement( 'div' ); diff --git a/mu-plugins/blocks/google-map/src/utilities/google-maps-api.js b/mu-plugins/blocks/google-map/src/utilities/google-maps-api.js index ea0a905c6..90b9ae0ed 100644 --- a/mu-plugins/blocks/google-map/src/utilities/google-maps-api.js +++ b/mu-plugins/blocks/google-map/src/utilities/google-maps-api.js @@ -18,7 +18,7 @@ import getElementHTML from '../utilities/dom'; * * @param {Array} markers * - * @return {Array} + * @return {Array} Valid markers. */ export function getValidMarkers( markers ) { markers = markers.map( ( marker ) => { @@ -40,7 +40,7 @@ export function getValidMarkers( markers ) { * * @param {Array} rawMarkers * - * @return {Array} + * @return {Array} The original markers, with events in the same location combined into a single marker. */ export function combineDuplicateLocations( rawMarkers ) { const combinedMarkers = {}; @@ -144,7 +144,7 @@ function openInfoWindow( infoWindow, map, markerObject, rawMarker ) { * @param {Object} rawIcon * @param {string} blockStyle * - * @return {MarkerClusterer} + * @return {MarkerClusterer} The clusterer object. */ export function clusterMarkers( map, maps, markers, rawIcon, blockStyle ) { const clusterIcon = { diff --git a/mu-plugins/blocks/google-map/src/utilities/map-styles.js b/mu-plugins/blocks/google-map/src/utilities/map-styles.js index 8556266cd..57a8d640f 100644 --- a/mu-plugins/blocks/google-map/src/utilities/map-styles.js +++ b/mu-plugins/blocks/google-map/src/utilities/map-styles.js @@ -463,7 +463,8 @@ const sotw2023 = [ * This shouldn't be needed if https://github.com/WordPress/gutenberg/issues/56278 is resolved. * * @param { string } className - * @return { string } + * + * @return { string } The slug of the block style. */ export function getBlockStyle( className ) { let blockStyle = 'wp20';