Skip to content

Commit

Permalink
Bump prettier from 2.8.7 to 3.0.3 (#312)
Browse files Browse the repository at this point in the history
* Bump prettier from 2.8.7 to 3.0.3

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.7 to 3.0.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.7...3.0.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update to prettier 3, trailingComma style

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: allartk <[email protected]>
  • Loading branch information
dependabot[bot] and allartk authored Sep 3, 2023
1 parent 6bb2283 commit e20955f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 47 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"build": "npm run build:types && npm run build:js",
"lint": "eslint && prettier --check \"./(src|test)/**/*.ts\"",
"lint:fix": "eslint --fix src test",
"format": "eslint --fix src test && prettier -w \"./(src|test)/**/*.ts\"",
"test": "karma start karma.conf.js",
"test:watch": "karma start --no-single-run karma.conf.js",
"watch": "rollup -c -w",
Expand Down Expand Up @@ -67,7 +68,7 @@
"lint-staged": "^13.1.0",
"mocha": "^9.1.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.7",
"prettier": "^3.0.3",
"rollup": "^3.20.2",
"sinon": "^13.0.2",
"typedoc": "^0.24.1",
Expand Down
10 changes: 5 additions & 5 deletions src/ControlSaveTiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class ControlSaveTiles extends Control {
options.saveText,
'savetiles',
container,
this._saveTiles
this._saveTiles,
);
this._createButton(options.rmText, 'rmtiles', container, this._rmTiles);
return container;
Expand All @@ -119,7 +119,7 @@ export class ControlSaveTiles extends Control {
html: string,
className: string,
container: HTMLElement,
fn: DomEvent.EventHandlerFn
fn: DomEvent.EventHandlerFn,
) {
const link = DomUtil.create('a', className, container);
link.innerHTML = html;
Expand Down Expand Up @@ -173,7 +173,7 @@ export class ControlSaveTiles extends Control {
const currentZoom = this._map.getZoom();
if (currentZoom < minZoom) {
throw new Error(
`It's not possible to save with zoom below level ${minZoom}.`
`It's not possible to save with zoom below level ${minZoom}.`,
);
}
const { maxZoom } = this.options;
Expand All @@ -190,7 +190,7 @@ export class ControlSaveTiles extends Control {
for (let i = 0; i < zoomlevels.length; i += 1) {
const area = bounds(
this._map.project(latlngBounds.getNorthWest(), zoomlevels[i]),
this._map.project(latlngBounds.getSouthEast(), zoomlevels[i])
this._map.project(latlngBounds.getSouthEast(), zoomlevels[i]),
);
tiles = tiles.concat(this._baseLayer.getTileUrls(area, zoomlevels[i]));
}
Expand Down Expand Up @@ -253,7 +253,7 @@ export class ControlSaveTiles extends Control {

export function savetiles(
baseLayer: TileLayerOffline,
options: Partial<SaveTileOptions>
options: Partial<SaveTileOptions>,
) {
return new ControlSaveTiles(baseLayer, options);
}
Expand Down
10 changes: 5 additions & 5 deletions src/TileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function downloadTile(tileUrl: string): Promise<Blob> {
*/
export async function saveTile(
tileInfo: TileInfo,
blob: Blob
blob: Blob,
): Promise<IDBValidKey> {
const db = await openTilesDataBase();
return db.put(tileStoreName, {
Expand Down Expand Up @@ -140,7 +140,7 @@ export function getTilePoints(area: Bounds, tileSize: Point): Point[] {
*/
export function getStoredTilesAsJson(
layer: GridLayer,
tiles: TileInfo[]
tiles: TileInfo[],
): FeatureCollection {
const featureCollection: FeatureCollection = {
type: 'FeatureCollection',
Expand All @@ -149,17 +149,17 @@ export function getStoredTilesAsJson(
for (let i = 0; i < tiles.length; i += 1) {
const topLeftPoint = new Point(
tiles[i].x * layer.getTileSize().x,
tiles[i].y * layer.getTileSize().y
tiles[i].y * layer.getTileSize().y,
);
const bottomRightPoint = new Point(
topLeftPoint.x + layer.getTileSize().x,
topLeftPoint.y + layer.getTileSize().y
topLeftPoint.y + layer.getTileSize().y,
);

const topLeftlatlng = CRS.EPSG3857.pointToLatLng(topLeftPoint, tiles[i].z);
const botRightlatlng = CRS.EPSG3857.pointToLatLng(
bottomRightPoint,
tiles[i].z
tiles[i].z,
);
featureCollection.features.push({
type: 'Feature',
Expand Down
12 changes: 6 additions & 6 deletions test/ControlSaveTilesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe('control with defaults', () => {
lat: 51.985,
lng: 5,
},
16
16,
);
baseLayer = new TileLayerOffline(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
subdomains: 'abc',
}
},
).addTo(leafletMap);
saveControl = savetiles(baseLayer, {});
saveControl.addTo(leafletMap);
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('control with defaults', () => {
assert.equal(
stub.callCount,
1,
`_loadTile has been called ${stub.callCount} times`
`_loadTile has been called ${stub.callCount} times`,
);
stub.resetBehavior();
});
Expand All @@ -85,13 +85,13 @@ describe('control with different options', () => {
lat: 51.985,
lng: 5,
},
16
16,
);
baseLayer = new TileLayerOffline(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
subdomains: 'abc',
}
},
).addTo(leafletMap);
});
it('_saveTiles calculates tiles for 2 zoomlevels', () => {
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('control with different options', () => {
assert.equal(
stub.callCount,
4,
`_loadTile has been called ${stub.callCount} times`
`_loadTile has been called ${stub.callCount} times`,
);
stub.resetBehavior();
});
Expand Down
38 changes: 19 additions & 19 deletions test/TileLayerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { TileLayerOffline } from '../src/TileLayerOffline';
describe('TileLayer.Offline', () => {
it('get getTileUrl', () => {
const layer = new TileLayerOffline(
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
assert.instanceOf(
layer.setDataUrl({ x: 123456, y: 456789, z: 16 }),
Promise
Promise,
);
});
it('createTile', () => {
Expand All @@ -20,19 +20,19 @@ describe('TileLayer.Offline', () => {
});
it('get storagekey openstreetmap', () => {
const layer = new TileLayerOffline(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
assert.equal(key, 'http://a.tile.openstreetmap.org/16/123456/456789.png');
});
it('get storagekey cartodb', () => {
const layer = new TileLayerOffline(
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png'
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
);
const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
assert.equal(
key,
'https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/16/123456/456789.png'
'https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/16/123456/456789.png',
);
});
it('get storagekey mapbox with accessToken', () => {
Expand All @@ -41,21 +41,21 @@ describe('TileLayer.Offline', () => {
{
id: 'mapbox.streets',
accessToken: 'xyz',
}
},
);
const key = layer._getStorageKey({ z: 16, x: 123456, y: 456789 });
assert.equal(
key,
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/123456/456789.png?access_token=xyz'
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/123456/456789.png?access_token=xyz',
);
});
it('calculates tiles at level 16', () => {
const layer = new TileLayerOffline(
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
const bounds = new Bounds(
new Point(8621975, 5543267.999999999),
new Point(8621275, 5542538)
new Point(8621275, 5542538),
);
const tiles = layer.getTileUrls(bounds, 16);
assert.lengthOf(tiles, 16);
Expand All @@ -67,11 +67,11 @@ describe('TileLayer.Offline', () => {

it('calculates tile urls,keys at level 16 with subdomains', () => {
const layer = new TileLayerOffline(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
const bounds = new Bounds(
new Point(8621975, 5543267.999999999),
new Point(8621275, 5542538)
new Point(8621275, 5542538),
);
const tiles = layer.getTileUrls(bounds, 16);
assert.lengthOf(tiles, 16);
Expand All @@ -83,11 +83,11 @@ describe('TileLayer.Offline', () => {

it('uses subdomains for url and not for key', () => {
const layer = new TileLayerOffline(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
const bounds = new Bounds(
new Point(8621975, 5543267.999999999),
new Point(8621275, 5542538)
new Point(8621275, 5542538),
);
const tiles = layer.getTileUrls(bounds, 16);
const subs = tiles.map((t) => t.url.match(/([abc])\./)?.[1]);
Expand All @@ -102,11 +102,11 @@ describe('TileLayer.Offline', () => {

it('calculates openstreetmap tiles at level 16', () => {
const layer = new TileLayerOffline(
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png'
'http://a.tile.openstreetmap.org/{z}/{x}/{y}.png',
);
const bounds = new Bounds(
new Point(8621975, 5543267.999999999),
new Point(8621275, 5542538)
new Point(8621275, 5542538),
);
const tiles = layer.getTileUrls(bounds, 16);
assert.lengthOf(tiles, 16);
Expand All @@ -122,23 +122,23 @@ describe('TileLayer.Offline', () => {
{
id: 'mapbox.streets',
accessToken: 'xyz',
}
},
);
const bounds = new Bounds(
new Point(8621975, 5543267.999999999),
new Point(8621275, 5542538)
new Point(8621275, 5542538),
);
const tiles = layer.getTileUrls(bounds, 16);
assert.lengthOf(tiles, 16);
const urls = tiles.map((t) => t.url);
assert.include(
urls,
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz'
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
);
const keys = tiles.map((t) => t.key);
assert.include(
keys,
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz'
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
);
});
});
4 changes: 2 additions & 2 deletions test/TileManagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ describe('manage tile storage', () => {
'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
createdAt: Date.now(),
},
new Blob()
new Blob(),
).then((r) => {
assert.equal(
r,
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz'
'https://api.tiles.mapbox.com/v4/mapbox.streets/16/33677/21651.png?access_token=xyz',
);
}));

Expand Down

0 comments on commit e20955f

Please sign in to comment.