Skip to content

Commit a999603

Browse files
committed
fix even more build/typings issues
1 parent f4a54f7 commit a999603

63 files changed

Lines changed: 70441 additions & 311 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ jobs:
108108
if: env.HAS_CHANGES == 'true'
109109
run: npm install
110110

111+
- name: Prettier Check
112+
if: env.HAS_CHANGES == 'true'
113+
run: npx prettier ./samples/ --check --log-level warn
114+
env:
115+
CI: true
116+
117+
- name: ESLint Check
118+
if: env.HAS_CHANGES == 'true'
119+
run: npx eslint
120+
env:
121+
CI: true
122+
111123
- name: Install Playwright Browsers
112124
if: steps.playwright-cache.outputs.cache-hit != 'true' && env.HAS_CHANGES == 'true'
113125
run: npx playwright install chromium --with-deps
@@ -133,18 +145,6 @@ jobs:
133145
env.HAS_CHANGES == 'true' ||
134146
contains(github.event.pull_request.paths.*, 'samples/generate-index.sh')
135147
136-
- name: Prettier Check
137-
if: env.HAS_CHANGES == 'true'
138-
run: npx prettier ./samples/ --check --log-level warn
139-
env:
140-
CI: true
141-
142-
- name: ESLint Check
143-
if: env.HAS_CHANGES == 'true'
144-
run: npx eslint
145-
env:
146-
CI: true
147-
148148
- name: Run All Playwright Tests
149149
if: env.HAS_CHANGES == 'true'
150150
run: npx playwright test e2e/samples.spec.ts

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ samples/.env
66

77
# Ignore dist files generated by build.
88
samples/*/dist/
9-
samples/**/*.js
9+
samples/*/*.js
1010

1111
# Ignore playwright outputs
1212
/test-results/

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
index.html
22
package.json
33
package-lock.json
4-
dist
4+
dist
5+
samples/*/*.js

e2e/samples.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ foldersToTest.forEach((sampleFolder) => {
218218
typeof window.google.maps !== 'undefined'
219219
);
220220
});
221-
await expect(hasGoogleMaps).toBeTruthy();
221+
expect(hasGoogleMaps).toBeTruthy();
222222

223223
/** const mapElement = await page.locator('#map');
224224
if (await page.locator('#map').isVisible()) {

e2e/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig.base.json",
3+
"compilerOptions": {
4+
"rootDir": "."
5+
},
6+
"include": ["./*.ts"]
7+
}

eslint.config.mjs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { defineConfig, globalIgnores } from 'eslint/config';
88
import stylistic from '@stylistic/eslint-plugin';
99

1010
export default defineConfig([
11-
globalIgnores(['**/dist/*', '**/package-lock.json']),
11+
globalIgnores(['**/dist/*', 'samples/*/*.js', '**/package-lock.json']),
1212
{
1313
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
1414
plugins: { js },
@@ -28,12 +28,33 @@ export default defineConfig([
2828
'spaced-comment': ['error', 'always'],
2929

3030
// temporarily disabled for historic reasons:
31-
'@typescript-eslint/no-unused-vars': 'off',
32-
'@typescript-eslint/no-explicit-any': 'off',
33-
'@typescript-eslint/no-namespace': 'off',
3431
'no-prototype-builtins': 'off',
3532
},
3633
},
34+
{
35+
files: ['**/*.ts', '**/*.tsx'],
36+
extends: [...tseslint.configs.recommendedTypeChecked],
37+
languageOptions: {
38+
parserOptions: {
39+
projectService: true,
40+
},
41+
},
42+
rules: {
43+
// temporarily downgraded to warn for historic reasons:
44+
'@typescript-eslint/no-unsafe-member-access': 'warn',
45+
'@typescript-eslint/no-unused-vars': 'warn',
46+
'@typescript-eslint/no-unsafe-assignment': 'warn',
47+
'@typescript-eslint/require-await': 'warn',
48+
'@typescript-eslint/no-floating-promises': 'warn',
49+
'@typescript-eslint/no-misused-promises': 'warn',
50+
'@typescript-eslint/no-unsafe-call': 'warn',
51+
'@typescript-eslint/no-explicit-any': 'warn',
52+
'@typescript-eslint/no-namespace': 'warn',
53+
'@typescript-eslint/no-unsafe-return': 'warn',
54+
'@typescript-eslint/no-unsafe-argument': 'warn',
55+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
56+
},
57+
},
3758
{
3859
files: ['**/*.json'],
3960
plugins: { json },

samples/3d-map-roadmap/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright 2026 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
6+
// TMP EMPTY LINE
77
// [START maps_3d_map_roadmap]
88
async function init() {
99
const { Map3DElement } = await google.maps.importLibrary('maps3d');
10-
10+
// TMP EMPTY LINE
1111
const map = new Map3DElement({
1212
center: {
1313
lat: 37.79334535092104,
@@ -20,18 +20,18 @@ async function init() {
2020
mode: 'ROADMAP',
2121
internalUsageAttributionIds: ['gmp_git_jsapisamples_v1_3d-rendering'],
2222
});
23-
23+
// TMP EMPTY LINE
2424
document.body.append(map);
25-
25+
// TMP EMPTY LINE
2626
// Create the controls container
2727
const controls = document.createElement('div');
2828
controls.id = 'controls';
2929
controls.classList.add('map-mode-control');
30-
30+
// TMP EMPTY LINE
3131
// Create the select element
3232
const selector = document.createElement('select');
3333
selector.id = 'map-mode';
34-
34+
// TMP EMPTY LINE
3535
const modes = ['ROADMAP', 'SATELLITE', 'HYBRID'];
3636
modes.forEach((modeName) => {
3737
const option = document.createElement('option');
@@ -42,14 +42,14 @@ async function init() {
4242
}
4343
selector.appendChild(option);
4444
});
45-
45+
// TMP EMPTY LINE
4646
selector.addEventListener('change', function () {
4747
map.mode = this.value as google.maps.maps3d.MapMode;
4848
});
49-
49+
// TMP EMPTY LINE
5050
controls.appendChild(selector);
5151
document.body.appendChild(controls);
5252
}
53-
53+
// TMP EMPTY LINE
5454
init();
5555
// [END maps_3d_map_roadmap]

samples/3d-map-styling/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Copyright 2026 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
6+
// TMP EMPTY LINE
77
// [START maps_3d_map_styling]
88
async function initMap() {
99
const { Map3DElement } = await google.maps.importLibrary('maps3d');
10-
10+
// TMP EMPTY LINE
1111
const map = new Map3DElement({
1212
center: {
1313
lat: 37.75183154601466,
@@ -21,9 +21,9 @@ async function initMap() {
2121
mode: 'HYBRID',
2222
gestureHandling: 'COOPERATIVE',
2323
});
24-
24+
// TMP EMPTY LINE
2525
document.body.append(map);
2626
}
27-
27+
// TMP EMPTY LINE
2828
initMap();
2929
// [END maps_3d_map_styling]

samples/3d-marker-click-event/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
* Copyright 2025 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
6+
// TMP EMPTY LINE
77
// [START maps_3d_marker_click_event]
88
async function initMap() {
99
// Include the interactive marker class
1010
const { Map3DElement, Marker3DInteractiveElement } =
1111
await google.maps.importLibrary('maps3d');
12-
12+
// TMP EMPTY LINE
1313
// We will use this to place the camrea for the intial view but also to fly around the starting point.
1414
const originalCamera = {
1515
center: { lat: 39.1178, lng: -106.4452, altitude: 4395.4952 },
1616
range: 1500,
1717
tilt: 74,
1818
heading: 0,
1919
};
20-
20+
// TMP EMPTY LINE
2121
const map = new Map3DElement({
2222
...originalCamera,
2323
mode: 'SATELLITE',
2424
gestureHandling: 'COOPERATIVE',
2525
});
26-
26+
// TMP EMPTY LINE
2727
// Create the interactive marker and set the attributes.
2828
const interactiveMarker = new Marker3DInteractiveElement({
2929
position: { lat: 39.1178, lng: -106.4452, altitude: 100 },
3030
altitudeMode: 'RELATIVE_TO_MESH',
3131
extruded: true,
3232
label: 'Mount Elbert',
3333
});
34-
34+
// TMP EMPTY LINE
3535
// Specify the action to take on click.
3636
interactiveMarker.addEventListener('gmp-click', (event) => {
3737
map.flyCameraAround({
@@ -40,11 +40,11 @@ async function initMap() {
4040
repeatCount: 1,
4141
});
4242
});
43-
43+
// TMP EMPTY LINE
4444
map.append(interactiveMarker);
45-
45+
// TMP EMPTY LINE
4646
document.body.append(map);
4747
}
48-
48+
// TMP EMPTY LINE
4949
initMap();
5050
// [END maps_3d_marker_click_event]

samples/3d-marker-collision-behavior/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@
33
* Copyright 2025 Google LLC. All Rights Reserved.
44
* SPDX-License-Identifier: Apache-2.0
55
*/
6-
6+
// TMP EMPTY LINE
77
// [START maps_3d_marker_collision_behavior]
88
const markers: google.maps.maps3d.Marker3DElement[] = [];
9-
9+
// TMP EMPTY LINE
1010
async function init() {
1111
// Request needed libraries.
1212
const { Map3DElement, Marker3DElement } =
1313
await google.maps.importLibrary('maps3d');
14-
14+
// TMP EMPTY LINE
1515
const map = new Map3DElement({
1616
center: { lat: 47.6094, lng: -122.339, altitude: 0 },
1717
range: 1000,
1818
mode: 'HYBRID',
1919
gestureHandling: 'COOPERATIVE',
2020
});
21-
21+
// TMP EMPTY LINE
2222
for (const [lng, lat] of positions) {
2323
const marker = new Marker3DElement({
2424
position: { lat, lng },
2525
// Try setting a different collision behavior here.
2626
collisionBehavior: 'REQUIRED',
2727
});
28-
28+
// TMP EMPTY LINE
2929
markers.push(marker);
3030
map.append(marker);
3131
}
32-
32+
// TMP EMPTY LINE
3333
document.body.append(map);
3434
}
35-
35+
// TMP EMPTY LINE
3636
const positions = [
3737
[-122.3402, 47.6093],
3838
[-122.3402, 47.6094],
@@ -48,19 +48,19 @@ const positions = [
4848
[-122.3381, 47.6095],
4949
[-122.3378, 47.6095],
5050
];
51-
51+
// TMP EMPTY LINE
5252
init();
53-
53+
// TMP EMPTY LINE
5454
const dropdown = document.getElementById(
5555
'selectElementId'
5656
) as HTMLSelectElement;
5757
dropdown.addEventListener('change', drawMap);
58-
58+
// TMP EMPTY LINE
5959
function drawMap(event) {
6060
for (const marker of markers) {
6161
marker.collisionBehavior =
6262
(dropdown.value as google.maps.CollisionBehavior) || 'REQUIRED';
6363
}
6464
}
65-
65+
// TMP EMPTY LINE
6666
// [END maps_3d_marker_collision_behavior]

0 commit comments

Comments
 (0)