Skip to content

Commit 090b0fd

Browse files
renovate[bot]protobuf-ci-cd
authored andcommitted
chore(deps): update dependency @biomejs/biome to v2.2.2
Signed-off-by: protobuf-ci-cd <protobuf-ci-cd@scaleway.com>
1 parent 98a2469 commit 090b0fd

File tree

3 files changed

+108
-104
lines changed

3 files changed

+108
-104
lines changed

packages/use-i18n/src/formatUnit.ts

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ const formatShortUnit = (
8181
shortenedUnit = symbols.short.octet
8282
}
8383

84-
return `${exponent.symbol}${shortenedUnit}${compoundUnit ? compoundUnitsSymbols[compoundUnit] : ''
85-
}`
84+
return `${exponent.symbol}${shortenedUnit}${
85+
compoundUnit ? compoundUnitsSymbols[compoundUnit] : ''
86+
}`
8687
}
8788

8889
const formatLongUnit = (
@@ -99,21 +100,22 @@ const formatLongUnit = (
99100
) {
100101
translation =
101102
localesWhoFavorOctetOverByte[
102-
locale as keyof typeof localesWhoFavorOctetOverByte
103+
locale as keyof typeof localesWhoFavorOctetOverByte
103104
]
104105
}
105106

106-
return `${exponent.name}${formatters
107-
.getTranslationFormat(
108-
`{amount, plural,
107+
return `${exponent.name}${
108+
formatters
109+
.getTranslationFormat(
110+
`{amount, plural,
109111
=0 {${translation.singular}}
110112
=1 {${translation.singular}}
111113
other {${translation.plural}}
112114
}`,
113-
locale,
114-
)
115-
.format({ amount }) as string
116-
}`
115+
locale,
116+
)
117+
.format({ amount }) as string
118+
}`
117119
}
118120

119121
const format =
@@ -128,71 +130,73 @@ const format =
128130
exponent?: Exponent
129131
humanize?: boolean
130132
}) =>
131-
(
132-
locale: string,
133-
amount: number,
134-
{
135-
maximumFractionDigits,
136-
minimumFractionDigits,
137-
short = true,
138-
base = 10,
139-
}: {
140-
maximumFractionDigits?: number
141-
minimumFractionDigits?: number
142-
short?: boolean
143-
base?: 2 | 10
144-
},
145-
): string => {
146-
let computedExponent = exponent
147-
let computedValue = amount
133+
(
134+
locale: string,
135+
amount: number,
136+
{
137+
maximumFractionDigits,
138+
minimumFractionDigits,
139+
short = true,
140+
base = 10,
141+
}: {
142+
maximumFractionDigits?: number
143+
minimumFractionDigits?: number
144+
short?: boolean
145+
base?: 2 | 10
146+
},
147+
): string => {
148+
let computedExponent = exponent
149+
let computedValue = amount
148150

149-
if (humanize) {
150-
if (computedExponent) {
151-
const value = filesize(amount, {
152-
base,
153-
exponent: exponents.findIndex(
154-
exp => exp.name === (computedExponent as Exponent).name,
155-
),
156-
output: 'object',
157-
round: maximumFractionDigits,
158-
})
151+
if (humanize) {
152+
if (computedExponent) {
153+
const value = filesize(amount, {
154+
base,
155+
exponent: exponents.findIndex(
156+
exp => exp.name === (computedExponent as Exponent).name,
157+
),
158+
output: 'object',
159+
round: maximumFractionDigits,
160+
})
159161

160-
computedValue = Number.parseFloat(value.value.toString())
161-
} else {
162-
const value = filesize(amount, {
163-
base,
164-
output: 'object',
165-
round: maximumFractionDigits,
166-
})
162+
computedValue = Number.parseFloat(value.value.toString())
163+
} else {
164+
const value = filesize(amount, {
165+
base,
166+
output: 'object',
167+
round: maximumFractionDigits,
168+
})
167169

168-
computedExponent = exponents[value.exponent]
169-
computedValue = Number.parseFloat(value.value.toString())
170-
}
170+
computedExponent = exponents[value.exponent]
171+
computedValue = Number.parseFloat(value.value.toString())
171172
}
173+
}
172174

173-
return `${new Intl.NumberFormat(locale, {
174-
maximumFractionDigits,
175-
minimumFractionDigits,
176-
}).format(computedValue)} ${short
175+
return `${new Intl.NumberFormat(locale, {
176+
maximumFractionDigits,
177+
minimumFractionDigits,
178+
}).format(computedValue)} ${
179+
short
177180
? formatShortUnit(
178-
locale,
179-
computedExponent as Exponent,
180-
unit,
181-
compoundUnit,
182-
)
181+
locale,
182+
computedExponent as Exponent,
183+
unit,
184+
compoundUnit,
185+
)
183186
: formatLongUnit(
184-
locale,
185-
computedExponent as Exponent,
186-
unit,
187-
computedValue,
188-
)
189-
}`
190-
}
187+
locale,
188+
computedExponent as Exponent,
189+
unit,
190+
computedValue,
191+
)
192+
}`
193+
}
191194

192195
type SimpleUnits = `${ExponentName}${Unit}${'-humanized' | ''}`
193196
type ComplexUnits = `${Unit}${'s' | ''}${'-humanized' | ''}`
194-
// eslint-disable-next-line @stylistic/space-infix-ops
195-
type PerSecondUnit = `${ExponentName | ''}bit${'s' | ''}${'-per-second' | ''}${| '-humanized' | ''}`
197+
198+
type PerSecondUnit =
199+
`${ExponentName | ''}bit${'s' | ''}${'-per-second' | ''}${'-humanized' | ''}`
196200
type SupportedUnits = SimpleUnits | ComplexUnits | PerSecondUnit
197201

198202
export const supportedUnits: Partial<

pnpm-lock.yaml

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ catalog:
88
'@babel/preset-env': 7.28.3
99
'@babel/preset-react': 7.27.1
1010
'@babel/preset-typescript': 7.27.1
11-
'@biomejs/biome': 2.1.2
11+
'@biomejs/biome': 2.2.2
1212
'@changesets/changelog-github': 0.5.1
1313
'@changesets/cli': 2.29.6
1414
'@commitlint/cli': 19.8.1

0 commit comments

Comments
 (0)