Skip to content

Commit e554366

Browse files
authored
fix: update dependencies, fix typescript issues, repair tests (#819)
- dependencies updated to their latest versions (exceptions are typescript 5.5 and eslint 8) - all tests are back to passing, tests that never actually worked are now working - all TypeScript and ESLint Problems are fixed
1 parent c7019a3 commit e554366

33 files changed

+4665
-6627
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
"extends": ["plugin:@typescript-eslint/recommended"],
2121
"rules": {
2222
"@typescript-eslint/ban-ts-comment": 0,
23-
"@typescript-eslint/ban-types": 1,
2423
"@typescript-eslint/no-empty-function": 1,
2524
"@typescript-eslint/member-ordering": 1,
25+
"@typescript-eslint/no-empty-object-type": 1,
26+
"@typescript-eslint/no-unsafe-function-type": 1,
27+
"@typescript-eslint/no-wrapper-object-types": 1,
28+
2629
"@typescript-eslint/explicit-member-accessibility": [
2730
1,
2831
{

.github/workflows/bundlewatch.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,21 @@ jobs:
2727
env:
2828
CI_BRANCH_BASE: main
2929
steps:
30-
- uses: actions/checkout@v3
31-
- uses: jackyef/bundlewatch-gh-action@b9753bc9b3ea458ff21069eaf6206e01e046f0b5
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: 20
37+
cache: npm
38+
39+
- name: Install Dependencies
40+
run: npm ci
41+
42+
- name: Bundlewatch
43+
uses: jackyef/bundlewatch-gh-action@b9753bc9b3ea458ff21069eaf6206e01e046f0b5
3244
with:
33-
build-script: npm i
45+
build-script: npm run prepack
3446
bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
3547
bundlewatch-config: .github/bundlewatch.config.json

examples/algorithms.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
import { MAP_ID, createMarker, getLoaderOptions, sync } from "./config";
2525

2626
import { Loader } from "@googlemaps/js-api-loader";
27+
// @ts-ignore
2728
import trees from "./trees.json";
2829

2930
const mapOptions: google.maps.MapOptions = {
@@ -37,17 +38,17 @@ new Loader(getLoaderOptions()).load().then(() => {
3738

3839
const panels: [HTMLElement, AbstractAlgorithm, string][] = [
3940
[
40-
document.getElementById("noop"),
41+
document.getElementById("noop")!,
4142
new NoopAlgorithm({}),
4243
`new NoopAlgorithm()`,
4344
],
4445
[
45-
document.getElementById("grid"),
46+
document.getElementById("grid")!,
4647
new GridAlgorithm({ maxDistance: 40000 }),
4748
`new GridAlgorithm({})`,
4849
],
4950
[
50-
document.getElementById("supercluster"),
51+
document.getElementById("supercluster")!,
5152
new SuperClusterAlgorithm({}),
5253
`new SuperClusterAlgorithm({})`,
5354
],

examples/bench-advanced.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { MAP_ID, getLoaderOptions } from "./config";
1818
import { Loader } from "@googlemaps/js-api-loader";
1919
import { MarkerClusterer } from "../src";
20+
2021
import points from "./realworld.json";
2122

2223
// Do not set the mapId to force legacy markers
@@ -28,7 +29,7 @@ const mapOptions: google.maps.MapOptions = {
2829
};
2930

3031
new Loader(getLoaderOptions()).load().then(() => {
31-
const element = document.getElementById("map");
32+
const element = document.getElementById("map")!;
3233

3334
const map = new google.maps.Map(element, mapOptions);
3435

examples/bench-legacy-viewport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const mapOptions: google.maps.MapOptions = {
2727
};
2828

2929
new Loader(getLoaderOptions()).load().then(() => {
30-
const element = document.getElementById("map");
30+
const element = document.getElementById("map")!;
3131

3232
const map = new google.maps.Map(element, mapOptions);
3333

examples/bench-legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const mapOptions: google.maps.MapOptions = {
2727
};
2828

2929
new Loader(getLoaderOptions()).load().then(() => {
30-
const element = document.getElementById("map");
30+
const element = document.getElementById("map")!;
3131

3232
const map = new google.maps.Map(element, mapOptions);
3333

examples/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export const sync = (...maps: google.maps.Map[]): void => {
4545

4646
maps.forEach((m) => {
4747
m.addListener("bounds_changed", () => {
48-
const changedCenter = m.getCenter();
49-
const changedZoom = m.getZoom();
48+
const changedCenter = m.getCenter()!;
49+
const changedZoom = m.getZoom()!;
5050

5151
if (changedCenter !== center || changedZoom !== zoom) {
5252
center = changedCenter;

examples/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const mapOptions: google.maps.MapOptions = {
2626
};
2727

2828
new Loader(getLoaderOptions()).load().then(() => {
29-
const element = document.getElementById("map");
29+
const element = document.getElementById("map")!;
3030

3131
const map = new google.maps.Map(element, mapOptions);
3232

examples/renderers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ const interpolatedRenderer = {
6969
new Loader(getLoaderOptions()).load().then(() => {
7070
const maps: google.maps.Map[] = [];
7171

72-
const panels: [HTMLElement, Renderer, string][] = [
72+
const panels: [HTMLElement, Renderer, string | null][] = [
7373
[
74-
document.getElementById("default"),
74+
document.getElementById("default")!,
7575
new DefaultRenderer(),
7676
`new DefaultRenderer()`,
7777
],
7878
[
79-
document.getElementById("simple"),
79+
document.getElementById("simple")!,
8080
{
8181
render: ({ count, position }: Cluster) =>
8282
new google.maps.Marker({
@@ -88,8 +88,8 @@ new Loader(getLoaderOptions()).load().then(() => {
8888
},
8989
null,
9090
],
91-
[document.getElementById("svg"), new DefaultRenderer(), null],
92-
[document.getElementById("interpolated"), interpolatedRenderer, null],
91+
[document.getElementById("svg")!, new DefaultRenderer(), null],
92+
[document.getElementById("interpolated")!, interpolatedRenderer, null],
9393
];
9494

9595
panels.forEach(([element, renderer, text]) => {

examples/updates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const mapOptions: google.maps.MapOptions = {
2626
};
2727

2828
new Loader(getLoaderOptions()).load().then(async () => {
29-
const element = document.getElementById("map");
29+
const element = document.getElementById("map")!;
3030

3131
const map = new google.maps.Map(element, mapOptions);
3232

jest.config.js renamed to jest.config.cjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17+
/** @type {import('ts-jest').JestConfigWithTsJest} */
1718
module.exports = {
18-
transform: {
19-
"^.+\\.tsx?$": "ts-jest",
20-
},
19+
preset: "ts-jest/presets/js-with-ts",
20+
testEnvironment: "jsdom",
21+
transformIgnorePatterns: [],
2122
collectCoverage: true,
2223
testPathIgnorePatterns: ["/dist/"],
2324
};

0 commit comments

Comments
 (0)