Chore: fix linting errors, obsolete console.logs and typos

This commit is contained in:
Pieter Vander Vennet 2024-04-12 15:37:10 +02:00
parent e2aaa7d435
commit 0a73b28ee1
4 changed files with 6 additions and 13 deletions

View file

@ -84,7 +84,7 @@ export class ReferencingWaysMetaTagger extends SimpleMetaTagger {
super({ super({
keys: ["_referencing_ways"], keys: ["_referencing_ways"],
isLazy: true, isLazy: true,
doc: "_referencing_ways contains - for a node - which ways use this this node as point in their geometry. ", doc: "_referencing_ways contains - for a node - which ways use this node as point in their geometry. ",
}) })
} }

View file

@ -17,7 +17,7 @@
id = $tags.id id = $tags.id
} }
let txt = new UIEventSource(undefined) let txt: UIEventSource<string> = new UIEventSource(undefined)
let _txt: string = undefined let _txt: string = undefined
txt.addCallbackD((t) => { txt.addCallbackD((t) => {
_txt = t _txt = t

View file

@ -49,13 +49,13 @@ export default class NoteCommentElement extends Combine {
user = new Link(comment.user, comment.user_url ?? "", true) user = new Link(comment.user, comment.user_url ?? "", true)
} }
let userinfo = Stores.FromPromise( const userinfo = Stores.FromPromise(
Utils.downloadJsonCached( Utils.downloadJsonCached(
"https://api.openstreetmap.org/api/0.6/user/" + comment.uid, "https://api.openstreetmap.org/api/0.6/user/" + comment.uid,
24 * 60 * 60 * 1000 24 * 60 * 60 * 1000
) )
) )
let userImg = new VariableUiElement( const userImg = new VariableUiElement(
userinfo.map((userinfo) => { userinfo.map((userinfo) => {
const href = userinfo?.user?.img?.href const href = userinfo?.user?.img?.href
if (href !== undefined) { if (href !== undefined) {
@ -123,7 +123,7 @@ export default class NoteCommentElement extends Combine {
const comments: any[] = JSON.parse(tags.data["comments"]) const comments: any[] = JSON.parse(tags.data["comments"])
const username = state.osmConnection.userDetails.data.name const username = state.osmConnection.userDetails.data.name
var urlRegex = /(https?:\/\/[^\s]+)/g const urlRegex = /(https?:\/\/[^\s]+)/g
const html = txt.replace(urlRegex, function (url) { const html = txt.replace(urlRegex, function (url) {
return '<a href="' + url + '">' + url + "</a>" return '<a href="' + url + '">' + url + "</a>"
}) })

View file

@ -11,16 +11,11 @@ import { And } from "../../Logic/Tags/And"
import Toggle from "../Input/Toggle" import Toggle from "../Input/Toggle"
import { Utils } from "../../Utils" import { Utils } from "../../Utils"
import { Tag } from "../../Logic/Tags/Tag" import { Tag } from "../../Logic/Tags/Tag"
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
import { Changes } from "../../Logic/Osm/Changes"
import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization" import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization"
import { IndexedFeatureSource } from "../../Logic/FeatureSource/FeatureSource"
import { Feature } from "geojson" import { Feature } from "geojson"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
import Maproulette from "../../Logic/Maproulette" import Maproulette from "../../Logic/Maproulette"
import SvelteUIElement from "../Base/SvelteUIElement" import SvelteUIElement from "../Base/SvelteUIElement"
import Icon from "../Map/Icon.svelte" import Icon from "../Map/Icon.svelte"
import { Map } from "maplibre-gl"
export default class TagApplyButton implements AutoAction, SpecialVisualization { export default class TagApplyButton implements AutoAction, SpecialVisualization {
public readonly funcName = "tag_apply" public readonly funcName = "tag_apply"
@ -177,7 +172,6 @@ export default class TagApplyButton implements AutoAction, SpecialVisualization
tags: UIEventSource<Record<string, string>>, tags: UIEventSource<Record<string, string>>,
args: string[], args: string[],
feature: Feature, feature: Feature,
_: LayerConfig
): BaseUIElement { ): BaseUIElement {
const tagsToApply = TagApplyButton.generateTagsToApply(args[0], tags) const tagsToApply = TagApplyButton.generateTagsToApply(args[0], tags)
const msg = args[1] const msg = args[1]
@ -200,7 +194,6 @@ export default class TagApplyButton implements AutoAction, SpecialVisualization
return el return el
}) })
).SetClass("subtle") ).SetClass("subtle")
const self = this
const applied = new UIEventSource( const applied = new UIEventSource(
tags?.data?.["mr_taskStatus"] !== undefined && tags?.data?.["mr_taskStatus"] !== undefined &&
tags?.data?.["mr_taskStatus"] !== "Created" tags?.data?.["mr_taskStatus"] !== "Created"
@ -210,7 +203,7 @@ export default class TagApplyButton implements AutoAction, SpecialVisualization
new Combine([msg, tagsExplanation]).SetClass("flex flex-col") new Combine([msg, tagsExplanation]).SetClass("flex flex-col")
).onClick(async () => { ).onClick(async () => {
applied.setData(true) applied.setData(true)
await self.applyActionOn(feature, state, tags, args) await this.applyActionOn(feature, state, tags, args)
}) })
return new Toggle( return new Toggle(