fix(lint): resolve remaining static analysis warnings
This commit is contained in:
@@ -83,7 +83,9 @@ export function MediaPickerDialog({
|
||||
const url =
|
||||
adapter.resolveReference?.(asset) ??
|
||||
defaultMediaReference(asset)
|
||||
return url === asset.url ? asset : { ...asset, url }
|
||||
return url === asset.url
|
||||
? asset
|
||||
: Object.assign({}, asset, { url })
|
||||
})
|
||||
)
|
||||
onOpenChange(false)
|
||||
|
||||
@@ -23,13 +23,13 @@ export function getChildMediaFolders(
|
||||
folders: readonly MediaFolder[],
|
||||
parentId: MediaId | null
|
||||
): MediaFolder[] {
|
||||
return folders
|
||||
.filter((folder) => folder.parentId === parentId)
|
||||
.sort(
|
||||
(left, right) =>
|
||||
(left.sortOrder ?? 0) - (right.sortOrder ?? 0) ||
|
||||
left.name.localeCompare(right.name)
|
||||
)
|
||||
const childFolders = folders.filter((folder) => folder.parentId === parentId)
|
||||
childFolders.sort(
|
||||
(left, right) =>
|
||||
(left.sortOrder ?? 0) - (right.sortOrder ?? 0) ||
|
||||
left.name.localeCompare(right.name)
|
||||
)
|
||||
return childFolders
|
||||
}
|
||||
|
||||
export function getMediaFolderPath(
|
||||
|
||||
@@ -58,9 +58,10 @@ function ChartContainer({
|
||||
}) {
|
||||
const uniqueId = React.useId()
|
||||
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
|
||||
const contextValue = React.useMemo(() => ({ config }), [config])
|
||||
|
||||
return (
|
||||
<ChartContext.Provider value={{ config }}>
|
||||
<ChartContext.Provider value={contextValue}>
|
||||
<div
|
||||
data-slot="chart"
|
||||
data-chart={chartId}
|
||||
@@ -83,7 +84,7 @@ function ChartContainer({
|
||||
|
||||
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
||||
const colorConfig = Object.entries(config).filter(
|
||||
([, config]) => config.theme ?? config.color
|
||||
([, entryConfig]) => entryConfig.theme ?? entryConfig.color
|
||||
)
|
||||
|
||||
if (!colorConfig.length) {
|
||||
@@ -206,7 +207,7 @@ function ChartTooltipContent({
|
||||
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
key={key}
|
||||
className={cn(
|
||||
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
||||
indicator === "dot" && "items-center"
|
||||
@@ -298,13 +299,13 @@ function ChartLegendContent({
|
||||
>
|
||||
{payload
|
||||
.filter((item) => item.type !== "none")
|
||||
.map((item, index) => {
|
||||
.map((item) => {
|
||||
const key = `${nameKey ?? item.dataKey ?? "value"}`
|
||||
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
||||
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
key={key}
|
||||
className={cn(
|
||||
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
||||
)}
|
||||
|
||||
@@ -201,8 +201,8 @@ function FieldError({
|
||||
return (
|
||||
<ul className="ms-4 flex list-disc flex-col gap-1">
|
||||
{uniqueErrors.map(
|
||||
(error, index) =>
|
||||
error?.message && <li key={index}>{error.message}</li>
|
||||
(error) =>
|
||||
error?.message && <li key={error.message}>{error.message}</li>
|
||||
)}
|
||||
</ul>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from "react"
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
||||
|
||||
import { cn } from "@workspace/ui/lib/utils"
|
||||
|
||||
@@ -10,7 +10,7 @@ function Slider({
|
||||
max = 100,
|
||||
...props
|
||||
}: SliderPrimitive.Root.Props) {
|
||||
const _values = Array.isArray(value)
|
||||
const values = Array.isArray(value)
|
||||
? value
|
||||
: Array.isArray(defaultValue)
|
||||
? defaultValue
|
||||
@@ -37,7 +37,7 @@ function Slider({
|
||||
className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
||||
/>
|
||||
</SliderPrimitive.Track>
|
||||
{Array.from({ length: _values.length }, (_, index) => (
|
||||
{Array.from({ length: values.length }, (_, index) => (
|
||||
<SliderPrimitive.Thumb
|
||||
data-slot="slider-thumb"
|
||||
key={index}
|
||||
|
||||
@@ -33,6 +33,11 @@ function ToggleGroup({
|
||||
spacing?: number
|
||||
orientation?: "horizontal" | "vertical"
|
||||
}) {
|
||||
const contextValue = React.useMemo(
|
||||
() => ({ variant, size, spacing, orientation }),
|
||||
[orientation, size, spacing, variant]
|
||||
)
|
||||
|
||||
return (
|
||||
<ToggleGroupPrimitive
|
||||
data-slot="toggle-group"
|
||||
@@ -47,9 +52,7 @@ function ToggleGroup({
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ToggleGroupContext.Provider
|
||||
value={{ variant, size, spacing, orientation }}
|
||||
>
|
||||
<ToggleGroupContext.Provider value={contextValue}>
|
||||
{children}
|
||||
</ToggleGroupContext.Provider>
|
||||
</ToggleGroupPrimitive>
|
||||
|
||||
Reference in New Issue
Block a user