From fcb74bdb31739776c74ee3775017211c1c0fe859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=BDdila?= Date: Tue, 22 Aug 2023 19:32:12 +0200 Subject: [PATCH] updated prettier --- .github/ISSUE_TEMPLATE/bug_report.md | 4 +-- .github/ISSUE_TEMPLATE/feature_request.md | 3 +- .github/pull_request_template.md | 5 +++- .prettierrc | 1 - README.md | 2 +- examples/leaflet/index.html | 2 +- examples/maplibregl/index.html | 2 +- examples/openlayers/index.html | 2 +- examples/react/index.html | 2 +- examples/standalone/leaflet.html | 4 +-- examples/standalone/maplibregl.html | 2 +- index.html | 2 +- package-lock.json | 34 ++++++++++----------- package.json | 4 +-- src/MapLibreBasedGeocodingControl.ts | 6 ++-- src/leaflet-controller.ts | 14 ++++----- src/leaflet.ts | 4 +-- src/maplibregl-controller.ts | 16 +++++----- src/maplibregl.ts | 2 +- src/maptilersdk.ts | 2 +- src/mask.ts | 4 +-- src/openlayers-controller.ts | 36 ++++++++++++----------- src/openlayers.ts | 16 +++++----- src/react.ts | 6 ++-- src/types.ts | 4 +-- 25 files changed, 90 insertions(+), 89 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 88637a7..678ddd5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,9 +2,8 @@ name: Bug report about: Create a report to help us improve title: "[BUG]" -labels: '' +labels: "" assignees: zdila - --- **Describe the bug** @@ -19,6 +18,5 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. - **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 7dc4a27..a8b8112 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,9 +2,8 @@ name: Feature request about: Suggest an idea for this project title: "[FEATURE]" -labels: '' +labels: "" assignees: jachym - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1e56773..b283224 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,11 @@ ## Description + Short description, what this pull request is about and why should we merge it ## References -* Refence to an issue, which this PR is resolving + +- Refence to an issue, which this PR is resolving ## Mentions + Add contributors list, who are involved in this PR diff --git a/.prettierrc b/.prettierrc index ddc1a62..41ce08c 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,5 @@ { "plugins": ["prettier-plugin-svelte", "prettier-plugin-organize-imports"], - "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], "organizeImportsSkipDestructiveCodeActions": true } diff --git a/README.md b/README.md index 7ebaef2..329ad79 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ L.tileLayer( '© MapTiler, ' + '© OpenStreetMap contributors', crossOrigin: true, - } + }, ).addTo(map); L.control.maptilerGeocoding({ apiKey }).addTo(map); diff --git a/examples/leaflet/index.html b/examples/leaflet/index.html index cbfa327..20e9355 100644 --- a/examples/leaflet/index.html +++ b/examples/leaflet/index.html @@ -1,4 +1,4 @@ - + diff --git a/examples/maplibregl/index.html b/examples/maplibregl/index.html index 5730522..ecf6580 100644 --- a/examples/maplibregl/index.html +++ b/examples/maplibregl/index.html @@ -1,4 +1,4 @@ - + diff --git a/examples/openlayers/index.html b/examples/openlayers/index.html index 5c2143c..61149d7 100644 --- a/examples/openlayers/index.html +++ b/examples/openlayers/index.html @@ -1,4 +1,4 @@ - + diff --git a/examples/react/index.html b/examples/react/index.html index 5f535e6..bd49136 100644 --- a/examples/react/index.html +++ b/examples/react/index.html @@ -1,4 +1,4 @@ - + diff --git a/examples/standalone/leaflet.html b/examples/standalone/leaflet.html index 16f4130..499989c 100644 --- a/examples/standalone/leaflet.html +++ b/examples/standalone/leaflet.html @@ -1,4 +1,4 @@ - + © MapTiler, ' + '© OpenStreetMap contributors', crossOrigin: true, - } + }, ).addTo(map); L.control diff --git a/examples/standalone/maplibregl.html b/examples/standalone/maplibregl.html index 5058911..bf3280e 100644 --- a/examples/standalone/maplibregl.html +++ b/examples/standalone/maplibregl.html @@ -1,4 +1,4 @@ - + + diff --git a/package-lock.json b/package-lock.json index 3718510..8bb8423 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,9 +25,9 @@ "esm-env": "^1.0.0", "leaflet": "^1.9.4", "maplibre-gl": "^3.3.0", - "prettier": "^2.8.8", + "prettier": "^3.0.2", "prettier-plugin-organize-imports": "^3.2.3", - "prettier-plugin-svelte": "^2.10.1", + "prettier-plugin-svelte": "^3.0.3", "react": "^18.2.0", "react-dom": "^18.2.0", "renamer": "^4.0.0", @@ -2590,15 +2590,15 @@ "dev": true }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", + "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -2625,12 +2625,12 @@ } }, "node_modules/prettier-plugin-svelte": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.10.1.tgz", - "integrity": "sha512-Wlq7Z5v2ueCubWo0TZzKc9XHcm7TDxqcuzRuGd0gcENfzfT4JZ9yDlCbEgxWgiPmLHkBjfOtpAWkcT28MCDpUQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.3.tgz", + "integrity": "sha512-dLhieh4obJEK1hnZ6koxF+tMUrZbV5YGvRpf2+OADyanjya5j0z1Llo8iGwiHmFWZVG/hLEw/AJD5chXd9r3XA==", "dev": true, "peerDependencies": { - "prettier": "^1.16.4 || ^2.0.0", + "prettier": "^3.0.0", "svelte": "^3.2.0 || ^4.0.0-next.0" } }, @@ -5550,9 +5550,9 @@ "dev": true }, "prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", + "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", "dev": true }, "prettier-plugin-organize-imports": { @@ -5563,9 +5563,9 @@ "requires": {} }, "prettier-plugin-svelte": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.10.1.tgz", - "integrity": "sha512-Wlq7Z5v2ueCubWo0TZzKc9XHcm7TDxqcuzRuGd0gcENfzfT4JZ9yDlCbEgxWgiPmLHkBjfOtpAWkcT28MCDpUQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.0.3.tgz", + "integrity": "sha512-dLhieh4obJEK1hnZ6koxF+tMUrZbV5YGvRpf2+OADyanjya5j0z1Llo8iGwiHmFWZVG/hLEw/AJD5chXd9r3XA==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 11b9138..4938434 100644 --- a/package.json +++ b/package.json @@ -112,9 +112,9 @@ "esm-env": "^1.0.0", "leaflet": "^1.9.4", "maplibre-gl": "^3.3.0", - "prettier": "^2.8.8", + "prettier": "^3.0.2", "prettier-plugin-organize-imports": "^3.2.3", - "prettier-plugin-svelte": "^2.10.1", + "prettier-plugin-svelte": "^3.0.3", "react": "^18.2.0", "react-dom": "^18.2.0", "renamer": "^4.0.0", diff --git a/src/MapLibreBasedGeocodingControl.ts b/src/MapLibreBasedGeocodingControl.ts index 6976347..2614ba7 100644 --- a/src/MapLibreBasedGeocodingControl.ts +++ b/src/MapLibreBasedGeocodingControl.ts @@ -56,7 +56,7 @@ export type MapLibreBaseControlOptions = Omit & { export type Props = T extends SvelteComponent ? P : never; export abstract class MapLibreBasedGeocodingControl< - T extends MapLibreBaseControlOptions + T extends MapLibreBaseControlOptions, > extends EventTarget implements IControl @@ -73,7 +73,7 @@ export abstract class MapLibreBasedGeocodingControl< abstract getExtraProps( map: Map, - div: HTMLElement + div: HTMLElement, ): Partial>; onAdd(map: Map) { @@ -101,7 +101,7 @@ export abstract class MapLibreBasedGeocodingControl< showResultMarkers, flyToOptions, flyToOptions, - fullGeometryStyle + fullGeometryStyle, ); const props = { diff --git a/src/leaflet-controller.ts b/src/leaflet-controller.ts index 7bfdede..247aab9 100644 --- a/src/leaflet-controller.ts +++ b/src/leaflet-controller.ts @@ -34,7 +34,7 @@ export function createLeafletMapController( dashArray: [weight, weight], lineCap: "butt", }; - } + }, ) { let eventHandler: ((e: MapEvent) => void) | undefined; @@ -118,14 +118,14 @@ export function createLeafletMapController( fitBounds( bbox: [number, number, number, number], padding: number, - maxZoom: number + maxZoom: number, ): void { map.flyToBounds( [ [bbox[1], bbox[0]], [bbox[3], bbox[2]], ], - { padding: [padding, padding], duration: 2, maxZoom, ...flyToBounds } + { padding: [padding, padding], duration: 2, maxZoom, ...flyToBounds }, ); }, @@ -162,7 +162,7 @@ export function createLeafletMapController( setMarkers( markedFeatures: Feature[] | undefined, - picked: Feature | undefined + picked: Feature | undefined, ): void { if (!marker) { return; @@ -190,7 +190,7 @@ export function createLeafletMapController( if (picked.geometry.type === "GeometryCollection") { const geoms = picked.geometry.geometries.filter( (geometry) => - geometry.type === "Polygon" || geometry.type === "MultiPolygon" + geometry.type === "Polygon" || geometry.type === "MultiPolygon", ) as (Polygon | MultiPolygon)[]; if (geoms.length > 0) { @@ -209,7 +209,7 @@ export function createLeafletMapController( const geometries = picked.geometry.geometries.filter( (geometry) => geometry.type === "LineString" || - geometry.type === "MultiLineString" + geometry.type === "MultiLineString", ) as (LineString | MultiLineString)[]; if (geometries.length > 0) { @@ -245,7 +245,7 @@ export function createLeafletMapController( (typeof marker === "object" ? new L.Marker(pos, marker) : createMarker(pos) - ).addTo(map) + ).addTo(map), ); } diff --git a/src/leaflet.ts b/src/leaflet.ts index 09793ac..a9f17ae 100644 --- a/src/leaflet.ts +++ b/src/leaflet.ts @@ -74,7 +74,7 @@ export class GeocodingControl extends L.Control { showResultMarkers, flyToOptions, flyToOptions, - fullGeometryStyle + fullGeometryStyle, ); this.#gc = new GeocodingControlComponent({ @@ -97,7 +97,7 @@ export class GeocodingControl extends L.Control { "queryChange", ] as const) { this.#gc.$on(eventName, (event) => - map.fire(eventName.toLowerCase(), event.detail) + map.fire(eventName.toLowerCase(), event.detail), ); } diff --git a/src/maplibregl-controller.ts b/src/maplibregl-controller.ts index 0314548..90016c4 100644 --- a/src/maplibregl-controller.ts +++ b/src/maplibregl-controller.ts @@ -60,7 +60,7 @@ export function createMapLibreGlMapController( }, filter: ["!", ["has", "isMask"]], }, - } + }, ) { let eventHandler: ((e: MapEvent) => void) | undefined; @@ -176,14 +176,14 @@ export function createMapLibreGlMapController( fitBounds( bbox: [number, number, number, number], padding: number, - maxZoom: number + maxZoom: number, ): void { map.fitBounds( [ [bbox[0], bbox[1]], [bbox[2], bbox[3]], ], - { padding, maxZoom, ...fitBoundsOptions } + { padding, maxZoom, ...fitBoundsOptions }, ); }, @@ -219,7 +219,7 @@ export function createMapLibreGlMapController( setMarkers( markedFeatures: Feature[] | undefined, - picked: Feature | undefined + picked: Feature | undefined, ): void { if (!marker) { return; @@ -247,7 +247,7 @@ export function createMapLibreGlMapController( if (picked.geometry.type === "GeometryCollection") { const geoms = picked.geometry.geometries.filter( (geometry) => - geometry.type === "Polygon" || geometry.type === "MultiPolygon" + geometry.type === "Polygon" || geometry.type === "MultiPolygon", ) as (Polygon | MultiPolygon)[]; if (geoms.length > 0) { @@ -266,7 +266,7 @@ export function createMapLibreGlMapController( const geometries = picked.geometry.geometries.filter( (geometry) => geometry.type === "LineString" || - geometry.type === "MultiLineString" + geometry.type === "MultiLineString", ) as (LineString | MultiLineString)[]; if (geometries.length > 0) { @@ -303,7 +303,7 @@ export function createMapLibreGlMapController( : createMarker() ) .setLngLat(picked.center) - .addTo(map) + .addTo(map), ); } } @@ -326,7 +326,7 @@ export function createMapLibreGlMapController( closeButton: false, closeOnMove: true, className: "maptiler-gc-popup", - }).setText(feature.place_name.replace(/,.*/, "")) + }).setText(feature.place_name.replace(/,.*/, "")), ) .addTo(map); diff --git a/src/maplibregl.ts b/src/maplibregl.ts index 7c02e15..735f1df 100644 --- a/src/maplibregl.ts +++ b/src/maplibregl.ts @@ -22,7 +22,7 @@ export class GeocodingControl extends MapLibreBasedGeocodingControl { getExtraProps( _map: Map, - _div: HTMLElement + _div: HTMLElement, ): Partial> { return {}; } diff --git a/src/maptilersdk.ts b/src/maptilersdk.ts index 87cfe64..f5176ff 100644 --- a/src/maptilersdk.ts +++ b/src/maptilersdk.ts @@ -16,7 +16,7 @@ export class GeocodingControl extends MapLibreBasedGeocodingControl> { const sdkConfig: { apiKey?: string; language?: string } = {}; diff --git a/src/mask.ts b/src/mask.ts index d4421cc..e7e58d7 100644 --- a/src/mask.ts +++ b/src/mask.ts @@ -25,7 +25,7 @@ function fixRing(ring: Position[]) { export function setMask( picked: TurfFeature, - setData: (data: FeatureCollection) => void + setData: (data: FeatureCollection) => void, ) { const diff = difference( { @@ -40,7 +40,7 @@ export function setMask( ], ], }, - picked + picked, ); if (!diff) { diff --git a/src/openlayers-controller.ts b/src/openlayers-controller.ts index 8168373..601ccc2 100644 --- a/src/openlayers-controller.ts +++ b/src/openlayers-controller.ts @@ -86,7 +86,7 @@ export function createOpenLayersMapController( map: Map, flyToOptions: AnimationOptions = {}, flyToBounds: FitOptions = {}, - fullGeometryStyle: StyleLike | FlatStyleLike = defaultStyle + fullGeometryStyle: StyleLike | FlatStyleLike = defaultStyle, ) { let prevSelected = -1; @@ -178,7 +178,7 @@ export function createOpenLayersMapController( type: "mapClick", coordinates: toLonLat(e.coordinate, map.getView().getProjection()) as [ number, - number + number, ], }); }; @@ -210,7 +210,7 @@ export function createOpenLayersMapController( fitBounds( bbox: [number, number, number, number], padding: number, - maxZoom: number + maxZoom: number, ): void { map .getView() @@ -238,12 +238,12 @@ export function createOpenLayersMapController( reverseMarker = undefined; } else { (reverseMarker.getGeometry() as Point).setCoordinates( - fromLonLat(coordinates, map.getView().getProjection()) + fromLonLat(coordinates, map.getView().getProjection()), ); } } else if (coordinates) { reverseMarker = new Feature( - new Point(fromLonLat(coordinates, map.getView().getProjection())) + new Point(fromLonLat(coordinates, map.getView().getProjection())), ); reverseMarker.setProperties({ isReverse: true }); @@ -254,7 +254,7 @@ export function createOpenLayersMapController( setMarkers( markedFeatures: FeatureType[] | undefined, - picked: FeatureType | undefined + picked: FeatureType | undefined, ): void { function setData(data?: FeatureCollection) { if (!data) { @@ -277,7 +277,7 @@ export function createOpenLayersMapController( new Feature({ isMask: !!f.properties?.isMask, geometry: fromWgs84(geom), - }) + }), ); } } @@ -300,13 +300,13 @@ export function createOpenLayersMapController( ? new OlPolygon(geometry.coordinates) : geometry.type === "MultiPolygon" ? new OlMultiPolygon(geometry.coordinates) - : null + : null, ) .filter((a: T | null): a is T => !!a); if (geoms.length > 0) { source.addFeature( - new Feature(fromWgs84(new OlGeometryCollection(geoms))) + new Feature(fromWgs84(new OlGeometryCollection(geoms))), ); handled = true; @@ -314,15 +314,17 @@ export function createOpenLayersMapController( for (const geometry of picked.geometry.geometries) { if (geometry.type === "LineString") { source.addFeature( - new Feature(fromWgs84(new OlLineString(geometry.coordinates))) + new Feature( + fromWgs84(new OlLineString(geometry.coordinates)), + ), ); handled = true; } else if (geometry.type === "MultiLineString") { source.addFeature( new Feature( - fromWgs84(new OlMultiLineString(geometry.coordinates)) - ) + fromWgs84(new OlMultiLineString(geometry.coordinates)), + ), ); } @@ -340,16 +342,16 @@ export function createOpenLayersMapController( } else if (picked.geometry.type === "LineString") { source.addFeature( new Feature( - fromWgs84(new OlLineString(picked.geometry.coordinates)) - ) + fromWgs84(new OlLineString(picked.geometry.coordinates)), + ), ); return; // no pin for (multi)linestrings } else if (picked.geometry.type === "MultiLineString") { source.addFeature( new Feature( - fromWgs84(new OlMultiLineString(picked.geometry.coordinates)) - ) + fromWgs84(new OlMultiLineString(picked.geometry.coordinates)), + ), ); return; // no pin for (multi)linestrings @@ -364,7 +366,7 @@ export function createOpenLayersMapController( } const marker = new Feature( - new Point(fromLonLat(feature.center, map.getView().getProjection())) + new Point(fromLonLat(feature.center, map.getView().getProjection())), ); marker.setId(feature.id); diff --git a/src/openlayers.ts b/src/openlayers.ts index 49fbaa9..1bb1096 100644 --- a/src/openlayers.ts +++ b/src/openlayers.ts @@ -87,27 +87,27 @@ export class GeocodingControl extends Control { switch (eventName) { case "select": this.dispatchEvent( - new SelectEvent(event.detail as Feature | undefined) + new SelectEvent(event.detail as Feature | undefined), ); break; case "featuresListed": this.dispatchEvent( - new FeaturesListedEvent(event.detail as Feature[] | undefined) + new FeaturesListedEvent(event.detail as Feature[] | undefined), ); break; case "featuresMarked": this.dispatchEvent( - new FeaturesMarkedEvent(event.detail as Feature[] | undefined) + new FeaturesMarkedEvent(event.detail as Feature[] | undefined), ); break; case "optionsVisibilityChange": this.dispatchEvent( - new OptionsVisibilityChangeEvent(event.detail as boolean) + new OptionsVisibilityChangeEvent(event.detail as boolean), ); break; case "pick": this.dispatchEvent( - new PickEvent(event.detail as Feature | undefined) + new PickEvent(event.detail as Feature | undefined), ); break; case "queryChange": @@ -119,8 +119,8 @@ export class GeocodingControl extends Control { (event.detail as { url: string }).url, ( event.detail as { featureCollection: FeatureCollection } - ).featureCollection - ) + ).featureCollection, + ), ); break; case "reverseToggle": @@ -150,7 +150,7 @@ export class GeocodingControl extends Control { typeof flyTo === "boolean" ? undefined : flyTo, // marker, // showResultMarkers, - fullGeometryStyle + fullGeometryStyle, ); this.#gc?.$set({ mapController }); diff --git a/src/react.ts b/src/react.ts index 0cb518b..81f1bce 100644 --- a/src/react.ts +++ b/src/react.ts @@ -15,7 +15,7 @@ type EventHandlerFnName = `on${Capitalize}`; type CallbackProperties = { [K in keyof T as EventHandlerFnName>]?: ( - event: T[K] + event: T[K], ) => void; }; @@ -84,7 +84,7 @@ export type Methods = { const ReactGeocodingControl = forwardRef(function ReactGeocodingControl( props: Props, - ref: Ref + ref: Ref, ) { const divRef = useRef(); @@ -131,7 +131,7 @@ const ReactGeocodingControl = forwardRef(function ReactGeocodingControl( (eventHandlerFn as any)(e.detail); }), - [eventHandlerFn] + [eventHandlerFn], ); } diff --git a/src/types.ts b/src/types.ts index 61b5739..b0f509b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -38,14 +38,14 @@ export type MapController = { fitBounds( bbox: [number, number, number, number], padding: number, - maxZoom: number + maxZoom: number, ): void; indicateReverse(reverse: boolean): void; setMarkers( features: Feature[] | undefined, - picked: Feature | undefined + picked: Feature | undefined, ): void; setReverseMarker(coordinates?: [number, number]): void;