Chore: fix warnings

This commit is contained in:
Pieter Vander Vennet 2023-06-02 08:42:08 +02:00
parent ab70c6adc0
commit 47ae4cb456
38 changed files with 49 additions and 90 deletions

View file

@ -1,10 +1,6 @@
import { Store, UIEventSource } from "../UIEventSource"
import { Utils } from "../../Utils"
import {
AvailableRasterLayers,
RasterLayerPolygon,
RasterLayerUtils,
} from "../../Models/RasterLayers"
import {Store, UIEventSource} from "../UIEventSource"
import {Utils} from "../../Utils"
import {RasterLayerPolygon, RasterLayerUtils,} from "../../Models/RasterLayers"
/**
* When a user pans around on the map, they might pan out of the range of the current background raster layer.

View file

@ -1,5 +1,5 @@
import { FeatureSource, IndexedFeatureSource } from "../FeatureSource"
import { UIEventSource } from "../../UIEventSource"
import {FeatureSource} from "../FeatureSource"
import {UIEventSource} from "../../UIEventSource"
/**
* Constructs a UIEventStore for the properties of every Feature, indexed by id

View file

@ -1,6 +1,5 @@
import { Store, UIEventSource } from "../UIEventSource"
import FilteredLayer from "../../Models/FilteredLayer"
import { BBox } from "../BBox"
import { Feature } from "geojson"
export interface FeatureSource<T extends Feature = Feature> {

View file

@ -12,8 +12,8 @@ export class WikidataImageProvider extends ImageProvider {
super()
}
public SourceIcon(backlinkSource?: string): BaseUIElement {
throw Svg.wikidata_svg()
public SourceIcon(_?: string): BaseUIElement {
return Svg.wikidata_svg()
}
public async ExtractUrls(key: string, value: string): Promise<Promise<ProvidedImage>[]> {
@ -48,7 +48,7 @@ export class WikidataImageProvider extends ImageProvider {
return allImages
}
public DownloadAttribution(url: string): Promise<any> {
public DownloadAttribution(_: string): Promise<any> {
throw new Error("Method not implemented; shouldn't be needed!")
}
}

View file

@ -80,7 +80,6 @@ export class WikimediaImageProvider extends ImageProvider {
}
public PrepUrl(value: string): ProvidedImage {
const hasCommonsPrefix = WikimediaImageProvider.startsWithCommonsPrefix(value)
value = WikimediaImageProvider.removeCommonsPrefix(value)
if (value.startsWith("File:")) {

View file

@ -1,6 +1,5 @@
import { ChangeDescription } from "./ChangeDescription"
import OsmChangeAction from "./OsmChangeAction"
import { Changes } from "../Changes"
export default class ChangeLocationAction extends OsmChangeAction {
private readonly _id: number

View file

@ -1,5 +1,4 @@
import OsmChangeAction from "./OsmChangeAction"
import { Changes } from "../Changes"
import { ChangeDescription } from "./ChangeDescription"
import { TagsFilter } from "../../Tags/TagsFilter"
import { OsmTags } from "../../../Models/OsmFeature"

View file

@ -1,9 +1,9 @@
import { ChangeDescription } from "./ChangeDescription"
import {OsmCreateAction, PreviewableAction} from "./OsmChangeAction"
import { Changes } from "../Changes"
import { Tag } from "../../Tags/Tag"
import {ChangeDescription} from "./ChangeDescription"
import {OsmCreateAction} from "./OsmChangeAction"
import {Changes} from "../Changes"
import {Tag} from "../../Tags/Tag"
import CreateNewNodeAction from "./CreateNewNodeAction"
import { And } from "../../Tags/And"
import {And} from "../../Tags/And"
export default class CreateNewWayAction extends OsmCreateAction {
public newElementId: string = undefined

View file

@ -1,10 +1,10 @@
import { OsmObject, OsmWay } from "../OsmObject"
import { Changes } from "../Changes"
import { GeoOperations } from "../../GeoOperations"
import {OsmWay} from "../OsmObject"
import {Changes} from "../Changes"
import {GeoOperations} from "../../GeoOperations"
import OsmChangeAction from "./OsmChangeAction"
import { ChangeDescription } from "./ChangeDescription"
import {ChangeDescription} from "./ChangeDescription"
import RelationSplitHandler from "./RelationSplitHandler"
import { Feature, LineString } from "geojson"
import {Feature, LineString} from "geojson"
import OsmObjectDownloader from "../OsmObjectDownloader"
interface SplitInfo {

View file

@ -2,7 +2,6 @@ import osmAuth from "osm-auth"
import { Store, Stores, UIEventSource } from "../UIEventSource"
import { OsmPreferences } from "./OsmPreferences"
import { Utils } from "../../Utils"
import { OsmObject } from "./OsmObject"
export default class UserDetails {
public loggedIn = false

View file

@ -10,7 +10,6 @@ import { CountryCoder } from "latlon2country"
import Constants from "../Models/Constants"
import { TagUtils } from "./Tags/TagUtils"
import { Feature, LineString } from "geojson"
import { OsmObject } from "./Osm/OsmObject"
import { OsmTags } from "../Models/OsmFeature"
import { UIEventSource } from "./UIEventSource"
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"

View file

@ -264,10 +264,8 @@ export abstract class Store<T> implements Readable<T> {
/**
* Same as 'addCallbackAndRun', added to be compatible with Svelte
* @param run
* @param invalidate
*/
public subscribe(run: Subscriber<T> & ((value: T) => void), invalidate?): Unsubscriber {
public subscribe(run: Subscriber<T> & ((value: T) => void), _?): Unsubscriber {
// We don't need to do anything with 'invalidate', see
// https://github.com/sveltejs/svelte/issues/3859
@ -288,7 +286,7 @@ export class ImmutableStore<T> extends Store<T> {
this.data = data
}
addCallback(callback: (data: T) => void): () => void {
addCallback(_: (data: T) => void): () => void {
// pass: data will never change
return ImmutableStore.pass
}
@ -307,7 +305,7 @@ export class ImmutableStore<T> extends Store<T> {
return ImmutableStore.pass
}
addCallbackD(callback: (data: T) => void): () => void {
addCallbackD(_: (data: T) => void): () => void {
// pass: data will never change
return ImmutableStore.pass
}

View file

@ -302,7 +302,7 @@ class OverrideShadowingCheck extends DesugaringStep<LayoutConfigJson> {
convert(
json: LayoutConfigJson,
context: string
_: string
): { result: LayoutConfigJson; errors?: string[]; warnings?: string[] } {
const overrideAll = json.overrideAll
if (overrideAll === undefined) {
@ -973,7 +973,7 @@ export class DetectDuplicateFilters extends DesugaringStep<{
convert(
json: { layers: LayerConfigJson[]; themes: LayoutConfigJson[] },
context: string
__: string
): {
result: { layers: LayerConfigJson[]; themes: LayoutConfigJson[] }
errors?: string[]

View file

@ -3,11 +3,9 @@ import { TagsFilter } from "../../Logic/Tags/TagsFilter"
import { DeleteConfigJson } from "./Json/DeleteConfigJson"
import Translations from "../../UI/i18n/Translations"
import { TagUtils } from "../../Logic/Tags/TagUtils"
import TagRenderingEditable from "../../UI/Popup/TagRendering/TagRenderingEditable.svelte";
import TagRenderingConfig from "./TagRenderingConfig";
import {QuestionableTagRenderingConfigJson} from "./Json/QuestionableTagRenderingConfigJson";
import {TagConfigJson} from "./Json/TagConfigJson";
import {del} from "idb-keyval";
export default class DeleteConfig {
public static readonly deleteReasonKey = "_delete_reason"

View file

@ -3,8 +3,6 @@
* This overlay element will regularly show a hand that swipes over the underlying element.
* This element will hide as soon as the Store 'hideSignal' receives a change (which is not undefined)
*/
import ToSvelte from "./ToSvelte.svelte";
import Svg from "../../Svg";
import { Store } from "../../Logic/UIEventSource";
import { onDestroy } from "svelte";

View file

@ -1,6 +1,5 @@
<script lang="ts">
import Loading from "./Loading.svelte";
import type { SpecialVisualizationState } from "../SpecialVisualization";
import type { OsmServiceState } from "../../Logic/Osm/OsmConnection";
import { Translation } from "../i18n/Translation";
import Translations from "../i18n/Translations";

View file

@ -1,5 +1,5 @@
<script lang="ts">
import {createEventDispatcher, onMount} from "svelte";
import {onMount} from "svelte";
import BaseUIElement from "../BaseUIElement";
import Img from "./Img";

View file

@ -2,9 +2,7 @@
import {Store, UIEventSource} from "../../Logic/UIEventSource";
import type {RasterLayerPolygon} from "../../Models/RasterLayers";
import {AvailableRasterLayers} from "../../Models/RasterLayers";
import Tr from "../Base/Tr.svelte";
import {createEventDispatcher, onDestroy} from "svelte";
import Translations from "../i18n/Translations";
import Svg from "../../Svg";
import {Map as MlMap} from "maplibre-gl"
import type {MapProperties} from "../../Models/MapProperties";

View file

@ -14,7 +14,6 @@
<script lang="ts">
import {UIEventSource} from "../../Logic/UIEventSource"
import Svg from "../../Svg"
import SubtleButton from "../Base/SubtleButton.svelte"
import ToSvelte from "../Base/ToSvelte.svelte"
import Translations from "../i18n/Translations"
import Tr from "../Base/Tr.svelte";

View file

@ -127,7 +127,7 @@ export class StackedRenderingChart extends ChartJs {
let earliest: Date = undefined
let latest: Date = undefined
let allDates = new Set<string>()
features.forEach((value, key) => {
features.forEach((value) => {
const d = new Date(value.properties.date)
Utils.SetMidnight(d)

View file

@ -47,7 +47,7 @@ export abstract class Validator {
*
* Returns 'undefined' if the element is valid
*/
public getFeedback(s: string, requestCountry?: () => string): Translation | undefined {
public getFeedback(s: string, _?: () => string): Translation | undefined {
if(this.isValid(s)){
return undefined
}
@ -61,16 +61,14 @@ export abstract class Validator {
return Translations.t.validation[this.name].description
}
public isValid(string: string, requestCountry?: () => string): boolean {
public isValid(_: string, __?: () => string): boolean {
return true
}
/**
* Reformats for the human
* @param s
* @param country
*/
public reformat(s: string, country?: () => string): string {
public reformat(s: string, _?: () => string): string {
return s
}
}

View file

@ -1,8 +1,5 @@
import Combine from "../../Base/Combine"
import Wikidata from "../../../Logic/Web/Wikidata"
import { UIEventSource } from "../../../Logic/UIEventSource"
import Locale from "../../i18n/Locale"
import { Utils } from "../../../Utils"
import WikidataSearchBox from "../../Wikipedia/WikidataSearchBox"
import { Validator } from "../Validator"

View file

@ -4,7 +4,6 @@
import type PresetConfig from "../../../Models/ThemeConfig/PresetConfig";
import Tr from "../../Base/Tr.svelte";
import Translations from "../../i18n/Translations.js";
import SubtleButton from "../../Base/SubtleButton.svelte";
import {Translation} from "../../i18n/Translation";
import type {SpecialVisualizationState} from "../../SpecialVisualization";
import {ImmutableStore} from "../../../Logic/UIEventSource";

View file

@ -1,11 +1,11 @@
<script lang="ts">
import ToSvelte from "../Base/ToSvelte.svelte";
import Table from "../Base/Table";
import { UIEventSource } from "../../Logic/UIEventSource";
import {UIEventSource} from "../../Logic/UIEventSource";
import SimpleMetaTaggers from "../../Logic/SimpleMetaTagger";
import { FixedUiElement } from "../Base/FixedUiElement";
import { onDestroy } from "svelte";
import Toggle, { ClickableToggle } from "../Input/Toggle";
import {FixedUiElement} from "../Base/FixedUiElement";
import {onDestroy} from "svelte";
import Toggle from "../Input/Toggle";
import Lazy from "../Base/Lazy";
import BaseUIElement from "../BaseUIElement";

View file

@ -1,12 +1,12 @@
import Translations from "../i18n/Translations"
import { SubtleButton } from "../Base/SubtleButton"
import {SubtleButton} from "../Base/SubtleButton"
import Svg from "../../Svg"
import Combine from "../Base/Combine"
import { GeoOperations } from "../../Logic/GeoOperations"
import { Utils } from "../../Utils"
import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization"
import { Store, UIEventSource } from "../../Logic/UIEventSource"
import { Feature, LineString } from "geojson"
import {GeoOperations} from "../../Logic/GeoOperations"
import {Utils} from "../../Utils"
import {SpecialVisualization, SpecialVisualizationState} from "../SpecialVisualization"
import {UIEventSource} from "../../Logic/UIEventSource"
import {Feature, LineString} from "geojson"
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
export class ExportAsGpxViz implements SpecialVisualization {

View file

@ -58,7 +58,7 @@ export default class WayImportButtonViz implements AutoAction, SpecialVisualizat
public readonly supportsAutoAction = true
public readonly needsNodeDatabase = true
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): BaseUIElement {
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, _: LayerConfig): BaseUIElement {
const geometry = feature.geometry
if (!(geometry.type == "LineString" || geometry.type === "Polygon")) {
console.error("Invalid type to import", geometry.type)

View file

@ -8,7 +8,6 @@ import { VariableUiElement } from "../Base/VariableUIElement"
import { Translation } from "../i18n/Translation"
import BaseUIElement from "../BaseUIElement"
import { GeoOperations } from "../../Logic/GeoOperations"
import { OsmObject } from "../../Logic/Osm/OsmObject"
import ChangeLocationAction from "../../Logic/Osm/Actions/ChangeLocationAction"
import MoveConfig from "../../Models/ThemeConfig/MoveConfig"
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"

View file

@ -146,7 +146,7 @@ export default class TagApplyButton implements AutoAction, SpecialVisualization
tags: UIEventSource<Record<string, string>>,
args: string[],
feature: Feature,
layer: LayerConfig
_: LayerConfig
): BaseUIElement {
const tagsToApply = TagApplyButton.generateTagsToApply(args[0], tags)
const msg = args[1]

View file

@ -2,7 +2,6 @@
import {UIEventSource} from "../../../Logic/UIEventSource";
import {Translation} from "../../i18n/Translation";
import ValidatedInput from "../../InputElement/ValidatedInput.svelte";
import Tr from "../../Base/Tr.svelte";
import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig";
import Inline from "./Inline.svelte";
import {createEventDispatcher, onDestroy} from "svelte";

View file

@ -1,7 +1,3 @@
import { Utils } from "../../Utils"
import { Feature } from "geojson"
import { Point } from "@turf/turf"
import { GeoLocationPointProperties } from "../../Logic/State/GeoLocationState"
import UploadTraceToOsmUI from "../BigComponents/UploadTraceToOsmUI"
import { SpecialVisualization, SpecialVisualizationState } from "../SpecialVisualization"
import { UIEventSource } from "../../Logic/UIEventSource"
@ -18,8 +14,8 @@ export class UploadToOsmViz implements SpecialVisualization {
constr(
state: SpecialVisualizationState,
featureTags: UIEventSource<Record<string, string>>,
args: string[]
_: UIEventSource<Record<string, string>>,
__: string[]
) {
const locations = state.historicalUserLocations.features.data
return new UploadTraceToOsmUI((title) => GeoOperations.toGpx(locations, title), state, {

View file

@ -64,7 +64,7 @@ import {SaveButton} from "./Popup/SaveButton"
import Lazy from "./Base/Lazy"
import {CheckBox} from "./Input/Checkboxes"
import Slider from "./Input/Slider"
import {OsmId, OsmTags, WayId} from "../Models/OsmFeature"
import {OsmTags, WayId} from "../Models/OsmFeature"
import MoveWizard from "./Popup/MoveWizard"
import SplitRoadWizard from "./Popup/SplitRoadWizard"
import {ExportAsGpxViz} from "./Popup/ExportAsGpxViz"
@ -74,7 +74,6 @@ import {PointImportButtonViz} from "./Popup/ImportButtons/PointImportButtonViz";
import WayImportButtonViz from "./Popup/ImportButtons/WayImportButtonViz";
import ConflateImportButtonViz from "./Popup/ImportButtons/ConflateImportButtonViz";
import DeleteWizard from "./Popup/DeleteFlow/DeleteWizard.svelte";
import {UIElement} from "./UIElement";
class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests

View file

@ -41,9 +41,7 @@
import Svg from "../Svg";
import {ShareScreen} from "./BigComponents/ShareScreen";
import ThemeIntroPanel from "./BigComponents/ThemeIntroPanel.svelte";
import type {Readable} from "svelte/store";
import type {RasterLayerPolygon} from "../Models/RasterLayers";
import RasterLayerPicker from "./Map/RasterLayerPicker.svelte";
import RasterLayerOverview from "./Map/RasterLayerOverview.svelte";
import IfHidden from "./Base/IfHidden.svelte";
import {onDestroy} from "svelte";

View file

@ -1,5 +1,3 @@
import { UIEventSource } from "../../Logic/UIEventSource"
export interface WikipediaBoxOptions {
addHeader?: boolean
firstParagraphOnly?: true | boolean

View file

@ -1,7 +1,6 @@
<script lang="ts">
import type { FullWikipediaDetails } from "../../Logic/Web/Wikipedia";
import { Store } from "../../Logic/UIEventSource";
import { onDestroy } from "svelte";
/**
* Small helper

View file

@ -1,6 +1,5 @@
import ScriptUtils from "./ScriptUtils"
import { appendFileSync, readFileSync, writeFileSync } from "fs"
import { OsmObject } from "../Logic/Osm/OsmObject"
import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader";
ScriptUtils.fixUtils()

View file

@ -9,7 +9,7 @@ import {Or} from "../Logic/Tags/Or"
import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"
import * as OsmToGeoJson from "osmtogeojson"
import MetaTagging from "../Logic/MetaTagging"
import {ImmutableStore, UIEventSource} from "../Logic/UIEventSource"
import {UIEventSource} from "../Logic/UIEventSource"
import {TileRange, Tiles} from "../Models/TileRange"
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig"
import ScriptUtils from "./ScriptUtils"
@ -22,7 +22,7 @@ import SimpleMetaTaggers, {ReferencingWaysMetaTagger} from "../Logic/SimpleMetaT
import FilteringFeatureSource from "../Logic/FeatureSource/Sources/FilteringFeatureSource"
import {Feature} from "geojson"
import {BBox} from "../Logic/BBox"
import {FeatureSource, FeatureSourceForLayer} from "../Logic/FeatureSource/FeatureSource";
import {FeatureSource} from "../Logic/FeatureSource/FeatureSource";
import OsmObjectDownloader from "../Logic/Osm/OsmObjectDownloader";
import FeaturePropertiesStore from "../Logic/FeatureSource/Actors/FeaturePropertiesStore";

View file

@ -1,5 +1,4 @@
import * as fs from "fs"
import Constants from "../Models/Constants";
function genImages(dryrun = false) {
console.log("Generating images")

View file

@ -1,11 +1,10 @@
import { Utils } from "../../../Utils"
import {Utils} from "../../../Utils"
import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig"
import SelectedElementTagsUpdater from "../../../Logic/Actors/SelectedElementTagsUpdater"
import * as bookcaseJson from "../../../assets/generated/themes/bookcases.json"
import { OsmTags } from "../../../Models/OsmFeature"
import { Feature, Geometry } from "geojson"
import { expect, it } from "vitest"
import {OsmTags} from "../../../Models/OsmFeature"
import {Feature, Geometry} from "geojson"
import {expect, it} from "vitest"
import ThemeViewState from "../../../Models/ThemeViewState"
import ScriptUtils from "../../../scripts/ScriptUtils";