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