forked from MapComplete/MapComplete
		
	Chore: linting
This commit is contained in:
		
							parent
							
								
									4625ad9a5c
								
							
						
					
					
						commit
						097141f944
					
				
					 307 changed files with 5346 additions and 2147 deletions
				
			
		|  | @ -104,9 +104,9 @@ class GenerateLayouts extends Script { | |||
|         if (!layout.icon.endsWith(".svg")) { | ||||
|             console.warn( | ||||
|                 "Not creating a social image for " + | ||||
|                 layout.id + | ||||
|                 " as it is _not_ a .svg: " + | ||||
|                 layout.icon | ||||
|                     layout.id + | ||||
|                     " as it is _not_ a .svg: " + | ||||
|                     layout.icon | ||||
|             ) | ||||
|             return undefined | ||||
|         } | ||||
|  | @ -139,9 +139,9 @@ class GenerateLayouts extends Script { | |||
|                         id: "icon", | ||||
|                         transform: `translate(${cx - r},${cy - r}) scale(${ | ||||
|                             (r * 2) / Number(width) | ||||
|                         }) ` | ||||
|                         }) `,
 | ||||
|                     }, | ||||
|                     g: [svg] | ||||
|                     g: [svg], | ||||
|                 } | ||||
|             }, | ||||
|             (mightBeTokenToReplace) => { | ||||
|  | @ -202,19 +202,19 @@ class GenerateLayouts extends Script { | |||
|                 icons.push({ | ||||
|                     src: name, | ||||
|                     sizes: size + "x" + size, | ||||
|                     type: "image/png" | ||||
|                     type: "image/png", | ||||
|                 }) | ||||
|             } | ||||
|             icons.push({ | ||||
|                 src: path, | ||||
|                 sizes: "513x513", | ||||
|                 type: "image/svg" | ||||
|                 type: "image/svg", | ||||
|             }) | ||||
|         } else if (icon.endsWith(".png")) { | ||||
|             icons.push({ | ||||
|                 src: icon, | ||||
|                 sizes: "513x513", | ||||
|                 type: "image/png" | ||||
|                 type: "image/png", | ||||
|             }) | ||||
|         } else { | ||||
|             console.log(icon) | ||||
|  | @ -233,11 +233,11 @@ class GenerateLayouts extends Script { | |||
|             description: ogDescr, | ||||
|             orientation: "portrait-primary, landscape-primary", | ||||
|             icons: icons, | ||||
|             categories: ["map", "navigation"] | ||||
|             categories: ["map", "navigation"], | ||||
|         } | ||||
|         return { | ||||
|             manifest, | ||||
|             whiteIcons | ||||
|             whiteIcons, | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -261,7 +261,7 @@ class GenerateLayouts extends Script { | |||
|         const rasterLayers = [ | ||||
|             AvailableRasterLayers.defaultBackgroundLayer, | ||||
|             ...eli.features, | ||||
|             ...eli_global.layers.map((properties) => ({ properties })) | ||||
|             ...eli_global.layers.map((properties) => ({ properties })), | ||||
|         ] | ||||
|         for (const feature of rasterLayers) { | ||||
|             const f = <RasterLayerPolygon>feature | ||||
|  | @ -282,9 +282,9 @@ class GenerateLayouts extends Script { | |||
|                     url = url.substring("pmtiles://".length) | ||||
|                 } | ||||
|                 const styleSpec = await Utils.downloadJsonCached(url, 1000 * 120, { | ||||
|                     Origin: "https://mapcomplete.org" | ||||
|                     Origin: "https://mapcomplete.org", | ||||
|                 }) | ||||
|                 urls.push(...(f.properties["connect-src"]??[])) | ||||
|                 urls.push(...(f.properties["connect-src"] ?? [])) | ||||
|                 for (const key of Object.keys(styleSpec?.sources ?? {})) { | ||||
|                     const url = styleSpec.sources[key].url | ||||
|                     if (!url) { | ||||
|  | @ -298,7 +298,7 @@ class GenerateLayouts extends Script { | |||
|                     urls.push(url) | ||||
|                     if (urlClipped.endsWith(".json")) { | ||||
|                         const tileInfo = await Utils.downloadJsonCached(url, 1000 * 120, { | ||||
|                             Origin: "https://mapcomplete.org" | ||||
|                             Origin: "https://mapcomplete.org", | ||||
|                         }) | ||||
|                         urls.push(tileInfo["tiles"] ?? []) | ||||
|                     } | ||||
|  | @ -326,7 +326,7 @@ class GenerateLayouts extends Script { | |||
|             "https://www.openstreetmap.org", | ||||
|             "https://api.openstreetmap.org", | ||||
|             "https://pietervdvn.goatcounter.com", | ||||
|             "https://cache.mapcomplete.org" | ||||
|             "https://cache.mapcomplete.org", | ||||
|         ].concat(...(await this.eliUrls())) | ||||
| 
 | ||||
|         SpecialVisualizations.specialVisualizations.forEach((sv) => { | ||||
|  | @ -368,12 +368,14 @@ class GenerateLayouts extends Script { | |||
|             const vectorLayers = eliLayers.filter((l) => l.properties.type === "vector") | ||||
|             const vectorSources = vectorLayers.map((l) => l.properties.url) | ||||
|             vectorSources.push(...vectorLayers.map((l) => l.properties.style)) | ||||
|             apiUrls.push(...vectorSources.map(url => { | ||||
|                 if (url?.startsWith("pmtiles://")) { | ||||
|                     return url.substring("pmtiles://".length) | ||||
|                 } | ||||
|                 return url | ||||
|             })) | ||||
|             apiUrls.push( | ||||
|                 ...vectorSources.map((url) => { | ||||
|                     if (url?.startsWith("pmtiles://")) { | ||||
|                         return url.substring("pmtiles://".length) | ||||
|                     } | ||||
|                     return url | ||||
|                 }) | ||||
|             ) | ||||
|         } | ||||
|         for (let connectSource of apiUrls.concat(geojsonSources)) { | ||||
|             if (!connectSource) { | ||||
|  | @ -418,8 +420,8 @@ class GenerateLayouts extends Script { | |||
|             "script-src": [ | ||||
|                 "'self'", | ||||
|                 "https://gc.zgo.at/count.js", | ||||
|                 ...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? []) | ||||
|             ].join(" ") | ||||
|                 ...(options?.scriptSrcs?.map((s) => "'" + s + "'") ?? []), | ||||
|             ].join(" "), | ||||
|         } | ||||
|         const content = Object.keys(csp) | ||||
|             .map((k) => k + " " + csp[k]) | ||||
|  | @ -427,7 +429,7 @@ class GenerateLayouts extends Script { | |||
| 
 | ||||
|         return [ | ||||
|             `<meta http-equiv ="Report-To" content='{"group":"csp-endpoint", "max_age": 86400,"endpoints": [\{"url": "https://report.mapcomplete.org/csp"}], "include_subdomains": true}'>`, | ||||
|             `<meta http-equiv="Content-Security-Policy" content="${content}">` | ||||
|             `<meta http-equiv="Content-Security-Policy" content="${content}">`, | ||||
|         ].join("\n") | ||||
|     } | ||||
| 
 | ||||
|  | @ -439,12 +441,12 @@ class GenerateLayouts extends Script { | |||
|     ) { | ||||
|         Locale.language.setData(layout.language[0]) | ||||
|         const targetLanguage = layout.language[0] | ||||
|         const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, "\\\"") | ||||
|         const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, '\\"') | ||||
|         const ogDescr = Translations.T( | ||||
|             layout.shortDescription ?? "Easily add and edit geodata with OpenStreetMap" | ||||
|         ) | ||||
|             .textFor(targetLanguage) | ||||
|             .replace(/"/g, "\\\"") | ||||
|             .replace(/"/g, '\\"') | ||||
|         let ogImage = layout.socialImage | ||||
|         let twitterImage = ogImage | ||||
|         if (ogImage === LayoutConfig.defaultSocialImage && layout.official) { | ||||
|  | @ -503,7 +505,7 @@ class GenerateLayouts extends Script { | |||
|             og, | ||||
|             customCss, | ||||
|             `<link rel="icon" href="${icon}" sizes="any" type="image/svg+xml">`, | ||||
|             ...apple_icons | ||||
|             ...apple_icons, | ||||
|         ].join("\n") | ||||
| 
 | ||||
|         let branchname = await this.getBranchName() | ||||
|  | @ -526,7 +528,7 @@ class GenerateLayouts extends Script { | |||
|             .replace( | ||||
|                 /<!-- CSP -->/, | ||||
|                 await this.generateCsp(layout, layoutJson, { | ||||
|                     scriptSrcs: [this.removeOtherLanguagesHash] | ||||
|                     scriptSrcs: [this.removeOtherLanguagesHash], | ||||
|                 }) | ||||
|             ) | ||||
|             .replace( | ||||
|  | @ -557,7 +559,7 @@ class GenerateLayouts extends Script { | |||
| 
 | ||||
|         const imports = [ | ||||
|             `import layout from "./src/assets/generated/themes/${theme.id}.json"`, | ||||
|             `import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"` | ||||
|             `import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"`, | ||||
|         ] | ||||
|         for (const layerName of Constants.added_by_default) { | ||||
|             imports.push( | ||||
|  | @ -604,7 +606,7 @@ class GenerateLayouts extends Script { | |||
|             "account", | ||||
|             "openstreetmap", | ||||
|             "custom", | ||||
|             "theme" | ||||
|             "theme", | ||||
|         ] | ||||
|         // @ts-ignore
 | ||||
|         const all: LayoutConfigJson[] = all_known_layouts.themes | ||||
|  | @ -656,7 +658,7 @@ class GenerateLayouts extends Script { | |||
|                 startLon: 0, | ||||
|                 startZoom: 0, | ||||
|                 title: { en: "MapComplete" }, | ||||
|                 description: { en: "A thematic map viewer and editor based on OpenStreetMap" } | ||||
|                 description: { en: "A thematic map viewer and editor based on OpenStreetMap" }, | ||||
|             }), | ||||
|             alreadyWritten | ||||
|         ) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue