diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 7d4999d..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@patternslib/dev/.eslintrc.js"); diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7f7d168..b4af49a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' cache: 'yarn' - run: | make install diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec..0000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index 086c1d7..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx yarn commitlint --edit $1 diff --git a/Makefile b/Makefile index 3f1b67b..612da6c 100644 --- a/Makefile +++ b/Makefile @@ -18,13 +18,10 @@ -include .env export +YARN ?= npx yarn -.PHONY: install -stamp-yarn install: - npx yarn install - # Install pre commit hook - npx yarn husky install - touch stamp-yarn +yarn.lock install: + $(YARN) install # Unlink any linked dependencies before building a bundle. diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..a284b5c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1 @@ +module.exports = require("@patternslib/dev/eslint.config.js"); diff --git a/index.html b/index.html index 24a34fd..951674b 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ - + - - - + + + diff --git a/package.json b/package.json index 2721132..9a2c104 100644 --- a/package.json +++ b/package.json @@ -5,22 +5,22 @@ "license": "MIT", "main": "./src/leaflet.js", "dependencies": { - "@patternslib/patternslib": ">=9.9.16", + "@patternslib/patternslib": ">=9.10.3", "fontawesome-free": "^1.0.4", "jquery": "^3.7.1", "leaflet": "^1.9.4", - "leaflet-geosearch": "^4.0.0", + "leaflet-geosearch": "^4.2.0", "leaflet-minimap": "^3.6.1", "leaflet-providers": "^2.0.0", "leaflet-sleep": "^0.5.2", "leaflet.awesome-markers": "^2.0.5", - "leaflet.fullscreen": "^3.0.2", - "leaflet.locatecontrol": "^0.81.1", + "leaflet.fullscreen": "^4.0.0", + "leaflet.locatecontrol": "^0.84.2", "leaflet.markercluster": "^1.5.3", "leaflet.simplemarkers": "git+https://github.com/jdomingu/Leaflet.SimpleMarkers.git" }, "devDependencies": { - "@patternslib/dev": "^3.6.1" + "@patternslib/dev": "^3.8.1" }, "scripts": { "start": "NODE_ENV=development webpack serve --config webpack.config.js", diff --git a/src/index.html b/src/index.html index 7e8e20e..6328f6c 100644 --- a/src/index.html +++ b/src/index.html @@ -1,16 +1,19 @@ - + - - - leaflet demo - - - - - -

pat-leaflet demo - minimal

-
-
pat-leaflet demo - minimal "geosearch": true, "latitude": 47.33325135, "longitude": 9.645877746692685 - }'>
-
+ }' + > + -

pat-leaflet demo - full

-
-
pat-leaflet demo - full "maxClusterRadius": 80, "useCluster": true }' - data-geojson='{ + data-geojson='{ "type": "FeatureCollection", "features": [ { @@ -85,10 +92,10 @@

pat-leaflet demo - full

] } } -]}'>
- - -
- - +]}' + > + + + + diff --git a/src/leaflet.js b/src/leaflet.js index b4cb7e9..b4e623a 100644 --- a/src/leaflet.js +++ b/src/leaflet.js @@ -123,7 +123,7 @@ class Pattern extends BasePattern { // build layers object with tileLayer instances baseLayers[layer.title] = this.L.tileLayer.provider( layer.id, - layer.options + layer.options, ); } if (options.map_layers.length > 1) { @@ -150,9 +150,9 @@ class Pattern extends BasePattern { response = await fetch(options.geojson_ajaxurl); const data = await response.json(); this.init_geojson(map, data); - } catch (e) { + } catch { log.info( - `Could not load geojson data from url ${options.geojson_ajaxurl}` + `Could not load geojson data from url ${options.geojson_ajaxurl}`, ); return; } @@ -160,7 +160,7 @@ class Pattern extends BasePattern { try { // inject inline geoJSON data object this.init_geojson(map, JSON.parse(this.el.dataset.geojson)); - } catch (e) { + } catch { log.info("Could not parse geojson data."); return; } @@ -198,7 +198,7 @@ class Pattern extends BasePattern { e.marker.setIcon(this.create_marker("red")); this.bind_popup( { properties: { editable: true, popup: e.location.label } }, - e.marker + e.marker, ); this.marker_cluster.addLayer(e.marker); } @@ -229,9 +229,9 @@ class Pattern extends BasePattern { const minimap = new this.L.Control.MiniMap( this.L.tileLayer.provider( options.default_map_layer.id, - options.default_map_layer.options + options.default_map_layer.options, ), - { toggleDisplay: true, mapOptions: { sleep: false } } + { toggleDisplay: true, mapOptions: { sleep: false } }, ); map.addControl(minimap); } @@ -290,7 +290,7 @@ class Pattern extends BasePattern { // fit bounds bounds = this.marker_cluster.getBounds(); map.fitBounds(bounds, this.fitBoundsOptions); - } + }, ); } if (input_lng) { @@ -309,7 +309,7 @@ class Pattern extends BasePattern { // fit bounds bounds = this.marker_cluster.getBounds(); map.fitBounds(bounds, this.fitBoundsOptions); - } + }, ); } return marker; diff --git a/src/leaflet.test.js b/src/leaflet.test.js index f5090e2..cd6490a 100644 --- a/src/leaflet.test.js +++ b/src/leaflet.test.js @@ -73,7 +73,7 @@ describe("pat-leaflet", () => { }, ], }), - }) + }), ); document.body.innerHTML = `