Skip to content

Commit

Permalink
fix: update dependencies, fix typescript issues, repair tests (#819)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
usefulthink authored Jan 15, 2025
1 parent c7019a3 commit e554366
Show file tree
Hide file tree
Showing 33 changed files with 4,665 additions and 6,627 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/ban-types": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/member-ordering": 1,
"@typescript-eslint/no-empty-object-type": 1,
"@typescript-eslint/no-unsafe-function-type": 1,
"@typescript-eslint/no-wrapper-object-types": 1,

"@typescript-eslint/explicit-member-accessibility": [
1,
{
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/bundlewatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ jobs:
env:
CI_BRANCH_BASE: main
steps:
- uses: actions/checkout@v3
- uses: jackyef/bundlewatch-gh-action@b9753bc9b3ea458ff21069eaf6206e01e046f0b5
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm

- name: Install Dependencies
run: npm ci

- name: Bundlewatch
uses: jackyef/bundlewatch-gh-action@b9753bc9b3ea458ff21069eaf6206e01e046f0b5
with:
build-script: npm i
build-script: npm run prepack
bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
bundlewatch-config: .github/bundlewatch.config.json
7 changes: 4 additions & 3 deletions examples/algorithms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { MAP_ID, createMarker, getLoaderOptions, sync } from "./config";

import { Loader } from "@googlemaps/js-api-loader";
// @ts-ignore
import trees from "./trees.json";

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

const panels: [HTMLElement, AbstractAlgorithm, string][] = [
[
document.getElementById("noop"),
document.getElementById("noop")!,
new NoopAlgorithm({}),
`new NoopAlgorithm()`,
],
[
document.getElementById("grid"),
document.getElementById("grid")!,
new GridAlgorithm({ maxDistance: 40000 }),
`new GridAlgorithm({})`,
],
[
document.getElementById("supercluster"),
document.getElementById("supercluster")!,
new SuperClusterAlgorithm({}),
`new SuperClusterAlgorithm({})`,
],
Expand Down
3 changes: 2 additions & 1 deletion examples/bench-advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { MAP_ID, getLoaderOptions } from "./config";
import { Loader } from "@googlemaps/js-api-loader";
import { MarkerClusterer } from "../src";

import points from "./realworld.json";

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

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");
const element = document.getElementById("map")!;

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

Expand Down
2 changes: 1 addition & 1 deletion examples/bench-legacy-viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mapOptions: google.maps.MapOptions = {
};

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");
const element = document.getElementById("map")!;

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

Expand Down
2 changes: 1 addition & 1 deletion examples/bench-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mapOptions: google.maps.MapOptions = {
};

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");
const element = document.getElementById("map")!;

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

Expand Down
4 changes: 2 additions & 2 deletions examples/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const sync = (...maps: google.maps.Map[]): void => {

maps.forEach((m) => {
m.addListener("bounds_changed", () => {
const changedCenter = m.getCenter();
const changedZoom = m.getZoom();
const changedCenter = m.getCenter()!;
const changedZoom = m.getZoom()!;

if (changedCenter !== center || changedZoom !== zoom) {
center = changedCenter;
Expand Down
2 changes: 1 addition & 1 deletion examples/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const mapOptions: google.maps.MapOptions = {
};

new Loader(getLoaderOptions()).load().then(() => {
const element = document.getElementById("map");
const element = document.getElementById("map")!;

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

Expand Down
10 changes: 5 additions & 5 deletions examples/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ const interpolatedRenderer = {
new Loader(getLoaderOptions()).load().then(() => {
const maps: google.maps.Map[] = [];

const panels: [HTMLElement, Renderer, string][] = [
const panels: [HTMLElement, Renderer, string | null][] = [
[
document.getElementById("default"),
document.getElementById("default")!,
new DefaultRenderer(),
`new DefaultRenderer()`,
],
[
document.getElementById("simple"),
document.getElementById("simple")!,
{
render: ({ count, position }: Cluster) =>
new google.maps.Marker({
Expand All @@ -88,8 +88,8 @@ new Loader(getLoaderOptions()).load().then(() => {
},
null,
],
[document.getElementById("svg"), new DefaultRenderer(), null],
[document.getElementById("interpolated"), interpolatedRenderer, null],
[document.getElementById("svg")!, new DefaultRenderer(), null],
[document.getElementById("interpolated")!, interpolatedRenderer, null],
];

panels.forEach(([element, renderer, text]) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const mapOptions: google.maps.MapOptions = {
};

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

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

Expand Down
7 changes: 4 additions & 3 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* limitations under the License.
*/

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

0 comments on commit e554366

Please sign in to comment.