From 7ff313e0f9114fcae3dca3551343bbd29ab12651 Mon Sep 17 00:00:00 2001 From: "Chris J. Shull" Date: Tue, 5 May 2026 21:35:46 -0700 Subject: [PATCH 1/2] reenable @typescript-eslint/no-unused-vars --- eslint.config.mjs | 1 - samples/3d-camera-to-around/index.ts | 2 +- samples/3d-label-toggle/index.ts | 11 ----------- samples/3d-marker-click-event/index.ts | 2 +- samples/3d-marker-collision-behavior/index.ts | 2 +- samples/3d-model-interactive/index.ts | 2 +- samples/3d-places-autocomplete/index.ts | 3 +-- samples/3d-popover-marker/index.ts | 2 +- samples/add-map/index.ts | 4 ++-- samples/address-validation/index.ts | 2 -- .../advanced-markers-accessibility/index.ts | 5 ++--- samples/advanced-markers-altitude/index.ts | 2 +- samples/advanced-markers-animation/index.ts | 7 +++---- samples/advanced-markers-basic-style/index.ts | 3 +-- samples/advanced-markers-collision/index.ts | 2 +- samples/advanced-markers-draggable/index.ts | 4 ++-- samples/advanced-markers-graphics/index.ts | 2 +- samples/advanced-markers-html-simple/index.ts | 2 +- samples/advanced-markers-html/index.ts | 4 ++-- samples/advanced-markers-simple/index.ts | 2 +- samples/advanced-markers-zoom/index.ts | 2 +- samples/ai-powered-summaries-basic/index.ts | 2 +- samples/boundaries-click/index.ts | 2 +- samples/circle-simple/index.ts | 5 +---- samples/control-positioning/index.ts | 2 +- samples/control-replacement/index.ts | 4 ++-- samples/dds-datasets-point/index.ts | 4 ++-- samples/deckgl-arclayer/index.ts | 1 - samples/deckgl-kml-updated/index.ts | 4 ++-- samples/deckgl-points/index.ts | 6 +----- samples/geocoding-reverse/index.ts | 2 +- samples/geocoding-simple/index.ts | 18 +++++++----------- samples/js-api-loader-map/index.ts | 5 +---- samples/layer-data-event/index.ts | 2 -- samples/layer-data-quakes-simple/index.ts | 1 - samples/map-simple-js/index.ts | 4 +++- samples/map-simple/index.ts | 4 +++- .../place-autocomplete-data-simple/index.ts | 2 +- samples/place-autocomplete-map/index.ts | 1 - samples/place-class/index.ts | 2 +- samples/place-nearby-search/index.ts | 1 - .../places-autocomplete-addressform/index.ts | 3 +-- samples/routes-compute-routes/index.ts | 1 - samples/routes-get-directions-panel/index.ts | 5 ++--- samples/routes-get-directions/index.ts | 15 +++++++++------ samples/routes-markers/index.ts | 7 ++----- samples/streetview-overlays/index.ts | 8 ++++---- samples/test-example/index.ts | 5 ++--- samples/ui-kit-place-details-compact/index.ts | 2 +- samples/ui-kit-place-details/index.ts | 2 +- samples/ui-kit-place-search-nearby/index.ts | 2 +- samples/ui-kit-place-search-text/index.ts | 2 +- samples/weather-api-current-compact/index.ts | 2 -- 53 files changed, 76 insertions(+), 116 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 6a74c5cd6..bd9f62beb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -42,7 +42,6 @@ export default defineConfig([ rules: { // temporarily downgraded to warn for historic reasons: '@typescript-eslint/no-unsafe-member-access': 'warn', - '@typescript-eslint/no-unused-vars': 'warn', '@typescript-eslint/no-unsafe-assignment': 'warn', '@typescript-eslint/require-await': 'warn', '@typescript-eslint/no-floating-promises': 'warn', diff --git a/samples/3d-camera-to-around/index.ts b/samples/3d-camera-to-around/index.ts index 160697cb6..374c7db43 100644 --- a/samples/3d-camera-to-around/index.ts +++ b/samples/3d-camera-to-around/index.ts @@ -61,7 +61,7 @@ async function init() { ); // Stop animation after flying around. // At any time stop the animation. - map.addEventListener('gmp-click', (event) => { + map.addEventListener('gmp-click', () => { map.stopCameraAnimation(); }); } diff --git a/samples/3d-label-toggle/index.ts b/samples/3d-label-toggle/index.ts index ac0b0fdef..030635c69 100644 --- a/samples/3d-label-toggle/index.ts +++ b/samples/3d-label-toggle/index.ts @@ -25,17 +25,6 @@ async function init() { document.body.append(map); - const locationCamera = { - center: { - lat: 21.263523536467105, - lng: -157.80663691939296, - altitude: 80.28936069489404, - }, - range: 1500.8202963253427, - tilt: 76.9173260789542, - heading: -44.59196007522445, - }; - // Get the button element by its ID const toggleButton = document.getElementById('toggleButton')!; toggleButton.addEventListener('click', function () { diff --git a/samples/3d-marker-click-event/index.ts b/samples/3d-marker-click-event/index.ts index 88e151304..3631a9771 100644 --- a/samples/3d-marker-click-event/index.ts +++ b/samples/3d-marker-click-event/index.ts @@ -33,7 +33,7 @@ async function initMap() { }); // Specify the action to take on click. - interactiveMarker.addEventListener('gmp-click', (event) => { + interactiveMarker.addEventListener('gmp-click', () => { map.flyCameraAround({ camera: originalCamera, durationMillis: 50000, diff --git a/samples/3d-marker-collision-behavior/index.ts b/samples/3d-marker-collision-behavior/index.ts index 738d9e9a5..8594be07d 100644 --- a/samples/3d-marker-collision-behavior/index.ts +++ b/samples/3d-marker-collision-behavior/index.ts @@ -56,7 +56,7 @@ const dropdown = document.getElementById( ) as HTMLSelectElement; dropdown.addEventListener('change', drawMap); -function drawMap(event) { +function drawMap() { for (const marker of markers) { marker.collisionBehavior = (dropdown.value as google.maps.CollisionBehavior) || 'REQUIRED'; diff --git a/samples/3d-model-interactive/index.ts b/samples/3d-model-interactive/index.ts index d8c760f84..fdf89bbb0 100644 --- a/samples/3d-model-interactive/index.ts +++ b/samples/3d-model-interactive/index.ts @@ -27,7 +27,7 @@ async function init() { altitudeMode: 'CLAMP_TO_GROUND', }); - model.addEventListener('gmp-click', function (event) { + model.addEventListener('gmp-click', function () { this.scale = Math.random() * (0.5 - 0.1) + 0.1; }); diff --git a/samples/3d-places-autocomplete/index.ts b/samples/3d-places-autocomplete/index.ts index 6cdd0b8e3..7a142f66c 100644 --- a/samples/3d-places-autocomplete/index.ts +++ b/samples/3d-places-autocomplete/index.ts @@ -53,8 +53,7 @@ async function initAutocomplete() { } const flyToPlace = async (place) => { - const { Polyline3DElement, Polygon3DElement, Marker3DElement } = - await google.maps.importLibrary('maps3d'); + const { Marker3DElement } = await google.maps.importLibrary('maps3d'); const location = place.location; diff --git a/samples/3d-popover-marker/index.ts b/samples/3d-popover-marker/index.ts index 2cee32270..da2ee1b09 100644 --- a/samples/3d-popover-marker/index.ts +++ b/samples/3d-popover-marker/index.ts @@ -31,7 +31,7 @@ async function init() { popover.append('Golden Gate Bridge'); - interactiveMarker.addEventListener('gmp-click', (event) => { + interactiveMarker.addEventListener('gmp-click', () => { // toggle the marker to the other state (unlee you are clicking on the marker itself when it reopens it) popover.open = !popover.open; }); diff --git a/samples/add-map/index.ts b/samples/add-map/index.ts index 7daf4a831..d718e4144 100644 --- a/samples/add-map/index.ts +++ b/samples/add-map/index.ts @@ -9,7 +9,7 @@ async function initMap(): Promise { // [START maps_add_map_instantiate_map] // [START maps_add_map_libraries] // Request the needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); @@ -30,7 +30,7 @@ async function initMap(): Promise { // [START maps_add_map_instantiate_marker] // Add a marker positioned at the map center (Uluru). - const marker = new AdvancedMarkerElement({ + new AdvancedMarkerElement({ map: innerMap, position: mapElement.center, title: 'Uluru/Ayers Rock', diff --git a/samples/address-validation/index.ts b/samples/address-validation/index.ts index 377841003..05c4ef9b3 100644 --- a/samples/address-validation/index.ts +++ b/samples/address-validation/index.ts @@ -7,10 +7,8 @@ // [START maps_address_validation] // DOM Refs const addressForm = document.getElementById('address-form'); -const validateButton = document.getElementById('validate-button'); const clearFormButton = document.getElementById('clear-form-button'); const resultDisplay = document.getElementById('result-display'); -const loadingText = document.getElementById('loading-text'); // Input field refs const streetAddress1Input = document.getElementById( 'street-address-1' diff --git a/samples/advanced-markers-accessibility/index.ts b/samples/advanced-markers-accessibility/index.ts index 2764fec9e..c29af25da 100644 --- a/samples/advanced-markers-accessibility/index.ts +++ b/samples/advanced-markers-accessibility/index.ts @@ -9,7 +9,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map, InfoWindow }, { AdvancedMarkerElement, PinElement }] = + const [{ InfoWindow }, { AdvancedMarkerElement, PinElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), @@ -61,8 +61,7 @@ async function initMap() { // [END maps_advanced_markers_accessibility_marker] // [START maps_advanced_markers_accessibility_event_listener] // Add a click listener for each marker, and set up the info window. - marker.addEventListener('gmp-click', (domEvent) => { - const { target } = domEvent; + marker.addEventListener('gmp-click', () => { infoWindow.close(); infoWindow.setContent(marker.title); infoWindow.open(marker.map, marker); diff --git a/samples/advanced-markers-altitude/index.ts b/samples/advanced-markers-altitude/index.ts index 99a4801ba..a49048182 100644 --- a/samples/advanced-markers-altitude/index.ts +++ b/samples/advanced-markers-altitude/index.ts @@ -9,7 +9,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement, PinElement }] = await Promise.all([ + const [, { AdvancedMarkerElement, PinElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/advanced-markers-animation/index.ts b/samples/advanced-markers-animation/index.ts index d9928c520..2a3e9fb59 100644 --- a/samples/advanced-markers-animation/index.ts +++ b/samples/advanced-markers-animation/index.ts @@ -31,7 +31,6 @@ function getRandomPosition(map) { }; } -const total = 100; const intersectionObserver = new IntersectionObserver((entries) => { for (const entry of entries) { if (entry.isIntersecting) { @@ -44,7 +43,7 @@ const intersectionObserver = new IntersectionObserver((entries) => { async function initMap(): Promise { // Request needed libraries. const [ - { Map }, + , { event, ControlPosition }, { AdvancedMarkerElement, PinElement }, ] = await Promise.all([ @@ -85,14 +84,14 @@ async function initMap(): Promise { function createMarker(map, AdvancedMarkerElement, PinElement) { const pinElement = new PinElement(); const content = pinElement.element; - const advancedMarker = new AdvancedMarkerElement({ + new AdvancedMarkerElement({ position: getRandomPosition(map), map: map, content: content, }); content.style.opacity = '0'; - content.addEventListener('animationend', (event) => { + content.addEventListener('animationend', () => { content.classList.remove('drop'); content.style.opacity = '1'; }); diff --git a/samples/advanced-markers-basic-style/index.ts b/samples/advanced-markers-basic-style/index.ts index 57189c98a..a11ffd3cc 100644 --- a/samples/advanced-markers-basic-style/index.ts +++ b/samples/advanced-markers-basic-style/index.ts @@ -5,12 +5,11 @@ */ // [START maps_advanced_markers_basic_style] -const parser = new DOMParser(); const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement, PinElement }] = await Promise.all([ + const [, { AdvancedMarkerElement, PinElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/advanced-markers-collision/index.ts b/samples/advanced-markers-collision/index.ts index c0eb01810..b127a17f7 100644 --- a/samples/advanced-markers-collision/index.ts +++ b/samples/advanced-markers-collision/index.ts @@ -11,7 +11,7 @@ const mapElement = document.querySelector('gmp-map')!; // Initialize and add the map async function initMap(): Promise { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/advanced-markers-draggable/index.ts b/samples/advanced-markers-draggable/index.ts index 697f37241..896d71d5e 100644 --- a/samples/advanced-markers-draggable/index.ts +++ b/samples/advanced-markers-draggable/index.ts @@ -9,7 +9,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map, InfoWindow }, { AdvancedMarkerElement }] = await Promise.all([ + const [{ InfoWindow }, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); @@ -25,7 +25,7 @@ async function initMap() { mapElement.append(draggableMarker); // [END maps_advanced_markers_draggable_marker] - draggableMarker.addListener('dragend', (event) => { + draggableMarker.addListener('dragend', () => { const position = draggableMarker.position!; infoWindow.close(); infoWindow.setContent(`Pin dropped at: ${JSON.stringify(position)}`); diff --git a/samples/advanced-markers-graphics/index.ts b/samples/advanced-markers-graphics/index.ts index 69da7e601..03e24d8d8 100644 --- a/samples/advanced-markers-graphics/index.ts +++ b/samples/advanced-markers-graphics/index.ts @@ -7,7 +7,7 @@ // [START maps_advanced_markers_graphics] async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement, PinElement }, { Place }] = + const [, { AdvancedMarkerElement, PinElement }, { Place }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), diff --git a/samples/advanced-markers-html-simple/index.ts b/samples/advanced-markers-html-simple/index.ts index 2d7c2d4b8..ae6376442 100644 --- a/samples/advanced-markers-html-simple/index.ts +++ b/samples/advanced-markers-html-simple/index.ts @@ -10,7 +10,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/advanced-markers-html/index.ts b/samples/advanced-markers-html/index.ts index a8dd23fc2..bea04d05d 100644 --- a/samples/advanced-markers-html/index.ts +++ b/samples/advanced-markers-html/index.ts @@ -29,12 +29,12 @@ async function initMap() { }); advancedMarkerElement.addListener('click', () => { - toggleHighlight(advancedMarkerElement, property); + toggleHighlight(advancedMarkerElement); }); } } -function toggleHighlight(markerView, property) { +function toggleHighlight(markerView) { if (markerView.content.classList.contains('highlight')) { markerView.content.classList.remove('highlight'); markerView.zIndex = null; diff --git a/samples/advanced-markers-simple/index.ts b/samples/advanced-markers-simple/index.ts index 9e67a9325..876e4b399 100644 --- a/samples/advanced-markers-simple/index.ts +++ b/samples/advanced-markers-simple/index.ts @@ -10,7 +10,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/advanced-markers-zoom/index.ts b/samples/advanced-markers-zoom/index.ts index 8051f5dd9..f14472e7f 100644 --- a/samples/advanced-markers-zoom/index.ts +++ b/samples/advanced-markers-zoom/index.ts @@ -9,7 +9,7 @@ const mapElement = document.querySelector('gmp-map')!; async function initMap() { // Request needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); diff --git a/samples/ai-powered-summaries-basic/index.ts b/samples/ai-powered-summaries-basic/index.ts index 7ef40274b..b7b953c64 100644 --- a/samples/ai-powered-summaries-basic/index.ts +++ b/samples/ai-powered-summaries-basic/index.ts @@ -10,7 +10,7 @@ let innerMap; let infoWindow; async function initMap() { - const { Map, InfoWindow } = await google.maps.importLibrary('maps'); + const { InfoWindow } = await google.maps.importLibrary('maps'); innerMap = mapElement.innerMap; innerMap.setOptions({ diff --git a/samples/boundaries-click/index.ts b/samples/boundaries-click/index.ts index fc8e3d6da..e07dfd037 100644 --- a/samples/boundaries-click/index.ts +++ b/samples/boundaries-click/index.ts @@ -27,7 +27,7 @@ function handleMouseMove(e) { async function initMap() { // Request needed libraries. - const { Map, InfoWindow } = await google.maps.importLibrary('maps'); + const { InfoWindow } = await google.maps.importLibrary('maps'); // Get the gmp-map element. const mapElement = document.querySelector('gmp-map')!; diff --git a/samples/circle-simple/index.ts b/samples/circle-simple/index.ts index 1801b1f0a..1fca9d80f 100644 --- a/samples/circle-simple/index.ts +++ b/samples/circle-simple/index.ts @@ -17,14 +17,11 @@ async function initMap() { google.maps.importLibrary('core'), ]); - // Get the gmp-map element. - const mapElement = document.querySelector('gmp-map')!; - // Set the initial map center point. const initialCenter = { lat: 34.98956821576194, lng: 135.74239981260283 }; // Hotel Emion, Kyoto, Japan // Get the inner map. - const innerMap = mapElement.innerMap; + innerMap = mapElement.innerMap; // Get the buttons. const buttons = document.querySelectorAll('input[name="radius"]'); diff --git a/samples/control-positioning/index.ts b/samples/control-positioning/index.ts index d5e74a291..cc4761200 100755 --- a/samples/control-positioning/index.ts +++ b/samples/control-positioning/index.ts @@ -16,7 +16,7 @@ async function initMap() { ]); // Get the inner map. - const innerMap = mapElement.innerMap; + innerMap = mapElement.innerMap; // Set the map's controls options. innerMap.setOptions({ diff --git a/samples/control-replacement/index.ts b/samples/control-replacement/index.ts index bd32c053c..4b367b6f7 100644 --- a/samples/control-replacement/index.ts +++ b/samples/control-replacement/index.ts @@ -21,7 +21,7 @@ async function initMap() { initZoomControl(innerMap); initMapTypeControl(innerMap); - initFullscreenControl(innerMap); + initFullscreenControl(); } function initZoomControl(map: google.maps.Map) { @@ -55,7 +55,7 @@ async function initMapTypeControl(innerMap: google.maps.Map) { }); } -async function initFullscreenControl(innerMap: google.maps.Map) { +async function initFullscreenControl() { // Get the UI elements for the fullscreen control. const btnFullscreen = document.querySelector('#fullscreen-button')!; diff --git a/samples/dds-datasets-point/index.ts b/samples/dds-datasets-point/index.ts index 740594467..eb65962b2 100644 --- a/samples/dds-datasets-point/index.ts +++ b/samples/dds-datasets-point/index.ts @@ -96,7 +96,7 @@ async function initMap() { event.addListenerOnce(innerMap, 'idle', () => { // Add the data legend. - makeLegend(innerMap); + makeLegend(); }); // Dataset ID for squirrel dataset. @@ -106,7 +106,7 @@ async function initMap() { } // Creates a legend for the map. -async function makeLegend(innerMap) { +async function makeLegend() { const colors = { black: ['black'], cinnamon: ['#8b0000'], diff --git a/samples/deckgl-arclayer/index.ts b/samples/deckgl-arclayer/index.ts index 32c0110d9..aa909c21f 100644 --- a/samples/deckgl-arclayer/index.ts +++ b/samples/deckgl-arclayer/index.ts @@ -11,7 +11,6 @@ import type * as GeoJSON from 'geojson'; type Properties = { scalerank: number }; type Feature = GeoJSON.Feature; -type Data = GeoJSON.FeatureCollection; async function initMap() { // Request needed libraries. diff --git a/samples/deckgl-kml-updated/index.ts b/samples/deckgl-kml-updated/index.ts index 106fddc92..a48cbc6ac 100644 --- a/samples/deckgl-kml-updated/index.ts +++ b/samples/deckgl-kml-updated/index.ts @@ -102,8 +102,8 @@ async function initMap(): Promise { // lineWidthMinPixels: 4, // Not needed for points pointRadiusMinPixels: 2, pointRadiusMaxPixels: 200, - getRadius: (f) => 8000, - getFillColor: (f, { index }) => { + getRadius: () => 8000, + getFillColor: (f) => { // Extract magnitude from the description string const description = f.properties.description; const magnitudeMatch = description.match(/M (\d+\.?\d*)/); diff --git a/samples/deckgl-points/index.ts b/samples/deckgl-points/index.ts index 6ed8c3e5f..6b224b54d 100644 --- a/samples/deckgl-points/index.ts +++ b/samples/deckgl-points/index.ts @@ -9,8 +9,6 @@ import { GoogleMapsOverlay } from '@deck.gl/google-maps'; import { GeoJsonLayer } from '@deck.gl/layers'; import { Feature } from 'geojson'; -type Properties = { mag: number }; - const mapElement = document.querySelector('gmp-map')!; let innerMap: google.maps.Map; @@ -56,9 +54,7 @@ async function initMap() { } return 0; // Fallback for invalid data. }, - getFillColor: ( - f: Feature - ): [number, number, number, number] => { + getFillColor: (): [number, number, number, number] => { return [255, 70, 30, 180]; // Default color for other earthquakes. }, autoHighlight: true, diff --git a/samples/geocoding-reverse/index.ts b/samples/geocoding-reverse/index.ts index ba9def9b3..6f81e797e 100644 --- a/samples/geocoding-reverse/index.ts +++ b/samples/geocoding-reverse/index.ts @@ -8,7 +8,7 @@ let marker; async function initMap() { // Request the needed libraries. - const [{ Map, InfoWindow }, { Geocoder }, { AdvancedMarkerElement }] = + const [{ InfoWindow }, { Geocoder }, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('geocoding'), diff --git a/samples/geocoding-simple/index.ts b/samples/geocoding-simple/index.ts index 67ed34d30..b9b5174e7 100644 --- a/samples/geocoding-simple/index.ts +++ b/samples/geocoding-simple/index.ts @@ -14,17 +14,13 @@ let response; async function initMap() { // Request the needed libraries. - const [ - { Map }, - { Geocoder }, - { AdvancedMarkerElement }, - { ControlPosition }, - ] = await Promise.all([ - google.maps.importLibrary('maps'), - google.maps.importLibrary('geocoding'), - google.maps.importLibrary('marker'), - google.maps.importLibrary('core'), - ]); + const [, { Geocoder }, { AdvancedMarkerElement }, { ControlPosition }] = + await Promise.all([ + google.maps.importLibrary('maps'), + google.maps.importLibrary('geocoding'), + google.maps.importLibrary('marker'), + google.maps.importLibrary('core'), + ]); // Get the gmp-map element. mapElement = document.querySelector('gmp-map')!; diff --git a/samples/js-api-loader-map/index.ts b/samples/js-api-loader-map/index.ts index a5b564371..55211f267 100644 --- a/samples/js-api-loader-map/index.ts +++ b/samples/js-api-loader-map/index.ts @@ -30,10 +30,7 @@ async function initMap(): Promise { }; // Declare the map. - const map = new Map( - document.getElementById('map') as HTMLElement, - mapOptions - ); + new Map(document.getElementById('map') as HTMLElement, mapOptions); } initMap(); diff --git a/samples/layer-data-event/index.ts b/samples/layer-data-event/index.ts index b95e8d5dc..a8e188f52 100644 --- a/samples/layer-data-event/index.ts +++ b/samples/layer-data-event/index.ts @@ -5,8 +5,6 @@ */ // [START maps_layer_data_event] -let map: google.maps.Map; - async function initMap() { await google.maps.importLibrary('maps'); diff --git a/samples/layer-data-quakes-simple/index.ts b/samples/layer-data-quakes-simple/index.ts index dea8dc385..dce819ce7 100644 --- a/samples/layer-data-quakes-simple/index.ts +++ b/samples/layer-data-quakes-simple/index.ts @@ -6,7 +6,6 @@ // [START maps_layer_data_quakes_simple] let innerMap; -let earthquakeData; async function initMap() { await google.maps.importLibrary('maps'); diff --git a/samples/map-simple-js/index.ts b/samples/map-simple-js/index.ts index 374f1ddbf..73621d468 100644 --- a/samples/map-simple-js/index.ts +++ b/samples/map-simple-js/index.ts @@ -14,7 +14,7 @@ let map: google.maps.Map; async function initMap(): Promise { // Import the needed libraries - const { Map, RenderingType } = await google.maps.importLibrary('maps'); + const { Map } = await google.maps.importLibrary('maps'); // Create a new map from the div with id="map". map = new Map(document.getElementById('map') as HTMLElement, { @@ -22,6 +22,8 @@ async function initMap(): Promise { zoom: 8, renderingType: 'VECTOR', }); + + console.log(map); } initMap(); diff --git a/samples/map-simple/index.ts b/samples/map-simple/index.ts index 2bd1c45c4..2fd579c5a 100644 --- a/samples/map-simple/index.ts +++ b/samples/map-simple/index.ts @@ -9,10 +9,12 @@ async function initMap(): Promise { // Import the needed libraries. await google.maps.importLibrary('maps'); - // Create the map. + // Access the map. const mapElement = document.querySelector('gmp-map')!; // Access the underlying map object. const innerMap = mapElement.innerMap; + + console.log({ mapElement, innerMap }); } initMap(); diff --git a/samples/place-autocomplete-data-simple/index.ts b/samples/place-autocomplete-data-simple/index.ts index 9033e063f..a3b668ba8 100644 --- a/samples/place-autocomplete-data-simple/index.ts +++ b/samples/place-autocomplete-data-simple/index.ts @@ -6,7 +6,7 @@ // [START maps_place_autocomplete_data_simple] async function init() { - const { Place, AutocompleteSessionToken, AutocompleteSuggestion } = + const { AutocompleteSessionToken, AutocompleteSuggestion } = await google.maps.importLibrary('places'); // [START maps_place_autocomplete_data_simple_request] diff --git a/samples/place-autocomplete-map/index.ts b/samples/place-autocomplete-map/index.ts index ff432db4a..fe06880aa 100644 --- a/samples/place-autocomplete-map/index.ts +++ b/samples/place-autocomplete-map/index.ts @@ -10,7 +10,6 @@ const placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; let innerMap; let marker: google.maps.marker.AdvancedMarkerElement; let infoWindow: google.maps.InfoWindow; -const center = { lat: 40.749933, lng: -73.98633 }; // New York City async function initMap(): Promise { // Request needed libraries. const [{ AdvancedMarkerElement }, { InfoWindow }] = await Promise.all([ diff --git a/samples/place-class/index.ts b/samples/place-class/index.ts index b84438ce0..b9d81271a 100644 --- a/samples/place-class/index.ts +++ b/samples/place-class/index.ts @@ -10,7 +10,7 @@ let innerMap; let infoWindow; async function initMap() { - const { Map, InfoWindow } = await google.maps.importLibrary('maps'); + const { InfoWindow } = await google.maps.importLibrary('maps'); innerMap = mapElement.innerMap; infoWindow = new InfoWindow(); diff --git a/samples/place-nearby-search/index.ts b/samples/place-nearby-search/index.ts index 4a2ebfb7b..10285a950 100644 --- a/samples/place-nearby-search/index.ts +++ b/samples/place-nearby-search/index.ts @@ -7,7 +7,6 @@ // [START maps_place_nearby_search] const mapElement = document.querySelector('gmp-map')!; let innerMap; -const advancedMarkerElement = document.querySelector('gmp-advanced-marker')!; let center; let typeSelect; let infoWindow; diff --git a/samples/places-autocomplete-addressform/index.ts b/samples/places-autocomplete-addressform/index.ts index 10316a1ec..1c86783f5 100644 --- a/samples/places-autocomplete-addressform/index.ts +++ b/samples/places-autocomplete-addressform/index.ts @@ -17,7 +17,7 @@ let address2Field: HTMLInputElement; let postalField: HTMLInputElement; async function initAutocomplete() { - const { Place, Autocomplete } = await google.maps.importLibrary('places'); + await google.maps.importLibrary('places'); placeAutocomplete = document.querySelector('gmp-place-autocomplete')!; address1Field = document.querySelector('#address1')!; @@ -45,7 +45,6 @@ async function initAutocomplete() { async function fillInAddress(placePrediction) { // The placePrediction object does not have all the details needed // for the form, so we'll call fetchFields to get the place details. - const { Place } = await google.maps.importLibrary('places'); const place = placePrediction.toPlace(); await place.fetchFields({ fields: ['addressComponents'] }); diff --git a/samples/routes-compute-routes/index.ts b/samples/routes-compute-routes/index.ts index 86d1fcd35..6a2ec58c4 100644 --- a/samples/routes-compute-routes/index.ts +++ b/samples/routes-compute-routes/index.ts @@ -6,7 +6,6 @@ // [START maps_routes_compute_routes] let markers: google.maps.marker.AdvancedMarkerElement[] = []; let polylines: google.maps.Polyline[] = []; -const waypointInfoWindow: google.maps.InfoWindow | null = null; interface PlaceAutocompleteSelection { predictionText: string | null; diff --git a/samples/routes-get-directions-panel/index.ts b/samples/routes-get-directions-panel/index.ts index f1185c641..db24ced67 100644 --- a/samples/routes-get-directions-panel/index.ts +++ b/samples/routes-get-directions-panel/index.ts @@ -7,7 +7,6 @@ // Initialize and add the map. let map; let mapPolylines: google.maps.Polyline[] = []; -const markers: google.maps.marker.AdvancedMarkerElement[] = []; const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA // Initialize and add the map. @@ -55,7 +54,7 @@ async function initMap(): Promise { fitMapToPath(routes[0].path!); // Add markers to all the points. - const markers = await routes[0].createWaypointAdvancedMarkers({ map }); + await routes[0].createWaypointAdvancedMarkers({ map }); // [START maps_routes_get_directions_panel_steps] // Render navigation instructions @@ -92,7 +91,7 @@ async function initMap(): Promise { const stepsList = document.createElement('ol'); stepsList.className = 'directions-steps'; - leg.steps.forEach((step, stepIndex) => { + leg.steps.forEach((step) => { const stepItem = document.createElement('li'); stepItem.className = 'direction-step'; diff --git a/samples/routes-get-directions/index.ts b/samples/routes-get-directions/index.ts index b9e7c0d5b..9feb85486 100644 --- a/samples/routes-get-directions/index.ts +++ b/samples/routes-get-directions/index.ts @@ -12,7 +12,7 @@ const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA // Initialize and add the map. async function initMap(): Promise { // Request the needed libraries. - const [{ Map }, { Place }, { Route }] = await Promise.all([ + const [{ Map }, , { Route }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), google.maps.importLibrary('routes'), @@ -33,6 +33,7 @@ async function initMap(): Promise { fields: ['path'], }; // [END maps_routes_get_directions_request_string] + console.log({ requestWithAddressStrings }); // [START maps_routes_get_directions_request_placeid] // Use Place IDs in a directions request. @@ -44,12 +45,13 @@ async function initMap(): Promise { id: 'ChIJIQBpAG2ahYAR_6128GcTUEo', // San Francisco, CA }); - const requestWithPlaceIds = { + const requestWithPlaceIds: google.maps.routes.ComputeRoutesRequest = { origin: originPlaceInstance, destination: destinationPlaceInstance, fields: ['path'], // Request fields needed to draw polylines. }; // [END maps_routes_get_directions_request_placeid] + console.log({ requestWithPlaceIds }); // [START maps_routes_get_directions_request_latlng] // Use lat/lng in a directions request. @@ -59,21 +61,23 @@ async function initMap(): Promise { const destinationLatLng = { lat: 37.774929, lng: -122.419415 }; // Define a computeRoutes request. - const requestWithLatLngs = { + const requestWithLatLngs: google.maps.routes.ComputeRoutesRequest = { origin: originLatLng, destination: destinationLatLng, fields: ['path'], }; // [END maps_routes_get_directions_request_latlng] + console.log({ requestWithLatLngs }); // [START maps_routes_get_directions_request_pluscode] // Use Plus Codes in a directions request. - const requestWithPlusCodes = { + const requestWithPlusCodes: google.maps.routes.ComputeRoutesRequest = { origin: '849VCWC8+R9', // Mountain View, CA destination: 'CRHJ+C3 Stanford, CA 94305, USA', // Stanford, CA fields: ['path'], }; // [END maps_routes_get_directions_request_pluscode] + console.log({ requestWithPlusCodes }); // [START maps_routes_get_directions_request_complete] // [START maps_routes_get_directions_request_simple] @@ -88,8 +92,7 @@ async function initMap(): Promise { // Call computeRoutes to get the directions. // [START maps_routes_get_directions_compute] - const { routes, fallbackInfo, geocodingResults } = - await Route.computeRoutes(request); + const { routes } = await Route.computeRoutes(request); // [END maps_routes_get_directions_compute] // [START maps_routes_get_directions_polyline] diff --git a/samples/routes-markers/index.ts b/samples/routes-markers/index.ts index d3a403bf5..f76eac8e0 100644 --- a/samples/routes-markers/index.ts +++ b/samples/routes-markers/index.ts @@ -61,7 +61,7 @@ async function getDirections() { defaultOptions: google.maps.marker.AdvancedMarkerElementOptions, waypointMarkerDetails: google.maps.routes.WaypointMarkerDetails ) { - const { index, totalMarkers, leg } = waypointMarkerDetails; + const { index, totalMarkers } = waypointMarkerDetails; // Style the origin waypoint. if (index === 0) { @@ -108,10 +108,7 @@ async function getDirections() { return { ...defaultOptions, map: innerMap }; } - const markers = - await result.routes[0].createWaypointAdvancedMarkers( - markerOptionsMaker - ); + await result.routes[0].createWaypointAdvancedMarkers(markerOptionsMaker); // [END maps_routes_markers_style_maker] // Fit the map to the route. diff --git a/samples/streetview-overlays/index.ts b/samples/streetview-overlays/index.ts index e658e224e..64b2f64f8 100644 --- a/samples/streetview-overlays/index.ts +++ b/samples/streetview-overlays/index.ts @@ -10,7 +10,7 @@ let innerMap: google.maps.Map; async function initMap() { // Request needed libraries. - const [{ Map }, { Marker }] = await Promise.all([ + const [, { Marker }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); @@ -36,21 +36,21 @@ async function initMap() { busIcon.src = new URL('./public/bus_icon.svg', import.meta.url).href; // Set up the markers on the map - const cafeMarker = new Marker({ + new Marker({ position: { lat: 40.730031, lng: -73.991428 }, map: innerMap, title: 'Cafe', icon: cafeIcon.src, }); - const bankMarker = new Marker({ + new Marker({ position: { lat: 40.729681, lng: -73.991138 }, map: innerMap, title: 'Bank', icon: dollarIcon.src, }); - const busMarker = new Marker({ + new Marker({ position: { lat: 40.729559, lng: -73.990741 }, map: innerMap, title: 'Bus Stop', diff --git a/samples/test-example/index.ts b/samples/test-example/index.ts index d38863109..f00b5a55f 100644 --- a/samples/test-example/index.ts +++ b/samples/test-example/index.ts @@ -14,13 +14,12 @@ // Declare the gmp-map element. const mapElement = document.querySelector('gmp-map')!; let innerMap; -const advancedMarkerElement = document.querySelector('gmp-advanced-marker')!; let center; async function initMap() { // [START maps_test_example_instantiate_map] // Request the needed libraries. - const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([ + const [, { AdvancedMarkerElement }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('marker'), ]); @@ -37,7 +36,7 @@ async function initMap() { // [START maps_test_example_instantiate_marker] // Add a marker, positioned at Uluru. - const marker = new AdvancedMarkerElement({ + new AdvancedMarkerElement({ map: innerMap, position: center, title: 'Uluru', diff --git a/samples/ui-kit-place-details-compact/index.ts b/samples/ui-kit-place-details-compact/index.ts index a843aa6eb..5653c838f 100644 --- a/samples/ui-kit-place-details-compact/index.ts +++ b/samples/ui-kit-place-details-compact/index.ts @@ -42,7 +42,7 @@ async function initMap(): Promise { infoWindow.open({ anchor: marker }); }; - placeDetails.addEventListener('gmp-load', (event) => { + placeDetails.addEventListener('gmp-load', () => { // For the initial load case, with no user click, we fall back to the place's location, and ensure the map has a center set and the InfoWindow is show. // (The clicked POI LatLng will be a more natural marker position, when available.) if (!map.center && placeDetails.place?.location) { diff --git a/samples/ui-kit-place-details/index.ts b/samples/ui-kit-place-details/index.ts index 17fa4cadc..82f2085c0 100644 --- a/samples/ui-kit-place-details/index.ts +++ b/samples/ui-kit-place-details/index.ts @@ -37,7 +37,7 @@ async function initMap(): Promise { }; // Set up map once widget is loaded. - placeDetails.addEventListener('gmp-load', (event) => { + placeDetails.addEventListener('gmp-load', () => { updateMapAndMarker(); }); diff --git a/samples/ui-kit-place-search-nearby/index.ts b/samples/ui-kit-place-search-nearby/index.ts index 633eff04d..a80c437cc 100644 --- a/samples/ui-kit-place-search-nearby/index.ts +++ b/samples/ui-kit-place-search-nearby/index.ts @@ -25,7 +25,7 @@ let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. async function init(): Promise { // Import the necessary libraries from the Google Maps API. - const [{ InfoWindow }, { Place }] = await Promise.all([ + const [{ InfoWindow }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), ]); diff --git a/samples/ui-kit-place-search-text/index.ts b/samples/ui-kit-place-search-text/index.ts index 9d9f7e91f..638ff8b09 100644 --- a/samples/ui-kit-place-search-text/index.ts +++ b/samples/ui-kit-place-search-text/index.ts @@ -26,7 +26,7 @@ let infoWindow: google.maps.InfoWindow; // The init function is called when the page loads. async function init(): Promise { // Import the necessary libraries from the Google Maps API. - const [{ InfoWindow }, { Place }] = await Promise.all([ + const [{ InfoWindow }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), ]); diff --git a/samples/weather-api-current-compact/index.ts b/samples/weather-api-current-compact/index.ts index 94e5444e7..2cf608d5f 100644 --- a/samples/weather-api-current-compact/index.ts +++ b/samples/weather-api-current-compact/index.ts @@ -319,8 +319,6 @@ const locations = [ ]; async function loadWeatherMarkers(): Promise { - const { AdvancedMarkerElement } = await google.maps.importLibrary('marker'); - for (const location of locations) { await createAndAddMarker(location, 'button'); // Create and add button markers } From a5d773f3c4b635fc5dfb03bbdb9503dccad32b8b Mon Sep 17 00:00:00 2001 From: "Chris J. Shull" Date: Tue, 5 May 2026 22:02:07 -0700 Subject: [PATCH 2/2] reenable @typescript-eslint/require-await @typescript-eslint/no-floating-promises @typescript-eslint/no-misused-promises --- eslint.config.mjs | 17 +++++-- samples/3d-accessibility-features/index.ts | 2 +- samples/3d-camera-boundary/index.ts | 2 +- samples/3d-camera-center/index.ts | 2 +- samples/3d-camera-to-around/index.ts | 2 +- samples/3d-clamp-mode/index.ts | 2 +- samples/3d-coverage-map/index.ts | 2 +- samples/3d-label-toggle/index.ts | 2 +- samples/3d-localization/index.ts | 2 +- samples/3d-map-45-degree/index.ts | 2 +- samples/3d-map-events/index.ts | 2 +- samples/3d-map-roadmap/index.ts | 2 +- samples/3d-map-styling/index.ts | 2 +- samples/3d-marker-click-event/index.ts | 2 +- samples/3d-marker-collision-behavior/index.ts | 2 +- samples/3d-marker-customization/index.ts | 2 +- samples/3d-marker-graphics/index.ts | 2 +- samples/3d-marker-interactive/index.ts | 2 +- samples/3d-mesh-flatten/index.ts | 2 +- samples/3d-model-interactive/index.ts | 2 +- samples/3d-model/index.ts | 2 +- samples/3d-places-autocomplete/index.ts | 6 +-- samples/3d-places/index.ts | 2 +- samples/3d-polygon-click-event/index.ts | 2 +- samples/3d-polygon-extruded-hole/index.ts | 2 +- samples/3d-polygon/index.ts | 2 +- samples/3d-polyline-click-event/index.ts | 2 +- samples/3d-polyline-extruded/index.ts | 2 +- samples/3d-polyline/index.ts | 2 +- samples/3d-popover-location/index.ts | 2 +- samples/3d-popover-marker/index.ts | 2 +- samples/3d-simple-map/index.ts | 2 +- samples/3d-simple-marker/index.ts | 2 +- samples/add-map/index.ts | 2 +- samples/address-validation/index.ts | 2 +- .../advanced-markers-accessibility/index.ts | 2 +- samples/advanced-markers-altitude/index.ts | 2 +- samples/advanced-markers-animation/index.ts | 8 +-- samples/advanced-markers-basic-style/index.ts | 2 +- samples/advanced-markers-collision/index.ts | 2 +- samples/advanced-markers-draggable/index.ts | 2 +- samples/advanced-markers-graphics/index.ts | 2 +- samples/advanced-markers-html-simple/index.ts | 2 +- samples/advanced-markers-html/index.ts | 2 +- samples/advanced-markers-simple/index.ts | 2 +- samples/advanced-markers-zoom/index.ts | 2 +- samples/ai-powered-summaries-basic/index.ts | 4 +- samples/ai-powered-summaries/index.ts | 4 +- samples/boundaries-choropleth/index.ts | 2 +- samples/boundaries-click/index.ts | 4 +- samples/boundaries-simple/index.ts | 2 +- samples/boundaries-text-search/index.ts | 4 +- samples/circle-simple/index.ts | 2 +- samples/control-bounds-restriction/index.ts | 2 +- samples/control-custom-state/index.ts | 2 +- samples/control-disableUI/index.ts | 2 +- samples/control-options/index.ts | 2 +- samples/control-positioning-labels/index.ts | 6 +-- samples/control-positioning/index.ts | 2 +- samples/control-replacement/index.ts | 12 ++--- samples/control-simple/index.ts | 2 +- samples/dds-datasets-point/index.ts | 4 +- samples/dds-datasets-polygon-click/index.ts | 2 +- samples/dds-datasets-polygon-colors/index.ts | 2 +- samples/dds-datasets-polygon/index.ts | 2 +- samples/dds-datasets-polyline/index.ts | 2 +- samples/dds-region-viewer/index.ts | 51 +++++++++---------- samples/deckgl-arclayer/index.ts | 2 +- samples/deckgl-heatmap/index.ts | 4 +- samples/deckgl-kml-updated/index.ts | 2 +- samples/deckgl-kml/index.ts | 2 +- samples/deckgl-points/index.ts | 2 +- samples/deckgl-polygon/index.ts | 2 +- samples/deckgl-tripslayer/index.ts | 2 +- samples/event-arguments/index.ts | 2 +- samples/event-click-latlng/index.ts | 2 +- samples/event-closure/index.ts | 4 +- samples/event-poi/index.ts | 6 +-- samples/event-properties/index.ts | 2 +- samples/event-simple/index.ts | 2 +- .../geocoding-component-restriction/index.ts | 2 +- samples/geocoding-place-id/index.ts | 4 +- samples/geocoding-region-es/index.ts | 2 +- samples/geocoding-region-us/index.ts | 2 +- samples/geocoding-reverse/index.ts | 35 ++++++------- samples/geocoding-simple/index.ts | 45 ++++++++-------- samples/hiding-features/index.ts | 2 +- samples/infowindow-simple/index.ts | 2 +- samples/js-api-loader-map/index.ts | 2 +- samples/layer-data-event/index.ts | 2 +- samples/layer-data-quakes-red/index.ts | 2 +- samples/layer-data-quakes-simple/index.ts | 2 +- samples/layer-data-simple/index.ts | 2 +- samples/layer-data-style/index.ts | 2 +- samples/map-events/index.ts | 2 +- samples/map-projection-simple/index.ts | 4 +- samples/map-simple-js/index.ts | 2 +- samples/map-simple/index.ts | 2 +- samples/place-autocomplete-basic-map/index.ts | 2 +- .../place-autocomplete-data-session/index.ts | 6 +-- .../place-autocomplete-data-simple/index.ts | 2 +- samples/place-autocomplete-element/index.ts | 2 +- samples/place-autocomplete-map/index.ts | 4 +- samples/place-class/index.ts | 4 +- samples/place-nearby-search/index.ts | 6 +-- samples/place-photos/index.ts | 2 +- samples/place-reviews/index.ts | 2 +- samples/place-text-search/index.ts | 10 ++-- .../places-autocomplete-addressform/index.ts | 11 ++-- samples/places-placeid-finder/index.ts | 2 +- samples/polyline-remove/index.ts | 2 +- samples/polyline-simple/index.ts | 2 +- samples/rectangle-event/index.ts | 2 +- samples/routes-compute-routes/index.ts | 4 +- samples/routes-get-alternatives/index.ts | 4 +- samples/routes-get-directions-panel/index.ts | 4 +- samples/routes-get-directions/index.ts | 6 +-- samples/routes-markers/index.ts | 4 +- samples/routes-route-matrix/index.ts | 2 +- samples/streetview-overlays/index.ts | 2 +- samples/test-example/index.ts | 2 +- samples/ui-kit-place-details-compact/index.ts | 6 +-- samples/ui-kit-place-details/index.ts | 4 +- samples/ui-kit-place-search-nearby/index.ts | 8 +-- samples/ui-kit-place-search-text/index.ts | 6 +-- samples/weather-api-current-compact/index.ts | 12 ++--- samples/web-components-events/index.ts | 6 +-- 127 files changed, 258 insertions(+), 253 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index bd9f62beb..8dce23803 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -27,8 +27,8 @@ export default defineConfig([ 'prefer-const': 'error', 'spaced-comment': ['error', 'always'], - // temporarily disabled for historic reasons: - 'no-prototype-builtins': 'off', + // temporarily downgraded to warn for historic reasons: + 'no-prototype-builtins': 'warn', }, }, { @@ -40,12 +40,19 @@ export default defineConfig([ }, }, rules: { + '@typescript-eslint/no-misused-promises': [ + 'error', + { + checksVoidReturn: { + arguments: false, + attributes: false, + }, + }, + ], + // temporarily downgraded to warn for historic reasons: '@typescript-eslint/no-unsafe-member-access': 'warn', '@typescript-eslint/no-unsafe-assignment': 'warn', - '@typescript-eslint/require-await': 'warn', - '@typescript-eslint/no-floating-promises': 'warn', - '@typescript-eslint/no-misused-promises': 'warn', '@typescript-eslint/no-unsafe-call': 'warn', '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-namespace': 'warn', diff --git a/samples/3d-accessibility-features/index.ts b/samples/3d-accessibility-features/index.ts index 8069b74f8..8e4a40cfd 100644 --- a/samples/3d-accessibility-features/index.ts +++ b/samples/3d-accessibility-features/index.ts @@ -82,5 +82,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_accessibility_features] diff --git a/samples/3d-camera-boundary/index.ts b/samples/3d-camera-boundary/index.ts index 14a5e52f1..315668941 100644 --- a/samples/3d-camera-boundary/index.ts +++ b/samples/3d-camera-boundary/index.ts @@ -19,5 +19,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_camera_boundary] diff --git a/samples/3d-camera-center/index.ts b/samples/3d-camera-center/index.ts index 71ed509c0..a3420febd 100644 --- a/samples/3d-camera-center/index.ts +++ b/samples/3d-camera-center/index.ts @@ -36,5 +36,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_3d_camera_center] diff --git a/samples/3d-camera-to-around/index.ts b/samples/3d-camera-to-around/index.ts index 374c7db43..806e36cb1 100644 --- a/samples/3d-camera-to-around/index.ts +++ b/samples/3d-camera-to-around/index.ts @@ -66,5 +66,5 @@ async function init() { }); } -init(); +void init(); // [END maps_3d_camera_to_around] diff --git a/samples/3d-clamp-mode/index.ts b/samples/3d-clamp-mode/index.ts index 207a1ed9e..c5cfb8b4b 100644 --- a/samples/3d-clamp-mode/index.ts +++ b/samples/3d-clamp-mode/index.ts @@ -48,7 +48,7 @@ async function init() { document.body.append(map); } -init(); +void init(); // Dropdown event listener const dropdown = document.getElementById( diff --git a/samples/3d-coverage-map/index.ts b/samples/3d-coverage-map/index.ts index 2eaf70047..64a4765fb 100644 --- a/samples/3d-coverage-map/index.ts +++ b/samples/3d-coverage-map/index.ts @@ -53,5 +53,5 @@ async function initMap() { } ); } -initMap(); +void initMap(); // [END maps_3d_coverage_map] diff --git a/samples/3d-label-toggle/index.ts b/samples/3d-label-toggle/index.ts index 030635c69..87612bb68 100644 --- a/samples/3d-label-toggle/index.ts +++ b/samples/3d-label-toggle/index.ts @@ -41,5 +41,5 @@ async function init() { }); } -init(); +void init(); // [END maps_3d_label_toggle] diff --git a/samples/3d-localization/index.ts b/samples/3d-localization/index.ts index 38cdcd7c0..e9c617ec8 100644 --- a/samples/3d-localization/index.ts +++ b/samples/3d-localization/index.ts @@ -26,5 +26,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_localization] diff --git a/samples/3d-map-45-degree/index.ts b/samples/3d-map-45-degree/index.ts index ce3e4b6e0..3e0c1e8f7 100644 --- a/samples/3d-map-45-degree/index.ts +++ b/samples/3d-map-45-degree/index.ts @@ -21,5 +21,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_45_degree] diff --git a/samples/3d-map-events/index.ts b/samples/3d-map-events/index.ts index 62e3728b0..07eb03ae9 100644 --- a/samples/3d-map-events/index.ts +++ b/samples/3d-map-events/index.ts @@ -25,5 +25,5 @@ async function init() { } } -init(); +void init(); // [END maps_3d_map_events] diff --git a/samples/3d-map-roadmap/index.ts b/samples/3d-map-roadmap/index.ts index bf047baf0..ae13d4405 100644 --- a/samples/3d-map-roadmap/index.ts +++ b/samples/3d-map-roadmap/index.ts @@ -51,5 +51,5 @@ async function init() { document.body.appendChild(controls); } -init(); +void init(); // [END maps_3d_map_roadmap] diff --git a/samples/3d-map-styling/index.ts b/samples/3d-map-styling/index.ts index e0a247270..b2062e87d 100644 --- a/samples/3d-map-styling/index.ts +++ b/samples/3d-map-styling/index.ts @@ -25,5 +25,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_map_styling] diff --git a/samples/3d-marker-click-event/index.ts b/samples/3d-marker-click-event/index.ts index 3631a9771..130129add 100644 --- a/samples/3d-marker-click-event/index.ts +++ b/samples/3d-marker-click-event/index.ts @@ -46,5 +46,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_marker_click_event] diff --git a/samples/3d-marker-collision-behavior/index.ts b/samples/3d-marker-collision-behavior/index.ts index 8594be07d..4e427639f 100644 --- a/samples/3d-marker-collision-behavior/index.ts +++ b/samples/3d-marker-collision-behavior/index.ts @@ -49,7 +49,7 @@ const positions = [ [-122.3378, 47.6095], ]; -init(); +void init(); const dropdown = document.getElementById( 'selectElementId' diff --git a/samples/3d-marker-customization/index.ts b/samples/3d-marker-customization/index.ts index e997244f1..78283100c 100644 --- a/samples/3d-marker-customization/index.ts +++ b/samples/3d-marker-customization/index.ts @@ -99,5 +99,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_marker_customization] diff --git a/samples/3d-marker-graphics/index.ts b/samples/3d-marker-graphics/index.ts index 94e07d54a..f33697d50 100644 --- a/samples/3d-marker-graphics/index.ts +++ b/samples/3d-marker-graphics/index.ts @@ -104,5 +104,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_marker_graphics] diff --git a/samples/3d-marker-interactive/index.ts b/samples/3d-marker-interactive/index.ts index ada08dc59..827c32aa1 100644 --- a/samples/3d-marker-interactive/index.ts +++ b/samples/3d-marker-interactive/index.ts @@ -92,5 +92,5 @@ const positions = [ }, ]; -init(); +void init(); // [END maps_3d_marker_interactive] diff --git a/samples/3d-mesh-flatten/index.ts b/samples/3d-mesh-flatten/index.ts index a23f58986..7c265437b 100644 --- a/samples/3d-mesh-flatten/index.ts +++ b/samples/3d-mesh-flatten/index.ts @@ -26,5 +26,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_3d_mesh_flatten] diff --git a/samples/3d-model-interactive/index.ts b/samples/3d-model-interactive/index.ts index fdf89bbb0..1ece3307a 100644 --- a/samples/3d-model-interactive/index.ts +++ b/samples/3d-model-interactive/index.ts @@ -35,5 +35,5 @@ async function init() { map.append(model); } -init(); +void init(); // [END maps_3d_model_interactive] diff --git a/samples/3d-model/index.ts b/samples/3d-model/index.ts index 89943dd69..5cd9d1ccd 100644 --- a/samples/3d-model/index.ts +++ b/samples/3d-model/index.ts @@ -31,5 +31,5 @@ async function init() { map.append(model); } -init(); +void init(); // [END maps_3d_model] diff --git a/samples/3d-places-autocomplete/index.ts b/samples/3d-places-autocomplete/index.ts index 7a142f66c..7d240c1ff 100644 --- a/samples/3d-places-autocomplete/index.ts +++ b/samples/3d-places-autocomplete/index.ts @@ -22,7 +22,7 @@ async function init() { document.body.append(map); - initAutocomplete(); + void initAutocomplete(); } async function initAutocomplete() { @@ -47,7 +47,7 @@ async function initAutocomplete() { window.alert('No viewport for input: ' + place.displayName); return; } - flyToPlace(place); + void flyToPlace(place); } ); } @@ -109,6 +109,6 @@ async function getElevationforPoint(location, place) { return elevation; } -init(); +void init(); // [END maps_3d_places_autocomplete] diff --git a/samples/3d-places/index.ts b/samples/3d-places/index.ts index dc516cb7e..72db50a49 100644 --- a/samples/3d-places/index.ts +++ b/samples/3d-places/index.ts @@ -42,5 +42,5 @@ async function init() { document.getElementById('details')!.style.display = 'block'; }); } -init(); +void init(); // [END maps_3d_places] diff --git a/samples/3d-polygon-click-event/index.ts b/samples/3d-polygon-click-event/index.ts index fe1d07312..0490c310b 100644 --- a/samples/3d-polygon-click-event/index.ts +++ b/samples/3d-polygon-click-event/index.ts @@ -65,5 +65,5 @@ function randomizeHexColor(originalHexColor) { return `#${rHex}${gHex}${bHex}${alpha}`; } -init(); +void init(); // [END maps_3d_polygon_click_event] diff --git a/samples/3d-polygon-extruded-hole/index.ts b/samples/3d-polygon-extruded-hole/index.ts index 130617ab9..66cbfa6c9 100644 --- a/samples/3d-polygon-extruded-hole/index.ts +++ b/samples/3d-polygon-extruded-hole/index.ts @@ -47,5 +47,5 @@ async function init() { document.body.append(map3DElement); } -init(); +void init(); // [END maps_3d_polygon_extruded_hole] diff --git a/samples/3d-polygon/index.ts b/samples/3d-polygon/index.ts index 52db82f7d..a7be3a12e 100644 --- a/samples/3d-polygon/index.ts +++ b/samples/3d-polygon/index.ts @@ -37,5 +37,5 @@ async function init() { document.body.append(map3DElement); } -init(); +void init(); // [END maps_3d_polygon] diff --git a/samples/3d-polyline-click-event/index.ts b/samples/3d-polyline-click-event/index.ts index c71c267dd..c938fe2b5 100644 --- a/samples/3d-polyline-click-event/index.ts +++ b/samples/3d-polyline-click-event/index.ts @@ -51,5 +51,5 @@ async function init() { map.append(polyline); } -init(); +void init(); // [END maps_3d_polyline_click_event] diff --git a/samples/3d-polyline-extruded/index.ts b/samples/3d-polyline-extruded/index.ts index 981b9a780..7f9898d75 100644 --- a/samples/3d-polyline-extruded/index.ts +++ b/samples/3d-polyline-extruded/index.ts @@ -44,5 +44,5 @@ async function init() { map.append(polyline); } -init(); +void init(); // [END maps_3d_polyline_extruded] diff --git a/samples/3d-polyline/index.ts b/samples/3d-polyline/index.ts index 2f4f2eb74..c8bf83543 100644 --- a/samples/3d-polyline/index.ts +++ b/samples/3d-polyline/index.ts @@ -46,5 +46,5 @@ async function init() { map.append(polyline); } -init(); +void init(); // [END maps_3d_polyline] diff --git a/samples/3d-popover-location/index.ts b/samples/3d-popover-location/index.ts index 1f643ec0a..d23f2fa61 100644 --- a/samples/3d-popover-location/index.ts +++ b/samples/3d-popover-location/index.ts @@ -31,5 +31,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_popover_location] diff --git a/samples/3d-popover-marker/index.ts b/samples/3d-popover-marker/index.ts index da2ee1b09..2210debae 100644 --- a/samples/3d-popover-marker/index.ts +++ b/samples/3d-popover-marker/index.ts @@ -42,5 +42,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_popover_marker] diff --git a/samples/3d-simple-map/index.ts b/samples/3d-simple-map/index.ts index 824a9969d..ff51750fc 100644 --- a/samples/3d-simple-map/index.ts +++ b/samples/3d-simple-map/index.ts @@ -18,5 +18,5 @@ async function initMap() { document.body.append(map); } -initMap(); +void initMap(); // [END maps_3d_simple_map] diff --git a/samples/3d-simple-marker/index.ts b/samples/3d-simple-marker/index.ts index 0c7fc0566..be072caa6 100644 --- a/samples/3d-simple-marker/index.ts +++ b/samples/3d-simple-marker/index.ts @@ -28,5 +28,5 @@ async function init() { document.body.append(map); } -init(); +void init(); // [END maps_3d_simple_marker] diff --git a/samples/add-map/index.ts b/samples/add-map/index.ts index d718e4144..bd94e550e 100644 --- a/samples/add-map/index.ts +++ b/samples/add-map/index.ts @@ -37,5 +37,5 @@ async function initMap(): Promise { }); // [END maps_add_map_instantiate_marker] } -initMap(); +void initMap(); // [END maps_add_map] diff --git a/samples/address-validation/index.ts b/samples/address-validation/index.ts index 05c4ef9b3..851084b4e 100644 --- a/samples/address-validation/index.ts +++ b/samples/address-validation/index.ts @@ -210,5 +210,5 @@ function populateAddressFields(exampleAddress) { console.log('Populated fields with example: ', exampleAddress); } -init(); +void init(); // [END maps_address_validation] diff --git a/samples/advanced-markers-accessibility/index.ts b/samples/advanced-markers-accessibility/index.ts index c29af25da..6b0c287f5 100644 --- a/samples/advanced-markers-accessibility/index.ts +++ b/samples/advanced-markers-accessibility/index.ts @@ -70,5 +70,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_advanced_markers_accessibility] diff --git a/samples/advanced-markers-altitude/index.ts b/samples/advanced-markers-altitude/index.ts index a49048182..c70d9996b 100644 --- a/samples/advanced-markers-altitude/index.ts +++ b/samples/advanced-markers-altitude/index.ts @@ -41,5 +41,5 @@ async function initMap() { // [END maps_advanced_markers_altitude_marker] } -initMap(); +void initMap(); // [END maps_advanced_markers_altitude] diff --git a/samples/advanced-markers-animation/index.ts b/samples/advanced-markers-animation/index.ts index 2a3e9fb59..91a3dd295 100644 --- a/samples/advanced-markers-animation/index.ts +++ b/samples/advanced-markers-animation/index.ts @@ -43,7 +43,7 @@ const intersectionObserver = new IntersectionObserver((entries) => { async function initMap(): Promise { // Request needed libraries. const [ - , + { Map }, { event, ControlPosition }, { AdvancedMarkerElement, PinElement }, ] = await Promise.all([ @@ -74,7 +74,7 @@ async function initMap(): Promise { controlUI.classList.add('ui-button'); controlUI.innerText = 'Reset the example'; controlUI.addEventListener('click', () => { - // Reset the example by reloading the map iframe. + // Reset the example by recreating the map. refreshMap(); }); controlDiv.appendChild(controlUI); @@ -108,8 +108,8 @@ function refreshMap() { const mapDiv = document.createElement('div'); mapDiv.id = 'map'; mapContainer!.appendChild(mapDiv); - initMap(); + void initMap(); } -initMap(); +void initMap(); // [END maps_advanced_markers_animation] diff --git a/samples/advanced-markers-basic-style/index.ts b/samples/advanced-markers-basic-style/index.ts index a11ffd3cc..042e9634e 100644 --- a/samples/advanced-markers-basic-style/index.ts +++ b/samples/advanced-markers-basic-style/index.ts @@ -98,5 +98,5 @@ async function initMap() { // [END maps_advanced_markers_basic_style_hide_glyph] } -initMap(); +void initMap(); // [END maps_advanced_markers_basic_style] diff --git a/samples/advanced-markers-collision/index.ts b/samples/advanced-markers-collision/index.ts index b127a17f7..86e2ef1a1 100644 --- a/samples/advanced-markers-collision/index.ts +++ b/samples/advanced-markers-collision/index.ts @@ -63,5 +63,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_advanced_markers_collision] diff --git a/samples/advanced-markers-draggable/index.ts b/samples/advanced-markers-draggable/index.ts index 896d71d5e..11724e200 100644 --- a/samples/advanced-markers-draggable/index.ts +++ b/samples/advanced-markers-draggable/index.ts @@ -33,5 +33,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_advanced_markers_draggable] diff --git a/samples/advanced-markers-graphics/index.ts b/samples/advanced-markers-graphics/index.ts index 03e24d8d8..b4f0b2840 100644 --- a/samples/advanced-markers-graphics/index.ts +++ b/samples/advanced-markers-graphics/index.ts @@ -98,5 +98,5 @@ async function initMap() { // [END maps_advanced_markers_graphics_place_icon] } -initMap(); +void initMap(); // [END maps_advanced_markers_graphics] diff --git a/samples/advanced-markers-html-simple/index.ts b/samples/advanced-markers-html-simple/index.ts index ae6376442..c0a4d6629 100644 --- a/samples/advanced-markers-html-simple/index.ts +++ b/samples/advanced-markers-html-simple/index.ts @@ -26,5 +26,5 @@ async function initMap() { mapElement.append(marker); } // [END maps_advanced_markers_html_simple_snippet] -initMap(); +void initMap(); // [END maps_advanced_markers_html_simple] diff --git a/samples/advanced-markers-html/index.ts b/samples/advanced-markers-html/index.ts index bea04d05d..0f3bc1537 100644 --- a/samples/advanced-markers-html/index.ts +++ b/samples/advanced-markers-html/index.ts @@ -211,5 +211,5 @@ const properties = [ }, ]; -initMap(); +void initMap(); // [END maps_advanced_markers_html] diff --git a/samples/advanced-markers-simple/index.ts b/samples/advanced-markers-simple/index.ts index 876e4b399..4eba2456f 100644 --- a/samples/advanced-markers-simple/index.ts +++ b/samples/advanced-markers-simple/index.ts @@ -21,5 +21,5 @@ async function initMap() { mapElement.append(marker); } // [END maps_advanced_markers_simple_snippet] -initMap(); +void initMap(); // [END maps_advanced_markers_simple] diff --git a/samples/advanced-markers-zoom/index.ts b/samples/advanced-markers-zoom/index.ts index f14472e7f..8dba1cdd2 100644 --- a/samples/advanced-markers-zoom/index.ts +++ b/samples/advanced-markers-zoom/index.ts @@ -55,5 +55,5 @@ async function initMap() { // [END maps_advanced_markers_zoom_listener] } -initMap(); +void initMap(); // [END maps_advanced_markers_zoom] diff --git a/samples/ai-powered-summaries-basic/index.ts b/samples/ai-powered-summaries-basic/index.ts index b7b953c64..b81e10760 100644 --- a/samples/ai-powered-summaries-basic/index.ts +++ b/samples/ai-powered-summaries-basic/index.ts @@ -18,7 +18,7 @@ async function initMap() { }); infoWindow = new InfoWindow(); - getPlaceDetails(); + void getPlaceDetails(); } async function getPlaceDetails() { @@ -101,5 +101,5 @@ function showInfoWindow(marker, place, content) { }); } -initMap(); +void initMap(); // [END maps_ai_powered_summaries_basic] diff --git a/samples/ai-powered-summaries/index.ts b/samples/ai-powered-summaries/index.ts index 4ec70adf6..bbd79b4f7 100644 --- a/samples/ai-powered-summaries/index.ts +++ b/samples/ai-powered-summaries/index.ts @@ -38,7 +38,7 @@ async function initMap(): Promise { }); // Bind autocomplete bounds to map bounds. - innerMap.addListener('bounds_changed', async () => { + innerMap.addListener('bounds_changed', () => { placeAutocomplete.locationRestriction = innerMap.getBounds(); }); @@ -239,5 +239,5 @@ function updateSummaryPanel(place: google.maps.places.Place) { } } -initMap(); +void initMap(); // [END maps_ai_powered_summaries] diff --git a/samples/boundaries-choropleth/index.ts b/samples/boundaries-choropleth/index.ts index 73c07b4fa..c3f8a193a 100644 --- a/samples/boundaries-choropleth/index.ts +++ b/samples/boundaries-choropleth/index.ts @@ -102,5 +102,5 @@ async function initMap() { }; } -initMap(); +void initMap(); // [END maps_boundaries_choropleth] diff --git a/samples/boundaries-click/index.ts b/samples/boundaries-click/index.ts index e07dfd037..b6803614f 100644 --- a/samples/boundaries-click/index.ts +++ b/samples/boundaries-click/index.ts @@ -16,7 +16,7 @@ function handleClick(e) { lastClickedFeatureIds = e.features.map((f) => f.placeId); lastInteractedFeatureIds = []; featureLayer.style = applyStyle; - createInfoWindow(e); + void createInfoWindow(e); } function handleMouseMove(e) { @@ -141,5 +141,5 @@ function updateInfoWindow(content, center) { }); } -initMap(); +void initMap(); // [END maps_boundaries_click_event] diff --git a/samples/boundaries-simple/index.ts b/samples/boundaries-simple/index.ts index c706a209d..53893af36 100644 --- a/samples/boundaries-simple/index.ts +++ b/samples/boundaries-simple/index.ts @@ -47,5 +47,5 @@ async function initMap() { // [END maps_boundaries_simple_style_single] } -initMap(); +void initMap(); // [END maps_boundaries_simple] diff --git a/samples/boundaries-text-search/index.ts b/samples/boundaries-text-search/index.ts index 22419aebe..182f51e25 100644 --- a/samples/boundaries-text-search/index.ts +++ b/samples/boundaries-text-search/index.ts @@ -24,7 +24,7 @@ async function initMap() { // Get the LOCALITY feature layer. featureLayer = innerMap.getFeatureLayer('LOCALITY'); - findBoundary(); + void findBoundary(); } // [START maps_boundaries_text_search_find_region] async function findBoundary() { @@ -65,5 +65,5 @@ function styleBoundary(placeid) { }; } // [END maps_boundaries_text_search_find_region] -initMap(); +void initMap(); // [END maps_boundaries_text_search] diff --git a/samples/circle-simple/index.ts b/samples/circle-simple/index.ts index 1fca9d80f..f3a8cbbf4 100644 --- a/samples/circle-simple/index.ts +++ b/samples/circle-simple/index.ts @@ -91,5 +91,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_circle_simple] diff --git a/samples/control-bounds-restriction/index.ts b/samples/control-bounds-restriction/index.ts index 022010a08..3fe474b6c 100644 --- a/samples/control-bounds-restriction/index.ts +++ b/samples/control-bounds-restriction/index.ts @@ -33,5 +33,5 @@ async function initMap() { // [END maps_control_bounds_restriction_options] } -initMap(); +void initMap(); // [END maps_control_bounds_restriction] diff --git a/samples/control-custom-state/index.ts b/samples/control-custom-state/index.ts index 56c56ff9a..a5c7030e7 100755 --- a/samples/control-custom-state/index.ts +++ b/samples/control-custom-state/index.ts @@ -43,5 +43,5 @@ async function initMap() { // [END maps_control_custom_state_event_listeners] } -initMap(); +void initMap(); // [END maps_control_custom_state] diff --git a/samples/control-disableUI/index.ts b/samples/control-disableUI/index.ts index c9976f6d3..08d12753b 100644 --- a/samples/control-disableUI/index.ts +++ b/samples/control-disableUI/index.ts @@ -21,5 +21,5 @@ async function initMap() { // [END maps_control_disableUI_options] } -initMap(); +void initMap(); // [END maps_control_disableUI] diff --git a/samples/control-options/index.ts b/samples/control-options/index.ts index 03b2a88e9..d38d8fd31 100755 --- a/samples/control-options/index.ts +++ b/samples/control-options/index.ts @@ -32,5 +32,5 @@ async function initMap() { // [END maps_control_options_change_default] } -initMap(); +void initMap(); // [END maps_control_options] diff --git a/samples/control-positioning-labels/index.ts b/samples/control-positioning-labels/index.ts index 6c60097b5..2de6f36e8 100644 --- a/samples/control-positioning-labels/index.ts +++ b/samples/control-positioning-labels/index.ts @@ -13,7 +13,7 @@ * MakeControl adds a control to the map. * This constructor takes the controlDIV name and label text as arguments. */ -async function MakeControl(controlDiv: HTMLElement, label: string) { +function MakeControl(controlDiv: HTMLElement, label: string) { // Set up the control border. const controlUI = document.createElement('div'); @@ -72,7 +72,7 @@ async function initMap() { /** * Toggles the 'dir' attribute on the html element between 'ltr' and 'rtl'. */ -async function toggleRTL() { +function toggleRTL() { const html = document.documentElement; if (html.dir === 'rtl') { html.dir = 'ltr'; @@ -81,5 +81,5 @@ async function toggleRTL() { } } -initMap(); +void initMap(); // [END maps_control_positioning_labels] diff --git a/samples/control-positioning/index.ts b/samples/control-positioning/index.ts index cc4761200..6796ad91b 100755 --- a/samples/control-positioning/index.ts +++ b/samples/control-positioning/index.ts @@ -38,5 +38,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_control_positioning] diff --git a/samples/control-replacement/index.ts b/samples/control-replacement/index.ts index 4b367b6f7..f6bff76c2 100644 --- a/samples/control-replacement/index.ts +++ b/samples/control-replacement/index.ts @@ -37,7 +37,7 @@ function initZoomControl(map: google.maps.Map) { }); } -async function initMapTypeControl(innerMap: google.maps.Map) { +function initMapTypeControl(innerMap: google.maps.Map) { const mapTypeControlDiv = document.querySelector('.maptype-control')!; const btnMap = document.querySelector('.maptype-control-map')!; const btnSatellite = document.querySelector('.maptype-control-satellite')!; @@ -55,7 +55,7 @@ async function initMapTypeControl(innerMap: google.maps.Map) { }); } -async function initFullscreenControl() { +function initFullscreenControl() { // Get the UI elements for the fullscreen control. const btnFullscreen = document.querySelector('#fullscreen-button')!; @@ -64,17 +64,17 @@ async function initFullscreenControl() { }); } -async function toggleFullScreen(element: google.maps.MapElement) { +function toggleFullScreen(element: google.maps.MapElement) { const fullScreenIcon = document.querySelector( '#fullscreen-button .material-icons' )!; try { if (!document.fullscreenElement) { - element.requestFullscreen(); + void element.requestFullscreen(); fullScreenIcon.innerText = 'fullscreen_exit'; } else { - document.exitFullscreen(); + void document.exitFullscreen(); fullScreenIcon.innerText = 'fullscreen'; } } catch (error) { @@ -82,5 +82,5 @@ async function toggleFullScreen(element: google.maps.MapElement) { } } -initMap(); +void initMap(); // [END maps_control_replacement] diff --git a/samples/control-simple/index.ts b/samples/control-simple/index.ts index 30a2c398b..194f4c804 100644 --- a/samples/control-simple/index.ts +++ b/samples/control-simple/index.ts @@ -20,5 +20,5 @@ async function initMap() { }); // [END maps_control_simple_options] } -initMap(); +void initMap(); // [END maps_control_simple] diff --git a/samples/dds-datasets-point/index.ts b/samples/dds-datasets-point/index.ts index eb65962b2..1e944c095 100644 --- a/samples/dds-datasets-point/index.ts +++ b/samples/dds-datasets-point/index.ts @@ -106,7 +106,7 @@ async function initMap() { } // Creates a legend for the map. -async function makeLegend() { +function makeLegend() { const colors = { black: ['black'], cinnamon: ['#8b0000'], @@ -146,5 +146,5 @@ async function makeLegend() { } } -initMap(); +void initMap(); // [END maps_dds_datasets_point] diff --git a/samples/dds-datasets-polygon-click/index.ts b/samples/dds-datasets-polygon-click/index.ts index 96f0bed10..06cc87a5a 100644 --- a/samples/dds-datasets-polygon-click/index.ts +++ b/samples/dds-datasets-polygon-click/index.ts @@ -105,5 +105,5 @@ function applyStyle(params) { } // [END maps_dds_datasets_polygon_click_stylefunction] -initMap(); +void initMap(); // [END maps_dds_datasets_polygon_click] diff --git a/samples/dds-datasets-polygon-colors/index.ts b/samples/dds-datasets-polygon-colors/index.ts index 7e35ced96..6453f787d 100644 --- a/samples/dds-datasets-polygon-colors/index.ts +++ b/samples/dds-datasets-polygon-colors/index.ts @@ -58,5 +58,5 @@ async function initMap() { datasetLayer.style = setStyle; } -initMap(); +void initMap(); // [END maps_dds_datasets_polygon_colors] diff --git a/samples/dds-datasets-polygon/index.ts b/samples/dds-datasets-polygon/index.ts index 85e6e7588..4549a40e6 100644 --- a/samples/dds-datasets-polygon/index.ts +++ b/samples/dds-datasets-polygon/index.ts @@ -33,5 +33,5 @@ async function initMap() { // [END maps_dds_datasets_polygon_featurelayer] } -initMap(); +void initMap(); // [END maps_dds_datasets_polygon] diff --git a/samples/dds-datasets-polyline/index.ts b/samples/dds-datasets-polyline/index.ts index 112cc8a4d..1f1f7b436 100644 --- a/samples/dds-datasets-polyline/index.ts +++ b/samples/dds-datasets-polyline/index.ts @@ -24,5 +24,5 @@ async function initMap() { // [END maps_dds_datasets_polyline_style_function] } -initMap(); +void initMap(); // [END maps_dds_datasets_polyline] diff --git a/samples/dds-region-viewer/index.ts b/samples/dds-region-viewer/index.ts index caf8730d5..013a69d28 100644 --- a/samples/dds-region-viewer/index.ts +++ b/samples/dds-region-viewer/index.ts @@ -86,30 +86,27 @@ async function initMap() { }); // Handle autocomplete widget selection. - placeAutocomplete.addEventListener( - 'gmp-select', - async ({ placePrediction }) => { - const types = placePrediction.types as string[]; - - // Find the first type that matches a feature menu option. - const validFeatureTypes = [ - 'country', - 'administrative_area_level_1', - 'administrative_area_level_2', - 'locality', - 'postal_code', - 'school_district', - ]; - for (const type of types) { - if (validFeatureTypes.includes(type)) { - featureMenu.value = type; // Set the menu value directly - break; // Use the first matching type found - } + placeAutocomplete.addEventListener('gmp-select', ({ placePrediction }) => { + const types = placePrediction.types as string[]; + + // Find the first type that matches a feature menu option. + const validFeatureTypes = [ + 'country', + 'administrative_area_level_1', + 'administrative_area_level_2', + 'locality', + 'postal_code', + 'school_district', + ]; + for (const type of types) { + if (validFeatureTypes.includes(type)) { + featureMenu.value = type; // Set the menu value directly + break; // Use the first matching type found } - setFeatureType(); // Update autocomplete filtering based on new menu selection - showSelectedPolygon(placePrediction.placeId, 1); } - ); + setFeatureType(); // Update autocomplete filtering based on new menu selection + void showSelectedPolygon(placePrediction.placeId, 1); + }); // Add all the feature layers. countryLayer = innerMap.getFeatureLayer('COUNTRY'); @@ -294,7 +291,9 @@ function onCountrySelected() { // Set the feature list selection to 'country'. featureMenu.namedItem('country')!.selected = true; - showSelectedCountry(countryMenu.options[countryMenu.selectedIndex].text); + void showSelectedCountry( + countryMenu.options[countryMenu.selectedIndex].text + ); } // Enables or disables items in the feature menu based on country support. @@ -345,7 +344,7 @@ function revertStyles() { function handlePlaceClick(event) { const clickedPlaceId = event.features[0].placeId; if (!clickedPlaceId) return; - showSelectedPolygon(clickedPlaceId, 0); + void showSelectedPolygon(clickedPlaceId, 0); } // Get the place ID for the selected country, then call showSelectedPolygon(). @@ -362,7 +361,7 @@ async function showSelectedCountry(countryName) { const { places } = await Place.searchByText(request); if (places.length > 0) { - showSelectedPolygon(places[0].id, 0); + await showSelectedPolygon(places[0].id, 0); } } @@ -447,5 +446,5 @@ async function showSelectedPolygon(placeid, mode) { applyStyle(placeid); } -initMap(); +void initMap(); // [END maps_dds_region_viewer] diff --git a/samples/deckgl-arclayer/index.ts b/samples/deckgl-arclayer/index.ts index aa909c21f..96a4dc499 100644 --- a/samples/deckgl-arclayer/index.ts +++ b/samples/deckgl-arclayer/index.ts @@ -51,5 +51,5 @@ async function initMap() { overlay.setMap(innerMap); } -initMap(); +void initMap(); // [END maps_deckgl_arclayer] diff --git a/samples/deckgl-heatmap/index.ts b/samples/deckgl-heatmap/index.ts index 31f5a1aec..d8228f67c 100644 --- a/samples/deckgl-heatmap/index.ts +++ b/samples/deckgl-heatmap/index.ts @@ -137,7 +137,7 @@ async function initMap(): Promise { infoWindow = new InfoWindow(); // Add click listener to the map - map.addListener('click', async (event: google.maps.MapMouseEvent) => { + map.addListener('click', (event: google.maps.MapMouseEvent) => { const latLng = event.latLng; if (!latLng) return; // Ensure latLng is not null @@ -200,5 +200,5 @@ async function initMap(): Promise { } } -initMap(); +void initMap(); /* [END maps_deckgl_heatmap] */ diff --git a/samples/deckgl-kml-updated/index.ts b/samples/deckgl-kml-updated/index.ts index a48cbc6ac..3fa2db646 100644 --- a/samples/deckgl-kml-updated/index.ts +++ b/samples/deckgl-kml-updated/index.ts @@ -235,5 +235,5 @@ async function initMap(): Promise { } } -initMap(); +void initMap(); /* [END maps_deckgl_kml_updated] */ diff --git a/samples/deckgl-kml/index.ts b/samples/deckgl-kml/index.ts index d188c9eb3..1400cb906 100644 --- a/samples/deckgl-kml/index.ts +++ b/samples/deckgl-kml/index.ts @@ -221,5 +221,5 @@ function hexOrAabbggrrToRgba(color: string): number[] | null { return null; // Invalid format } -initMap(); +void initMap(); /* [END maps_deckgl_kml] */ diff --git a/samples/deckgl-points/index.ts b/samples/deckgl-points/index.ts index 6b224b54d..6872cc5fd 100644 --- a/samples/deckgl-points/index.ts +++ b/samples/deckgl-points/index.ts @@ -77,5 +77,5 @@ async function initMap() { deckOverlay.setMap(innerMap); } -initMap(); +void initMap(); // [END maps_deckgl_points] diff --git a/samples/deckgl-polygon/index.ts b/samples/deckgl-polygon/index.ts index f49129340..7b9f1efa2 100644 --- a/samples/deckgl-polygon/index.ts +++ b/samples/deckgl-polygon/index.ts @@ -150,5 +150,5 @@ async function initMap(): Promise { } } -initMap(); +void initMap(); /* [END maps_deckgl_polygon] */ diff --git a/samples/deckgl-tripslayer/index.ts b/samples/deckgl-tripslayer/index.ts index fbd98543c..7a5647095 100644 --- a/samples/deckgl-tripslayer/index.ts +++ b/samples/deckgl-tripslayer/index.ts @@ -71,5 +71,5 @@ async function initMap() { overlay.setMap(innerMap); } -initMap(); +void initMap(); // [END maps_deckgl_tripslayer] diff --git a/samples/event-arguments/index.ts b/samples/event-arguments/index.ts index f2d34f4c2..6d9def40b 100644 --- a/samples/event-arguments/index.ts +++ b/samples/event-arguments/index.ts @@ -24,5 +24,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_event_arguments] diff --git a/samples/event-click-latlng/index.ts b/samples/event-click-latlng/index.ts index 17936bccb..d314408f8 100644 --- a/samples/event-click-latlng/index.ts +++ b/samples/event-click-latlng/index.ts @@ -42,5 +42,5 @@ async function initMap() { // [END maps_event_click_latlng_listener] } -initMap(); +void initMap(); // [END maps_event_click_latlng] diff --git a/samples/event-closure/index.ts b/samples/event-closure/index.ts index f70142f53..1670f2180 100644 --- a/samples/event-closure/index.ts +++ b/samples/event-closure/index.ts @@ -42,7 +42,7 @@ async function initMap() { map: innerMap, }); - attachSecretMessage(marker, secretMessages[i]); + void attachSecretMessage(marker, secretMessages[i]); } } @@ -63,5 +63,5 @@ async function attachSecretMessage( }); } -initMap(); +void initMap(); // [END maps_event_closure] diff --git a/samples/event-poi/index.ts b/samples/event-poi/index.ts index aec54b0f6..580ad5569 100644 --- a/samples/event-poi/index.ts +++ b/samples/event-poi/index.ts @@ -9,7 +9,7 @@ let innerMap; async function initMap() { // Request the needed libraries. - google.maps.importLibrary('core'); // preload + void google.maps.importLibrary('core'); // preload const { InfoWindow } = await google.maps.importLibrary('maps'); // Retrieve the map element. @@ -28,7 +28,7 @@ async function initMap() { // If the event has a placeId, show the info window. if (isIconMouseEvent(event) && event.placeId) { - showInfoWindow(event, infoWindow); + void showInfoWindow(event, infoWindow); } else { // Close the info window if there is no placeId. infoWindow.close(); @@ -94,5 +94,5 @@ function isIconMouseEvent( return 'placeId' in e; } -initMap(); +void initMap(); // [END maps_event_poi] diff --git a/samples/event-properties/index.ts b/samples/event-properties/index.ts index 9a427873d..96822d0f9 100644 --- a/samples/event-properties/index.ts +++ b/samples/event-properties/index.ts @@ -24,5 +24,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_event_properties] diff --git a/samples/event-simple/index.ts b/samples/event-simple/index.ts index e7941b3cf..8cdbee2dd 100644 --- a/samples/event-simple/index.ts +++ b/samples/event-simple/index.ts @@ -43,5 +43,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_event_simple] diff --git a/samples/geocoding-component-restriction/index.ts b/samples/geocoding-component-restriction/index.ts index 1ac4fb1b4..3ef85a4fb 100644 --- a/samples/geocoding-component-restriction/index.ts +++ b/samples/geocoding-component-restriction/index.ts @@ -33,5 +33,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_geocoding_component_restriction] diff --git a/samples/geocoding-place-id/index.ts b/samples/geocoding-place-id/index.ts index 4ca251242..852bbbc20 100644 --- a/samples/geocoding-place-id/index.ts +++ b/samples/geocoding-place-id/index.ts @@ -18,7 +18,7 @@ async function initMap(): Promise { const infoWindow = new InfoWindow(); document.getElementById('submit')!.addEventListener('click', () => { - geocodePlaceId(geocoder, innerMap, infoWindow); + void geocodePlaceId(geocoder, innerMap, infoWindow); }); } @@ -50,5 +50,5 @@ async function geocodePlaceId( } } -initMap(); +void initMap(); // [END maps_geocoding_place_id] diff --git a/samples/geocoding-region-es/index.ts b/samples/geocoding-region-es/index.ts index 6d6128942..ecba8adc5 100644 --- a/samples/geocoding-region-es/index.ts +++ b/samples/geocoding-region-es/index.ts @@ -34,5 +34,5 @@ async function initMap(): Promise { ); } -initMap(); +void initMap(); // [END maps_js_geocoding_region_es] diff --git a/samples/geocoding-region-us/index.ts b/samples/geocoding-region-us/index.ts index 21e36cdbe..7a385e7e7 100644 --- a/samples/geocoding-region-us/index.ts +++ b/samples/geocoding-region-us/index.ts @@ -34,5 +34,5 @@ async function initMap(): Promise { ); } -initMap(); +void initMap(); // [END maps_js_geocoding_region_us] diff --git a/samples/geocoding-reverse/index.ts b/samples/geocoding-reverse/index.ts index 6f81e797e..f311b9417 100644 --- a/samples/geocoding-reverse/index.ts +++ b/samples/geocoding-reverse/index.ts @@ -46,17 +46,17 @@ async function initMap() { // Add a click event listener to the submit button. submitButton.addEventListener('click', () => { - geocodeLatLng(geocoder, innerMap, infoWindow); + void geocodeLatLng(geocoder, innerMap, infoWindow); }); // Add a click event listener to the map. innerMap.addListener('click', (event) => { latLngQuery.value = `${event.latLng.lat()}, ${event.latLng.lng()}`; - geocodeLatLng(geocoder, innerMap, infoWindow); + void geocodeLatLng(geocoder, innerMap, infoWindow); }); // Make an initial request upon loading. - geocodeLatLng(geocoder, innerMap, infoWindow); + void geocodeLatLng(geocoder, innerMap, infoWindow); } async function geocodeLatLng( @@ -71,20 +71,21 @@ async function geocodeLatLng( lng: parseFloat(latlngStr[1]), }; - geocoder - .geocode({ location: latlng }) - .then((response) => { - if (response.results[0]) { - marker.position = latlng; - map.setCenter(latlng); - infoWindow.setContent(response.results[0].formatted_address); - infoWindow.open(map, marker); - } else { - window.alert('No results found'); - } - }) - .catch((e) => window.alert('Geocoder failed due to: ' + e)); + try { + const { results } = await geocoder.geocode({ location: latlng }); + + if (results[0]) { + marker.position = latlng; + map.setCenter(latlng); + infoWindow.setContent(results[0].formatted_address); + infoWindow.open(map, marker); + } else { + window.alert('No results found'); + } + } catch (e) { + window.alert('Geocoder failed due to: ' + String(e)); + } } -initMap(); +void initMap(); // [END maps_geocoding_reverse] diff --git a/samples/geocoding-simple/index.ts b/samples/geocoding-simple/index.ts index b9b5174e7..9c2237ff3 100644 --- a/samples/geocoding-simple/index.ts +++ b/samples/geocoding-simple/index.ts @@ -10,7 +10,7 @@ let mapElement; let innerMap; let marker; let responseDiv; -let response; +let responsePre; async function initMap() { // Request the needed libraries. @@ -46,17 +46,17 @@ async function initMap() { responseDiv = document.getElementById( 'response-container' ) as HTMLDivElement; - response = document.getElementById('response') as HTMLPreElement; + responsePre = document.getElementById('response') as HTMLPreElement; marker = new AdvancedMarkerElement({}); innerMap.addListener('click', (e: google.maps.MapMouseEvent) => { - geocode({ location: e.latLng }); + void geocode({ location: e.latLng }); }); - submitButton.addEventListener('click', () => - geocode({ address: inputText.value }) - ); + submitButton.addEventListener('click', () => { + void geocode({ address: inputText.value }); + }); clearButton.addEventListener('click', () => { clear(); @@ -65,7 +65,7 @@ async function initMap() { clear(); } -async function clear() { +function clear() { marker.setMap(null); responseDiv.style.display = 'none'; } @@ -75,22 +75,23 @@ async function geocode(request: google.maps.GeocoderRequest) { clear(); const { LatLng } = await google.maps.importLibrary('core'); - geocoder - .geocode(request) - .then((result) => { - const { results } = result; - innerMap.setCenter(results[0].geometry.location); - marker.position = new LatLng(results[0].geometry.location); - mapElement.append(marker); - responseDiv.style.display = 'block'; - response.innerText = JSON.stringify(result, null, 2); - return results; - }) - .catch((e) => { - alert('Geocode was not successful for the following reason: ' + e); - }); + try { + const response = await geocoder.geocode(request); + const { results } = response; + + innerMap.setCenter(results[0].geometry.location); + marker.position = new LatLng(results[0].geometry.location); + mapElement.append(marker); + responseDiv.style.display = 'block'; + responsePre.innerText = JSON.stringify(response, null, 2); + return results; + } catch (e) { + alert( + 'Geocode was not successful for the following reason: ' + String(e) + ); + } } // [END maps_geocoding_simple_request] -initMap(); +void initMap(); // [END maps_geocoding_simple] diff --git a/samples/hiding-features/index.ts b/samples/hiding-features/index.ts index a831cb12e..760005688 100644 --- a/samples/hiding-features/index.ts +++ b/samples/hiding-features/index.ts @@ -51,5 +51,5 @@ const styles: Record = { ], }; -initMap(); +void initMap(); // [END maps_hiding_features] diff --git a/samples/infowindow-simple/index.ts b/samples/infowindow-simple/index.ts index 778f9b2b4..d2cfd0ce0 100644 --- a/samples/infowindow-simple/index.ts +++ b/samples/infowindow-simple/index.ts @@ -77,5 +77,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_infowindow_simple] diff --git a/samples/js-api-loader-map/index.ts b/samples/js-api-loader-map/index.ts index 55211f267..265aeea49 100644 --- a/samples/js-api-loader-map/index.ts +++ b/samples/js-api-loader-map/index.ts @@ -33,5 +33,5 @@ async function initMap(): Promise { new Map(document.getElementById('map') as HTMLElement, mapOptions); } -initMap(); +void initMap(); // [END maps_js_api_loader_map] diff --git a/samples/layer-data-event/index.ts b/samples/layer-data-event/index.ts index a8e188f52..d677825c0 100644 --- a/samples/layer-data-event/index.ts +++ b/samples/layer-data-event/index.ts @@ -32,5 +32,5 @@ async function initMap() { // [END maps_layer_data_event_snippet] } -initMap(); +void initMap(); // [END maps_layer_data_event] diff --git a/samples/layer-data-quakes-red/index.ts b/samples/layer-data-quakes-red/index.ts index f6e658ff3..c8960a5a6 100644 --- a/samples/layer-data-quakes-red/index.ts +++ b/samples/layer-data-quakes-red/index.ts @@ -48,5 +48,5 @@ function earthquakeDataLoad(data: any) { } window.earthquakeDataLoad = earthquakeDataLoad; -initMap(); +void initMap(); // [END maps_layer_data_quakes_red] diff --git a/samples/layer-data-quakes-simple/index.ts b/samples/layer-data-quakes-simple/index.ts index dce819ce7..f7271ac0d 100644 --- a/samples/layer-data-quakes-simple/index.ts +++ b/samples/layer-data-quakes-simple/index.ts @@ -30,5 +30,5 @@ function earthquakeDataLoad(data: any) { } window.earthquakeDataLoad = earthquakeDataLoad; -initMap(); +void initMap(); // [END maps_layer_data_quakes_simple] diff --git a/samples/layer-data-simple/index.ts b/samples/layer-data-simple/index.ts index cd10f3088..e4858288f 100644 --- a/samples/layer-data-simple/index.ts +++ b/samples/layer-data-simple/index.ts @@ -15,5 +15,5 @@ async function initMap() { innerMap.data.loadGeoJson('google.json'); } -initMap(); +void initMap(); // [END maps_layer_data_simple] diff --git a/samples/layer-data-style/index.ts b/samples/layer-data-style/index.ts index 2178fe34f..bf43c6ff4 100644 --- a/samples/layer-data-style/index.ts +++ b/samples/layer-data-style/index.ts @@ -31,5 +31,5 @@ async function initMap() { // [END maps_layer_data_style_script_snippet_style] } -initMap(); +void initMap(); // [END maps_layer_data_style] diff --git a/samples/map-events/index.ts b/samples/map-events/index.ts index bc55c0db3..5f86f1d69 100644 --- a/samples/map-events/index.ts +++ b/samples/map-events/index.ts @@ -70,5 +70,5 @@ function populateTable() { } } -initMap(); +void initMap(); // [END maps_map_events] diff --git a/samples/map-projection-simple/index.ts b/samples/map-projection-simple/index.ts index 4ad9578bc..386d5918a 100644 --- a/samples/map-projection-simple/index.ts +++ b/samples/map-projection-simple/index.ts @@ -22,7 +22,7 @@ async function initMap() { }); // Set the Gall-Peters map type. - initGallPeters(); + void initGallPeters(); innerMap.mapTypes.set('gallPeters', gallPetersMapType); innerMap.setMapTypeId('gallPeters'); @@ -149,5 +149,5 @@ const cities = { ], }; -initMap(); +void initMap(); // [END maps_map_projection_simple] diff --git a/samples/map-simple-js/index.ts b/samples/map-simple-js/index.ts index 73621d468..2a3cadac8 100644 --- a/samples/map-simple-js/index.ts +++ b/samples/map-simple-js/index.ts @@ -26,5 +26,5 @@ async function initMap(): Promise { console.log(map); } -initMap(); +void initMap(); // [END maps_map_simple_js] diff --git a/samples/map-simple/index.ts b/samples/map-simple/index.ts index 2fd579c5a..c3da1372a 100644 --- a/samples/map-simple/index.ts +++ b/samples/map-simple/index.ts @@ -17,5 +17,5 @@ async function initMap(): Promise { console.log({ mapElement, innerMap }); } -initMap(); +void initMap(); // [END maps_map_simple] diff --git a/samples/place-autocomplete-basic-map/index.ts b/samples/place-autocomplete-basic-map/index.ts index 3667791d5..952d32ec9 100644 --- a/samples/place-autocomplete-basic-map/index.ts +++ b/samples/place-autocomplete-basic-map/index.ts @@ -106,5 +106,5 @@ async function initMap(): Promise { }); } -initMap(); +void initMap(); // [END maps_place_autocomplete_basic_map] diff --git a/samples/place-autocomplete-data-session/index.ts b/samples/place-autocomplete-data-session/index.ts index ff4e0084f..0e3f8b654 100644 --- a/samples/place-autocomplete-data-session/index.ts +++ b/samples/place-autocomplete-data-session/index.ts @@ -35,7 +35,7 @@ async function init() { }); // Update request center and bounds when the map bounds change. - innerMap.addListener('bounds_changed', async () => { + innerMap.addListener('bounds_changed', () => { request.locationRestriction = innerMap.getBounds(); request.origin = innerMap.getCenter(); }); @@ -82,7 +82,7 @@ async function makeAutocompleteRequest(inputEvent) { // We are using a button element to take advantage of its a11y capabilities. const placeButton = document.createElement('button'); placeButton.addEventListener('click', () => { - onPlaceSelected(placePrediction.toPlace()); + void onPlaceSelected(placePrediction.toPlace()); }); // eslint-disable-next-line @typescript-eslint/no-base-to-string placeButton.textContent = placePrediction.text.toString(); @@ -141,5 +141,5 @@ async function refreshToken() { tokenStatusElement.textContent = `Session token count: ${tokenCount}`; } -init(); +void init(); // [END maps_place_autocomplete_data_session] diff --git a/samples/place-autocomplete-data-simple/index.ts b/samples/place-autocomplete-data-simple/index.ts index a3b668ba8..0fb30a747 100644 --- a/samples/place-autocomplete-data-simple/index.ts +++ b/samples/place-autocomplete-data-simple/index.ts @@ -75,5 +75,5 @@ async function init() { // [END maps_place_autocomplete_data_simple_prediction] } -init(); +void init(); // [END maps_place_autocomplete_data_simple] diff --git a/samples/place-autocomplete-element/index.ts b/samples/place-autocomplete-element/index.ts index 0b0609187..8cf5abc60 100644 --- a/samples/place-autocomplete-element/index.ts +++ b/samples/place-autocomplete-element/index.ts @@ -45,5 +45,5 @@ async function initMap(): Promise { // [END maps_place_autocomplete_element_listener] } -initMap(); +void initMap(); // [END maps_place_autocomplete_element] diff --git a/samples/place-autocomplete-map/index.ts b/samples/place-autocomplete-map/index.ts index fe06880aa..471f9d9eb 100644 --- a/samples/place-autocomplete-map/index.ts +++ b/samples/place-autocomplete-map/index.ts @@ -25,7 +25,7 @@ async function initMap(): Promise { }); // Use the bounds_changed event to restrict results to the current map bounds. - innerMap.addListener('bounds_changed', async () => { + innerMap.addListener('bounds_changed', () => { placeAutocomplete.locationRestriction = innerMap.getBounds(); }); @@ -81,5 +81,5 @@ function updateInfoWindow(content, center) { }); } -initMap(); +void initMap(); // [END maps_place_autocomplete_map] diff --git a/samples/place-class/index.ts b/samples/place-class/index.ts index b9d81271a..4a6e1bccc 100644 --- a/samples/place-class/index.ts +++ b/samples/place-class/index.ts @@ -14,7 +14,7 @@ async function initMap() { innerMap = mapElement.innerMap; infoWindow = new InfoWindow(); - getPlaceDetails(); + void getPlaceDetails(); } // [START maps_place_class_fetchfields] @@ -71,5 +71,5 @@ async function getPlaceDetails() { } // [END maps_place_class_fetchfields] -initMap(); +void initMap(); // [END maps_place_class] diff --git a/samples/place-nearby-search/index.ts b/samples/place-nearby-search/index.ts index 10285a950..d40c471cb 100644 --- a/samples/place-nearby-search/index.ts +++ b/samples/place-nearby-search/index.ts @@ -25,14 +25,14 @@ async function initMap() { typeSelect = document.querySelector('.type-select')!; typeSelect.addEventListener('change', () => { - nearbySearch(); + void nearbySearch(); }); infoWindow = new InfoWindow(); // Kick off an initial search once map has loaded. event.addListenerOnce(innerMap, 'idle', () => { - nearbySearch(); + void nearbySearch(); }); } @@ -131,5 +131,5 @@ function updateInfoWindow(title, content, anchor) { }); } -initMap(); +void initMap(); // [END maps_place_nearby_search] diff --git a/samples/place-photos/index.ts b/samples/place-photos/index.ts index 96cd3b92a..0ec527b64 100644 --- a/samples/place-photos/index.ts +++ b/samples/place-photos/index.ts @@ -97,5 +97,5 @@ async function init() { } } -init(); +void init(); // [END maps_place_photos] diff --git a/samples/place-reviews/index.ts b/samples/place-reviews/index.ts index 87cd24ae4..b0e54c461 100644 --- a/samples/place-reviews/index.ts +++ b/samples/place-reviews/index.ts @@ -88,5 +88,5 @@ async function initMap() { }); } -initMap(); +void initMap(); // [END maps_place_reviews] diff --git a/samples/place-text-search/index.ts b/samples/place-text-search/index.ts index 4955443a5..5c2ae22e9 100644 --- a/samples/place-text-search/index.ts +++ b/samples/place-text-search/index.ts @@ -31,12 +31,12 @@ async function initMap() { map.controls[ControlPosition.TOP_LEFT].push(card); textInputButton.addEventListener('click', () => { - findPlaces(textInput.value); + void findPlaces(textInput.value); }); textInput.addEventListener('keydown', (event) => { if (event.key === 'Enter') { - findPlaces(textInput.value); + void findPlaces(textInput.value); } }); @@ -86,7 +86,7 @@ async function findPlaces(query) { marker.addListener('gmp-click', () => { map.panTo(place.location); - updateInfoWindow(place.displayName, place.id, marker); + void updateInfoWindow(place.displayName, place.id, marker); }); if (place.location != null) { @@ -101,7 +101,7 @@ async function findPlaces(query) { } // Helper function to create an info window. -async function updateInfoWindow(title, content, anchor) { +function updateInfoWindow(title, content, anchor) { infoWindow.setContent(content); infoWindow.setHeaderContent(title); infoWindow.open({ @@ -111,5 +111,5 @@ async function updateInfoWindow(title, content, anchor) { }); } -initMap(); +void initMap(); // [END maps_place_text_search] diff --git a/samples/places-autocomplete-addressform/index.ts b/samples/places-autocomplete-addressform/index.ts index 1c86783f5..42c0c2e23 100644 --- a/samples/places-autocomplete-addressform/index.ts +++ b/samples/places-autocomplete-addressform/index.ts @@ -28,12 +28,9 @@ async function initAutocomplete() { placeAutocomplete.focus(); // Handle user selection on the autocomplete widget. - placeAutocomplete.addEventListener( - 'gmp-select', - async ({ placePrediction }) => { - fillInAddress(placePrediction); - } - ); + placeAutocomplete.addEventListener('gmp-select', ({ placePrediction }) => { + void fillInAddress(placePrediction); + }); saveButton.addEventListener('click', () => { // Display a message when the Save button is clicked. @@ -105,5 +102,5 @@ async function fillInAddress(placePrediction) { } // [END maps_places_autocomplete_addressform_fillform] -initAutocomplete(); +void initAutocomplete(); // [END maps_places_autocomplete_addressform] diff --git a/samples/places-placeid-finder/index.ts b/samples/places-placeid-finder/index.ts index ae9828ff2..ac6092d85 100644 --- a/samples/places-placeid-finder/index.ts +++ b/samples/places-placeid-finder/index.ts @@ -99,5 +99,5 @@ async function initMap(): Promise { ); } -initMap(); +void initMap(); // [END maps_places_placeid_finder] diff --git a/samples/polyline-remove/index.ts b/samples/polyline-remove/index.ts index 4190602d9..49d3a4e90 100644 --- a/samples/polyline-remove/index.ts +++ b/samples/polyline-remove/index.ts @@ -48,5 +48,5 @@ function removeLine(): void { flightPath.setMap(null); } -initMap(); +void initMap(); // [END maps_polyline_remove] diff --git a/samples/polyline-simple/index.ts b/samples/polyline-simple/index.ts index e69cdee11..3095ebc07 100644 --- a/samples/polyline-simple/index.ts +++ b/samples/polyline-simple/index.ts @@ -32,5 +32,5 @@ async function initMap() { flightPath.setMap(innerMap); } -initMap(); +void initMap(); // [END maps_polyline_simple] diff --git a/samples/rectangle-event/index.ts b/samples/rectangle-event/index.ts index 0673c1b13..ac2b96989 100644 --- a/samples/rectangle-event/index.ts +++ b/samples/rectangle-event/index.ts @@ -67,5 +67,5 @@ function showNewRect() { infoWindow.open(innerMap); } -initMap(); +void initMap(); // [END maps_rectangle_event] diff --git a/samples/routes-compute-routes/index.ts b/samples/routes-compute-routes/index.ts index 6a2ec58c4..6616169b3 100644 --- a/samples/routes-compute-routes/index.ts +++ b/samples/routes-compute-routes/index.ts @@ -51,7 +51,7 @@ async function init() { computeRoutesForm.addEventListener('submit', (event) => { event.preventDefault(); - sendRequest(new FormData(computeRoutesForm)); + void sendRequest(new FormData(computeRoutesForm)); }); } @@ -528,5 +528,5 @@ async function init() { } } -window.addEventListener('load', init); +void init(); // [END maps_routes_compute_routes] diff --git a/samples/routes-get-alternatives/index.ts b/samples/routes-get-alternatives/index.ts index ede4fe92e..2ce50c488 100644 --- a/samples/routes-get-alternatives/index.ts +++ b/samples/routes-get-alternatives/index.ts @@ -24,7 +24,7 @@ async function initMap() { // Call the function after the map is loaded. event.addListenerOnce(innerMap, 'idle', () => { - getDirections(); + void getDirections(); }); } @@ -99,5 +99,5 @@ function drawRoute(route, isPrimaryRoute) { ); } -initMap(); +void initMap(); // [END maps_routes_get_alternatives] diff --git a/samples/routes-get-directions-panel/index.ts b/samples/routes-get-directions-panel/index.ts index db24ced67..d1e6b6307 100644 --- a/samples/routes-get-directions-panel/index.ts +++ b/samples/routes-get-directions-panel/index.ts @@ -51,7 +51,7 @@ async function initMap(): Promise { // Add polylines to the map. mapPolylines.forEach((polyline) => polyline.setMap(map)); - fitMapToPath(routes[0].path!); + void fitMapToPath(routes[0].path!); // Add markers to all the points. await routes[0].createWaypointAdvancedMarkers({ map }); @@ -143,5 +143,5 @@ async function fitMapToPath(path) { map.fitBounds(bounds); } -initMap(); +void initMap(); // [END maps_routes_get_directions_panel] diff --git a/samples/routes-get-directions/index.ts b/samples/routes-get-directions/index.ts index 9feb85486..46e256e6b 100644 --- a/samples/routes-get-directions/index.ts +++ b/samples/routes-get-directions/index.ts @@ -12,7 +12,7 @@ const center = { lat: 37.447646, lng: -122.113878 }; // Palo Alto, CA // Initialize and add the map. async function initMap(): Promise { // Request the needed libraries. - const [{ Map }, , { Route }] = await Promise.all([ + const [{ Map }, { Place }, { Route }] = await Promise.all([ google.maps.importLibrary('maps'), google.maps.importLibrary('places'), google.maps.importLibrary('routes'), @@ -118,7 +118,7 @@ async function initMap(): Promise { console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`); // Fit the map to the path. - fitMapToPath(routes[0].path!); + void fitMapToPath(routes[0].path!); } // Helper function to fit the map to the path. @@ -131,5 +131,5 @@ async function fitMapToPath(path) { map.fitBounds(bounds); } -initMap(); +void initMap(); // [END maps_routes_get_directions] diff --git a/samples/routes-markers/index.ts b/samples/routes-markers/index.ts index f76eac8e0..9bd3535d7 100644 --- a/samples/routes-markers/index.ts +++ b/samples/routes-markers/index.ts @@ -24,7 +24,7 @@ async function initMap() { // Call the function after the map is loaded. event.addListenerOnce(innerMap, 'idle', () => { - getDirections(); + void getDirections(); }); } @@ -120,5 +120,5 @@ async function getDirections() { mapPolylines.forEach((polyline) => polyline.setMap(innerMap)); } -initMap(); +void initMap(); // [END maps_routes_markers] diff --git a/samples/routes-route-matrix/index.ts b/samples/routes-route-matrix/index.ts index aeda4698a..2e8ac2058 100644 --- a/samples/routes-route-matrix/index.ts +++ b/samples/routes-route-matrix/index.ts @@ -124,5 +124,5 @@ async function initMap(): Promise { map.fitBounds(bounds); } -initMap(); +void initMap(); // [END maps_routes_route_matrix] diff --git a/samples/streetview-overlays/index.ts b/samples/streetview-overlays/index.ts index 64b2f64f8..bb071be2e 100644 --- a/samples/streetview-overlays/index.ts +++ b/samples/streetview-overlays/index.ts @@ -77,5 +77,5 @@ function toggleStreetView(): void { } } -initMap(); +void initMap(); // [END maps_streetview_overlays] diff --git a/samples/test-example/index.ts b/samples/test-example/index.ts index f00b5a55f..175acc0a0 100644 --- a/samples/test-example/index.ts +++ b/samples/test-example/index.ts @@ -47,5 +47,5 @@ async function initMap() { console.log("Say there Mac, why'd you choose me to test this change?"); // [END maps_test_example_why_me] } -initMap(); +void initMap(); // [END maps_test_example] diff --git a/samples/ui-kit-place-details-compact/index.ts b/samples/ui-kit-place-details-compact/index.ts index 5653c838f..29fdf5227 100644 --- a/samples/ui-kit-place-details-compact/index.ts +++ b/samples/ui-kit-place-details-compact/index.ts @@ -15,7 +15,7 @@ const marker = document.querySelector('gmp-advanced-marker')!; /* [END maps_ui_kit_place_details_compact_query_selector] */ async function initMap(): Promise { // Request needed libraries. - Promise.all([ + void Promise.all([ google.maps.importLibrary('marker'), google.maps.importLibrary('places'), ]); @@ -53,7 +53,7 @@ async function initMap(): Promise { /* [START maps_ui_kit_place_details_compact_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', async (event) => { + map.innerMap.addListener('click', (event) => { event.stop(); if (event.placeId) { @@ -70,5 +70,5 @@ async function initMap(): Promise { }); } /* [END maps_ui_kit_place_details_compact_event] */ -initMap(); +void initMap(); /* [END maps_ui_kit_place_details_compact] */ diff --git a/samples/ui-kit-place-details/index.ts b/samples/ui-kit-place-details/index.ts index 82f2085c0..4570b2d86 100644 --- a/samples/ui-kit-place-details/index.ts +++ b/samples/ui-kit-place-details/index.ts @@ -43,7 +43,7 @@ async function initMap(): Promise { /* [START maps_ui_kit_place_details_event] */ // Add an event listener to handle clicks. - map.innerMap.addListener('click', async (event) => { + map.innerMap.addListener('click', (event) => { marker.position = null; event.stop(); if (event.placeId) { @@ -59,5 +59,5 @@ async function initMap(): Promise { } /* [END maps_ui_kit_place_details_event] */ -initMap(); +void initMap(); /* [END maps_ui_kit_place_details] */ diff --git a/samples/ui-kit-place-search-nearby/index.ts b/samples/ui-kit-place-search-nearby/index.ts index a80c437cc..682ad47c2 100644 --- a/samples/ui-kit-place-search-nearby/index.ts +++ b/samples/ui-kit-place-search-nearby/index.ts @@ -53,15 +53,15 @@ async function init(): Promise { markers.get(place.id)?.click(); }); placeSearch.addEventListener('gmp-load', () => { - addMarkers(); + void addMarkers(); }); - searchPlaces(); + void searchPlaces(); } /* [END maps_ui_kit_place_search_nearby_event] */ /* [START maps_ui_kit_place_search_nearby_function] */ // The searchPlaces function is called when the user changes the type select or when the page loads. -async function searchPlaces() { +function searchPlaces() { // Close the info window and clear the markers. infoWindow.close(); for (const marker of markers.values()) { @@ -114,5 +114,5 @@ async function addMarkers() { map.innerMap.fitBounds(bounds); } -init(); +void init(); /* [END maps_ui_kit_place_search_nearby] */ diff --git a/samples/ui-kit-place-search-text/index.ts b/samples/ui-kit-place-search-text/index.ts index 638ff8b09..896190769 100644 --- a/samples/ui-kit-place-search-text/index.ts +++ b/samples/ui-kit-place-search-text/index.ts @@ -59,7 +59,7 @@ async function init(): Promise { markers.get(place.id)?.click(); }); placeSearch.addEventListener('gmp-load', () => { - addMarkers(); + void addMarkers(); }); searchPlaces(); @@ -67,7 +67,7 @@ async function init(): Promise { /* [END maps_ui_kit_place_search_text_event] */ /* [START maps_ui_kit_place_search_text_function] */ // The searchPlaces function is called when the user changes the query input or when the page loads. -async function searchPlaces() { +function searchPlaces() { // Close the info window and clear the markers. infoWindow.close(); for (const marker of markers.values()) { @@ -124,5 +124,5 @@ async function addMarkers() { map.innerMap.fitBounds(bounds); } -init(); +void init(); /* [END maps_ui_kit_place_search_text] */ diff --git a/samples/weather-api-current-compact/index.ts b/samples/weather-api-current-compact/index.ts index 2cf608d5f..c8c51771a 100644 --- a/samples/weather-api-current-compact/index.ts +++ b/samples/weather-api-current-compact/index.ts @@ -19,7 +19,7 @@ let allMarkers: google.maps.marker.AdvancedMarkerElement[] = []; // To store all let markersLoaded = false; // Flag to track if button markers are loaded async function initMap(): Promise { - google.maps.importLibrary('marker'); // preload + void google.maps.importLibrary('marker'); // preload const { Map } = await google.maps.importLibrary('maps'); map = new Map(document.getElementById('map') as HTMLElement, { @@ -142,7 +142,7 @@ async function createAndAddMarker( (marker as any).markerType = markerType; // Fetch and update weather data for this location - updateWeatherDisplayForMarker( + void updateWeatherDisplayForMarker( marker, weatherWidget, new LatLng(location.lat, location.lng) @@ -397,14 +397,14 @@ async function updateWeatherDisplayForMarker( } } -initMap(); +void initMap(); // Wait for the custom element to be defined before adding the event listener -customElements.whenDefined('simple-weather-widget').then(() => { +void customElements.whenDefined('simple-weather-widget').then(() => { const modeToggleButton = document.getElementById('mode-toggle'); if (modeToggleButton) { modeToggleButton.addEventListener('click', () => { - toggleDarkMode(); + void toggleDarkMode(); }); } @@ -412,7 +412,7 @@ customElements.whenDefined('simple-weather-widget').then(() => { if (loadMarkersButton) { loadMarkersButton.addEventListener('click', () => { if (!markersLoaded) { - loadWeatherMarkers(); + void loadWeatherMarkers(); markersLoaded = true; loadMarkersButton.textContent = 'Remove Markers'; } else { diff --git a/samples/web-components-events/index.ts b/samples/web-components-events/index.ts index d55bcdc73..e63667f0e 100644 --- a/samples/web-components-events/index.ts +++ b/samples/web-components-events/index.ts @@ -7,7 +7,7 @@ // [START maps_web_components_events] // This example adds a map using web components. async function initMap(): Promise { - google.maps.importLibrary('marker'); // preload + void google.maps.importLibrary('marker'); // preload const { InfoWindow } = await google.maps.importLibrary('maps'); console.log('Maps JavaScript API loaded.'); @@ -17,7 +17,7 @@ async function initMap(): Promise { ) as Iterable; for (const advancedMarker of advancedMarkers) { - customElements.whenDefined(advancedMarker.localName).then(async () => { + void customElements.whenDefined(advancedMarker.localName).then(() => { advancedMarker.addEventListener('gmp-click', () => { const infoWindow = new InfoWindow({ content: advancedMarker.title, @@ -31,5 +31,5 @@ async function initMap(): Promise { } } -initMap(); +void initMap(); // [END maps_web_components_events]