fix(lint): resolve remaining static analysis warnings

This commit is contained in:
Maofeng
2026-09-20 15:53:02 +08:00
parent f246d81088
commit a03b04ed3f
8 changed files with 27 additions and 21 deletions
+6 -5
View File
@@ -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"
)}
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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}
+6 -3
View File
@@ -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>