Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
{
Expand All @@ -40,13 +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-unused-vars': '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',
Expand Down
2 changes: 1 addition & 1 deletion samples/3d-accessibility-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_accessibility_features]
2 changes: 1 addition & 1 deletion samples/3d-camera-boundary/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_camera_boundary]
2 changes: 1 addition & 1 deletion samples/3d-camera-center/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ async function initMap(): Promise<void> {
});
}

initMap();
void initMap();
// [END maps_3d_camera_center]
4 changes: 2 additions & 2 deletions samples/3d-camera-to-around/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ 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();
});
}

init();
void init();
// [END maps_3d_camera_to_around]
2 changes: 1 addition & 1 deletion samples/3d-clamp-mode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
drawsOccludedSegments: true,
});

map.append(polyline);

Check warning on line 47 in samples/3d-clamp-mode/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe argument of type `any` assigned to a parameter of type `string | Node`
document.body.append(map);
}

init();
void init();

// Dropdown event listener
const dropdown = document.getElementById(
Expand All @@ -56,7 +56,7 @@
) as HTMLSelectElement;
dropdown.addEventListener('change', () => {
if (polyline && dropdown.value) {
polyline.altitudeMode = dropdown.value;

Check warning on line 59 in samples/3d-clamp-mode/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .altitudeMode on an `any` value
}
});

Expand Down
2 changes: 1 addition & 1 deletion samples/3d-coverage-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ async function initMap() {
}
);
}
initMap();
void initMap();
// [END maps_3d_coverage_map]
13 changes: 1 addition & 12 deletions samples/3d-label-toggle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,25 @@
gestureHandling: 'COOPERATIVE',
});

map.mode = 'SATELLITE';

Check warning on line 24 in samples/3d-label-toggle/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .mode on an `any` value

document.body.append(map);

Check warning on line 26 in samples/3d-label-toggle/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe argument of type `any` assigned to a parameter of type `string | Node`

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 () {
// Toggle the labels.
if (map.mode == 'SATELLITE') {

Check warning on line 32 in samples/3d-label-toggle/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .mode on an `any` value
// Setting the map mode to HYBRID turns the labels on.
map.mode = 'HYBRID';

Check warning on line 34 in samples/3d-label-toggle/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .mode on an `any` value
toggleButton.innerText = 'Labels are on. (HYBRID)';
} else {
// Setting the map mode to SATELLITE turns the labels on.
map.mode = 'SATELLITE';

Check warning on line 38 in samples/3d-label-toggle/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .mode on an `any` value
toggleButton.innerText = 'Labels are off. (SATELLITE)';
}
});
}

init();
void init();
// [END maps_3d_label_toggle]
2 changes: 1 addition & 1 deletion samples/3d-localization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_localization]
2 changes: 1 addition & 1 deletion samples/3d-map-45-degree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_45_degree]
2 changes: 1 addition & 1 deletion samples/3d-map-events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ async function init() {
}
}

init();
void init();
// [END maps_3d_map_events]
2 changes: 1 addition & 1 deletion samples/3d-map-roadmap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ async function init() {
document.body.appendChild(controls);
}

init();
void init();
// [END maps_3d_map_roadmap]
2 changes: 1 addition & 1 deletion samples/3d-map-styling/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_map_styling]
4 changes: 2 additions & 2 deletions samples/3d-marker-click-event/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -46,5 +46,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_marker_click_event]
4 changes: 2 additions & 2 deletions samples/3d-marker-collision-behavior/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ const positions = [
[-122.3378, 47.6095],
];

init();
void init();

const dropdown = document.getElementById(
'selectElementId'
) 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';
Expand Down
2 changes: 1 addition & 1 deletion samples/3d-marker-customization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_marker_customization]
2 changes: 1 addition & 1 deletion samples/3d-marker-graphics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_marker_graphics]
2 changes: 1 addition & 1 deletion samples/3d-marker-interactive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ const positions = [
},
];

init();
void init();
// [END maps_3d_marker_interactive]
2 changes: 1 addition & 1 deletion samples/3d-mesh-flatten/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ async function initMap(): Promise<void> {
});
}

initMap();
void initMap();
// [END maps_3d_mesh_flatten]
4 changes: 2 additions & 2 deletions samples/3d-model-interactive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ 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;
});

document.body.append(map);
map.append(model);
}

init();
void init();
// [END maps_3d_model_interactive]
2 changes: 1 addition & 1 deletion samples/3d-model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ async function init() {
map.append(model);
}

init();
void init();
// [END maps_3d_model]
9 changes: 4 additions & 5 deletions samples/3d-places-autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

document.body.append(map);

initAutocomplete();
void initAutocomplete();
}

async function initAutocomplete() {
Expand All @@ -30,8 +30,8 @@
const { PlaceAutocompleteElement } =
await google.maps.importLibrary('places');

const placeAutocomplete = new PlaceAutocompleteElement();

Check warning on line 33 in samples/3d-places-autocomplete/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe construction of a type that could not be resolved

Check warning on line 33 in samples/3d-places-autocomplete/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe assignment of an error typed value
placeAutocomplete.id = 'place-autocomplete-input';

Check warning on line 34 in samples/3d-places-autocomplete/index.ts

View workflow job for this annotation

GitHub Actions / Playwright PR/Push Tests

Unsafe member access .id on a type that cannot be resolved
const card = document.getElementById('pac-container')!;
card.appendChild(placeAutocomplete);

Expand All @@ -47,14 +47,13 @@
window.alert('No viewport for input: ' + place.displayName);
return;
}
flyToPlace(place);
void flyToPlace(place);
}
);
}

const flyToPlace = async (place) => {
const { Polyline3DElement, Polygon3DElement, Marker3DElement } =
await google.maps.importLibrary('maps3d');
const { Marker3DElement } = await google.maps.importLibrary('maps3d');

const location = place.location;

Expand Down Expand Up @@ -110,6 +109,6 @@
return elevation;
}

init();
void init();

// [END maps_3d_places_autocomplete]
2 changes: 1 addition & 1 deletion samples/3d-places/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ async function init() {
document.getElementById('details')!.style.display = 'block';
});
}
init();
void init();
// [END maps_3d_places]
2 changes: 1 addition & 1 deletion samples/3d-polygon-click-event/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ function randomizeHexColor(originalHexColor) {
return `#${rHex}${gHex}${bHex}${alpha}`;
}

init();
void init();
// [END maps_3d_polygon_click_event]
2 changes: 1 addition & 1 deletion samples/3d-polygon-extruded-hole/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ async function init() {
document.body.append(map3DElement);
}

init();
void init();
// [END maps_3d_polygon_extruded_hole]
2 changes: 1 addition & 1 deletion samples/3d-polygon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ async function init() {
document.body.append(map3DElement);
}

init();
void init();
// [END maps_3d_polygon]
2 changes: 1 addition & 1 deletion samples/3d-polyline-click-event/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ async function init() {
map.append(polyline);
}

init();
void init();
// [END maps_3d_polyline_click_event]
2 changes: 1 addition & 1 deletion samples/3d-polyline-extruded/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ async function init() {
map.append(polyline);
}

init();
void init();
// [END maps_3d_polyline_extruded]
2 changes: 1 addition & 1 deletion samples/3d-polyline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ async function init() {
map.append(polyline);
}

init();
void init();
// [END maps_3d_polyline]
2 changes: 1 addition & 1 deletion samples/3d-popover-location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_popover_location]
4 changes: 2 additions & 2 deletions samples/3d-popover-marker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand All @@ -42,5 +42,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_popover_marker]
2 changes: 1 addition & 1 deletion samples/3d-simple-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ async function initMap() {
document.body.append(map);
}

initMap();
void initMap();
// [END maps_3d_simple_map]
2 changes: 1 addition & 1 deletion samples/3d-simple-marker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ async function init() {
document.body.append(map);
}

init();
void init();
// [END maps_3d_simple_marker]
6 changes: 3 additions & 3 deletions samples/add-map/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function initMap(): Promise<void> {
// [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'),
]);
Expand All @@ -30,12 +30,12 @@ async function initMap(): Promise<void> {

// [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',
});
// [END maps_add_map_instantiate_marker]
}
initMap();
void initMap();
// [END maps_add_map]
4 changes: 1 addition & 3 deletions samples/address-validation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -212,5 +210,5 @@ function populateAddressFields(exampleAddress) {
console.log('Populated fields with example: ', exampleAddress);
}

init();
void init();
// [END maps_address_validation]
Loading
Loading