Merged in fix/3697-prettier-configs (pull request #3396)

fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2026-01-07 12:45:50 +00:00
parent 932413412b
commit d0546926a9
500 changed files with 18367 additions and 18419 deletions

View File

@@ -1,4 +1,4 @@
import { getUrlWithSignature } from './utils'
import { getUrlWithSignature } from "./utils"
export type StaticMapProps = {
city?: string
@@ -10,7 +10,7 @@ export type StaticMapProps = {
width: number
height: number
zoomLevel?: number
mapType?: 'roadmap' | 'satellite' | 'terrain' | 'hybrid'
mapType?: "roadmap" | "satellite" | "terrain" | "hybrid"
altText: string
mapId?: string
googleMapKey: string
@@ -45,7 +45,7 @@ export default async function StaticMap({
width,
height,
zoomLevel = 14,
mapType = 'roadmap',
mapType = "roadmap",
altText,
mapId,
googleMapKey,
@@ -53,7 +53,7 @@ export default async function StaticMap({
}: StaticMapProps) {
// const key = env.GOOGLE_STATIC_MAP_KEY
// const secret = env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET
const baseUrl = 'https://maps.googleapis.com/maps/api/staticmap'
const baseUrl = "https://maps.googleapis.com/maps/api/staticmap"
const center = getCenter({ coordinates, city, country })
if (!center) {
@@ -66,7 +66,7 @@ export default async function StaticMap({
)
if (mapId) {
url.searchParams.append('map_id', mapId)
url.searchParams.append("map_id", mapId)
}
const src = getUrlWithSignature(url, googleMapSecret)

View File

@@ -1,4 +1,4 @@
import crypto from 'node:crypto'
import crypto from "node:crypto"
/**
* Util functions taken from https://developers.google.com/maps/documentation/maps-static/digital-signature#sample-code-for-url-signing
@@ -13,7 +13,7 @@ import crypto from 'node:crypto'
* @return {string}
*/
function removeWebSafe(safeEncodedString: string) {
return safeEncodedString.replace(/-/g, '+').replace(/_/g, '/')
return safeEncodedString.replace(/-/g, "+").replace(/_/g, "/")
}
/**
@@ -24,7 +24,7 @@ function removeWebSafe(safeEncodedString: string) {
* @return {string}
*/
function makeWebSafe(encodedString: string) {
return encodedString.replace(/\+/g, '-').replace(/\//g, '_')
return encodedString.replace(/\+/g, "-").replace(/\//g, "_")
}
/**
@@ -34,7 +34,7 @@ function makeWebSafe(encodedString: string) {
* @return {string}
*/
function decodeBase64Hash(code: string) {
return Buffer.from(code, 'base64')
return Buffer.from(code, "base64")
}
/**
@@ -45,7 +45,7 @@ function decodeBase64Hash(code: string) {
* @return {string}
*/
function encodeBase64Hash(key: Buffer, data: string) {
return crypto.createHmac('sha1', key).update(data).digest('base64')
return crypto.createHmac("sha1", key).update(data).digest("base64")
}
/**
@@ -55,7 +55,7 @@ function encodeBase64Hash(key: Buffer, data: string) {
* @param {string} secret Your unique secret key.
* @return {string}
*/
export function getUrlWithSignature(url: URL, secret = '') {
export function getUrlWithSignature(url: URL, secret = "") {
const path = url.pathname + url.search
const safeSecret = decodeBase64Hash(removeWebSafe(secret))
const hashedSignature = makeWebSafe(encodeBase64Hash(safeSecret, path))