From 739c7193095f9617123d40e54983f6f5492d40ea Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 2 Sep 2025 22:47:22 +0100 Subject: [PATCH] Fix new eslint warnings --- app/assets/javascripts/index/contextmenu.js | 8 ++++---- .../javascripts/index/directions-route-output.js | 2 +- app/assets/javascripts/index/element.js | 4 ++-- app/assets/javascripts/index/note.js | 8 ++++---- config/eslint.config.mjs | 2 +- test/javascripts/osm_test.js | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/index/contextmenu.js b/app/assets/javascripts/index/contextmenu.js index dcdfc9e44..4350b012e 100644 --- a/app/assets/javascripts/index/contextmenu.js +++ b/app/assets/javascripts/index/contextmenu.js @@ -5,8 +5,8 @@ OSM.initializeContextMenu = function (map) { const latlng = OSM.cropLocation(e.latlng, map.getZoom()); OSM.router.route("/directions?" + new URLSearchParams({ - from: latlng.join(","), - to: getDirectionsEndpointCoordinatesFromInput($("#route_to")) + "from": latlng.join(","), + "to": getDirectionsEndpointCoordinatesFromInput($("#route_to")) })); } }); @@ -17,8 +17,8 @@ OSM.initializeContextMenu = function (map) { const latlng = OSM.cropLocation(e.latlng, map.getZoom()); OSM.router.route("/directions?" + new URLSearchParams({ - from: getDirectionsEndpointCoordinatesFromInput($("#route_from")), - to: latlng.join(",") + "from": getDirectionsEndpointCoordinatesFromInput($("#route_from")), + "to": latlng.join(",") })); } }); diff --git a/app/assets/javascripts/index/directions-route-output.js b/app/assets/javascripts/index/directions-route-output.js index 36a49d47d..71d62b707 100644 --- a/app/assets/javascripts/index/directions-route-output.js +++ b/app/assets/javascripts/index/directions-route-output.js @@ -130,7 +130,7 @@ OSM.DirectionsRouteOutput = function (map) { writeSteps(route); }); - const blob = new Blob([JSON.stringify(polyline.toGeoJSON())], { type: "application/json" }); + const blob = new Blob([JSON.stringify(polyline.toGeoJSON())], { "type": "application/json" }); URL.revokeObjectURL(downloadURL); downloadURL = URL.createObjectURL(blob); $("#directions_route_download").prop("href", downloadURL); diff --git a/app/assets/javascripts/index/element.js b/app/assets/javascripts/index/element.js index b952c8a64..c98fba7e4 100644 --- a/app/assets/javascripts/index/element.js +++ b/app/assets/javascripts/index/element.js @@ -40,7 +40,7 @@ page._addObject = function (type, id, version, center) { const hashParams = OSM.parseHash(); - map.addObject({ type: type, id: parseInt(id, 10), version: version && parseInt(version, 10) }, function (bounds) { + map.addObject({ "type": type, "id": parseInt(id, 10), "version": version && parseInt(version, 10) }, function (bounds) { if (!hashParams.center && bounds.isValid() && (center || !map.getBounds().contains(bounds))) { OSM.router.withoutMoveListener(function () { @@ -111,7 +111,7 @@ } function renderWikidataResponse({ icon, label, article, description }, $link) { - const localeName = new Intl.DisplayNames(OSM.preferred_languages, { type: "language" }); + const localeName = new Intl.DisplayNames(OSM.preferred_languages, { "type": "language" }); const cell = $("") .attr("colspan", 2) .addClass("bg-body-tertiary"); diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index a587daf49..31455f5f4 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -66,10 +66,10 @@ OSM.Note = function (map) { if (data) { const hashParams = OSM.parseHash(); map.addObject({ - type: "note", - id: parseInt(id, 10), - latLng: L.latLng(data.coordinates.split(",")), - icon: OSM.noteMarkers[data.status] + "type": "note", + "id": parseInt(id, 10), + "latLng": L.latLng(data.coordinates.split(",")), + "icon": OSM.noteMarkers[data.status] }, function () { if (!hashParams.center && !skipMoveToNote) { const latLng = L.latLng(data.coordinates.split(",")); diff --git a/config/eslint.config.mjs b/config/eslint.config.mjs index cbb698da8..09528c57e 100644 --- a/config/eslint.config.mjs +++ b/config/eslint.config.mjs @@ -59,7 +59,7 @@ export default [ "@stylistic/eol-last": "error", "@stylistic/function-call-spacing": "error", "@stylistic/indent": ["error", 2, { - CallExpression: { arguments: "first" }, + CallExpression: { "arguments": "first" }, FunctionDeclaration: { parameters: "first" }, FunctionExpression: { parameters: "first" }, SwitchCase: 1, diff --git a/test/javascripts/osm_test.js b/test/javascripts/osm_test.js index c5be6b5f6..608cc5af3 100644 --- a/test/javascripts/osm_test.js +++ b/test/javascripts/osm_test.js @@ -8,15 +8,15 @@ describe("OSM", function () { describe(".apiUrl", function () { it("returns a URL for a way", function () { - expect(OSM.apiUrl({ type: "way", id: 10 })).to.eq("/api/0.6/way/10/full"); + expect(OSM.apiUrl({ "type": "way", "id": 10 })).to.eq("/api/0.6/way/10/full"); }); it("returns a URL for a node", function () { - expect(OSM.apiUrl({ type: "node", id: 10 })).to.eq("/api/0.6/node/10"); + expect(OSM.apiUrl({ "type": "node", "id": 10 })).to.eq("/api/0.6/node/10"); }); it("returns a URL for a specific version", function () { - expect(OSM.apiUrl({ type: "node", id: 10, version: 2 })).to.eq("/api/0.6/node/10/2"); + expect(OSM.apiUrl({ "type": "node", "id": 10, "version": 2 })).to.eq("/api/0.6/node/10/2"); }); }); @@ -41,15 +41,15 @@ describe("OSM", function () { it("parses object params", function () { let params = OSM.mapParams("?node=1"); expect(params).to.have.property("object"); - expect(params.object).to.eql({ type: "node", id: 1 }); + expect(params.object).to.eql({ "type": "node", "id": 1 }); params = OSM.mapParams("?way=1"); expect(params).to.have.property("object"); - expect(params.object).to.eql({ type: "way", id: 1 }); + expect(params.object).to.eql({ "type": "way", "id": 1 }); params = OSM.mapParams("?relation=1"); expect(params).to.have.property("object"); - expect(params.object).to.eql({ type: "relation", id: 1 }); + expect(params.object).to.eql({ "type": "relation", "id": 1 }); }); it("parses bbox params", function () { -- 2.39.5