Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Fix linter errors and add missing string

Russ Garrett77ffa05a3b94
diff --git a/web/locales/en/translation.json b/web/locales/en/translation.json
index 08d768e..da892f3 100644
--- a/web/locales/en/translation.json
+++ b/web/locales/en/translation.json
@@ -210,6 +210,7 @@
},
"construction": "under construction",
"disused": "disused",
+ "coordinates": "Coordinates",
"search": {
"clear": "Clear search",
"no-results": "No results found"
diff --git a/web/src/search/coordinates.ts b/web/src/search/coordinates.ts
index 643dc74..859dcf2 100644
--- a/web/src/search/coordinates.ts
+++ b/web/src/search/coordinates.ts
@@ -2,15 +2,16 @@
* Coordinates search provider - detects if the user has entered lat/lon coordinates
* and returns them as the most relevant search result.
*/
+import { t } from 'i18next'
import { convert as convert_coords } from 'geo-coordinates-parser'
import { SearchResult, ISearchProvider } from './search'
export default class CoordinatesSearch implements ISearchProvider {
- async search(query: string, _limit: number = 5): Promise<SearchResult[]> {
+ async search(query: string): Promise<SearchResult[]> {
let coords
try {
coords = convert_coords(query)
- } catch (error) {
+ } catch {
return []
}
@@ -20,7 +21,7 @@ export default class CoordinatesSearch implements ISearchProvider {
longitude: parseFloat(coords.decimalLongitude.toFixed(5)),
name: query,
score: 1,
- description: 'Coordinates'
+ description: t('coordinates')
}
]
}
diff --git a/web/src/search/openinframap.ts b/web/src/search/openinframap.ts
index 87e137c..e0d3b87 100644
--- a/web/src/search/openinframap.ts
+++ b/web/src/search/openinframap.ts
@@ -33,7 +33,7 @@ export default class OIMSearchProvider implements ISearchProvider {
this.regionNames = new Intl.DisplayNames([language], { type: 'region' })
}
- async search(query: string, _limit: number = 5): Promise<SearchResult[]> {
+ async search(query: string): Promise<SearchResult[]> {
const searchParams = new URLSearchParams({
q: query,
lang: this.language,
@@ -64,7 +64,7 @@ export default class OIMSearchProvider implements ISearchProvider {
}
description(result: OIMResult): string {
- var description = ''
+ let description = ''
if (result.type === 'substation' && result.voltage) {
description += `${t('names.power.substation')} (${formatVoltage(result.voltage / 1000)})`
} else if (result.type === 'plant' && result.output) {