Chore: lint code

This commit is contained in:
Pieter Vander Vennet 2024-10-19 14:48:48 +02:00
parent 40e894df8b
commit 8173fb15b9
7 changed files with 29 additions and 38 deletions

12
package-lock.json generated
View file

@ -7980,9 +7980,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001668", "version": "1.0.30001669",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz",
"integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==", "integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -26810,9 +26810,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001668", "version": "1.0.30001669",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz",
"integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==", "integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==",
"dev": true "dev": true
}, },
"canonicalize": { "canonicalize": {

View file

@ -43,12 +43,9 @@ class LuaSnippets {
or.push(new RegexTag(k, v)) or.push(new RegexTag(k, v))
}) })
}) })
const features = or.map((t) => t.asHumanString(false, false, {})) const features = or.map((t) => t.asHumanString(false, false, {}))
features.sort() features.sort()
console.log( console.log("Polygon features are:", features)
"Polygon features are:",
features
)
return { blacklist: new Or(blacklisted), whitelisted: new Or(or) } return { blacklist: new Or(blacklisted), whitelisted: new Or(or) }
} }

View file

@ -167,13 +167,10 @@ describe("ImageProviders", () => {
id: "196804715753265", id: "196804715753265",
captured_at: 1627748022000, captured_at: 1627748022000,
"compass_angle": 0, compass_angle: 0,
"geometry": { geometry: {
"type": "Point", type: "Point",
"coordinates": [ coordinates: [3.2153751999722, 51.215653199972],
3.2153751999722,
51.215653199972
]
}, },
creator: { creator: {
username: "filipc", username: "filipc",

View file

@ -1,6 +1,9 @@
import { Utils } from "../../../../src/Utils" import { Utils } from "../../../../src/Utils"
import { OsmRelation } from "../../../../src/Logic/Osm/OsmObject" import { OsmRelation } from "../../../../src/Logic/Osm/OsmObject"
import { InPlaceReplacedmentRTSH, TurnRestrictionRSH } from "../../../../src/Logic/Osm/Actions/RelationSplitHandler" import {
InPlaceReplacedmentRTSH,
TurnRestrictionRSH,
} from "../../../../src/Logic/Osm/Actions/RelationSplitHandler"
import { Changes } from "../../../../src/Logic/Osm/Changes" import { Changes } from "../../../../src/Logic/Osm/Changes"
import { describe, expect, it } from "vitest" import { describe, expect, it } from "vitest"
import OsmObjectDownloader from "../../../../src/Logic/Osm/OsmObjectDownloader" import OsmObjectDownloader from "../../../../src/Logic/Osm/OsmObjectDownloader"
@ -648,7 +651,7 @@ describe("RelationSplitHandler", () => {
downloader downloader
) )
const changeDescription = await splitter.CreateChangeDescriptions( const changeDescription = await splitter.CreateChangeDescriptions(
Changes.createTestObject() Changes.createTestObject()
) )
const allIds = changeDescription[0].changes["members"].map((m) => m.ref).join(",") const allIds = changeDescription[0].changes["members"].map((m) => m.ref).join(",")
const expected = "687866206,295132739,-1,690497698" const expected = "687866206,295132739,-1,690497698"

View file

@ -8,7 +8,6 @@ import { Changes } from "../../../../src/Logic/Osm/Changes"
import FullNodeDatabaseSource from "../../../../src/Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource" import FullNodeDatabaseSource from "../../../../src/Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
describe("ReplaceGeometryAction", () => { describe("ReplaceGeometryAction", () => {
const coordinates = <[number, number][]>[ const coordinates = <[number, number][]>[
[3.216690793633461, 51.21474084112525], [3.216690793633461, 51.21474084112525],
[3.2167256623506546, 51.214696737309964], [3.2167256623506546, 51.214696737309964],

View file

@ -2715,7 +2715,7 @@ describe("SplitAction", () => {
theme: "test", theme: "test",
}) })
const changeDescription = await splitter.CreateChangeDescriptions( const changeDescription = await splitter.CreateChangeDescriptions(
Changes.createTestObject() Changes.createTestObject()
) )
expect(changeDescription.length).toBe(2) expect(changeDescription.length).toBe(2)
@ -2748,9 +2748,7 @@ describe("SplitAction", () => {
const splitAction = new SplitAction("way/941079939", [splitPointAroundP3], { const splitAction = new SplitAction("way/941079939", [splitPointAroundP3], {
theme: "test", theme: "test",
}) })
const changes = await splitAction.Perform( const changes = await splitAction.Perform(Changes.createTestObject())
Changes.createTestObject()
)
console.log(changes) console.log(changes)
// 8715440368 is the expected point of the split // 8715440368 is the expected point of the split
@ -2788,9 +2786,7 @@ describe("SplitAction", () => {
{ theme: "test" }, { theme: "test" },
1 1
) )
const changes = await splitAction.Perform( const changes = await splitAction.Perform(Changes.createTestObject())
Changes.createTestObject()
)
// THe first change is the creation of the new node // THe first change is the creation of the new node
expect(changes[0].type).toEqual("node") expect(changes[0].type).toEqual("node")

View file

@ -7,8 +7,7 @@ import { describe, expect, it } from "vitest"
function elstorage() { function elstorage() {
return { return {
addAlias: (_, __) => { addAlias: (_, __) => {},
},
} }
} }
@ -19,7 +18,7 @@ function createChangesetHandler(): ChangesetHandler {
new OsmConnection({}), new OsmConnection({}),
elstorage(), elstorage(),
changes, changes,
e => console.error(e), (e) => console.error(e)
) )
} }
@ -63,13 +62,13 @@ describe("ChangesetHanlder", () => {
}, },
], ],
new Map<string, string>(), new Map<string, string>(),
oldChangesetMeta, oldChangesetMeta
) )
const d = Utils.asDict(rewritten) const d = Utils.asDict(rewritten)
expect(d.size).toEqual(10) expect(d.size).toEqual(10)
expect(d.get("answer")).toEqual("5") expect(d.get("answer")).toEqual("5")
expect(d.get("comment")).toEqual( expect(d.get("comment")).toEqual(
"Adding data with #MapComplete for theme #toerisme_vlaanderen", "Adding data with #MapComplete for theme #toerisme_vlaanderen"
) )
expect(d.get("created_by")).toEqual("MapComplete 0.16.6") expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html") expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html")
@ -116,14 +115,14 @@ describe("ChangesetHanlder", () => {
}, },
], ],
new Map<string, string>(), new Map<string, string>(),
oldChangesetMeta, oldChangesetMeta
) )
const d = Utils.asDict(rewritten) const d = Utils.asDict(rewritten)
expect(d.size).toEqual(9) expect(d.size).toEqual(9)
expect(d.get("answer")).toEqual("42") expect(d.get("answer")).toEqual("42")
expect(d.get("comment")).toEqual( expect(d.get("comment")).toEqual(
"Adding data with #MapComplete for theme #toerisme_vlaanderen", "Adding data with #MapComplete for theme #toerisme_vlaanderen"
) )
expect(d.get("created_by")).toEqual("MapComplete 0.16.6") expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html") expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html")
@ -163,14 +162,14 @@ describe("ChangesetHanlder", () => {
const rewritten = changesetHandler.RewriteTagsOf( const rewritten = changesetHandler.RewriteTagsOf(
[], [],
new Map<string, string>([["node/-1", "node/42"]]), new Map<string, string>([["node/-1", "node/42"]]),
oldChangesetMeta, oldChangesetMeta
) )
const d = Utils.asDict(rewritten) const d = Utils.asDict(rewritten)
expect(d.size).toEqual(9) expect(d.size).toEqual(9)
expect(d.get("answer")).toEqual("5") expect(d.get("answer")).toEqual("5")
expect(d.get("comment")).toEqual( expect(d.get("comment")).toEqual(
"Adding data with #MapComplete for theme #toerisme_vlaanderen", "Adding data with #MapComplete for theme #toerisme_vlaanderen"
) )
expect(d.get("created_by")).toEqual("MapComplete 0.16.6") expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html") expect(d.get("host")).toEqual("https://mapcomplete.org/toerisme_vlaanderen.html")
@ -196,7 +195,7 @@ describe("ChangesetHanlder", () => {
const changes = new Map<string, string>([["node/-1", "node/42"]]) const changes = new Map<string, string>([["node/-1", "node/42"]])
const hasSpecialMotivationChanges = ChangesetHandler.rewriteMetaTags( const hasSpecialMotivationChanges = ChangesetHandler.rewriteMetaTags(
extraMetaTags, extraMetaTags,
changes, changes
) )
// "Special rewrite did not trigger" // "Special rewrite did not trigger"
expect(hasSpecialMotivationChanges).toBe(true) expect(hasSpecialMotivationChanges).toBe(true)