From 6f0e829946c8fb4387630152b09cdb18acf07196 Mon Sep 17 00:00:00 2001 From: "Pablo F.G" Date: Fri, 19 Jun 2026 09:03:14 +0200 Subject: [PATCH] style(ui): use named imports to satisfy import-x lint rules - Replace default clsx import with named import - Use named React imports instead of React.* member access - Fix @/types import mixing value and type-only specifiers - Apply import ordering from the flat ESLint config Co-Authored-By: Claude Opus 4.8 (1M context) --- ui/app/(prowler)/scans/page.tsx | 4 ++-- ui/components/ThemeSwitch.tsx | 4 ++-- .../invitations/workflow/vertical-steps.tsx | 18 +++++++----------- .../roles/workflow/forms/add-role-form.tsx | 2 +- .../roles/workflow/vertical-steps.tsx | 18 +++++++----------- .../scans/table/scan-jobs-columns.test.tsx | 4 +--- .../scans/table/scan-jobs-columns.tsx | 1 + ui/components/scans/table/scan-jobs-table.tsx | 1 + ui/components/ui/accordion/Accordion.tsx | 4 ++-- ui/components/ui/action-card/ActionCard.tsx | 6 +++--- ui/components/ui/sidebar/sidebar.tsx | 2 +- 11 files changed, 28 insertions(+), 36 deletions(-) diff --git a/ui/app/(prowler)/scans/page.tsx b/ui/app/(prowler)/scans/page.tsx index 62aba551ae..94f4ae0880 100644 --- a/ui/app/(prowler)/scans/page.tsx +++ b/ui/app/(prowler)/scans/page.tsx @@ -3,13 +3,13 @@ import { Suspense } from "react"; import { getAllProviders } from "@/actions/providers"; import { getScans } from "@/actions/scans"; import { auth } from "@/auth.config"; +import { ScansPageShell } from "@/components/scans/scans-page-shell"; +import { ScansProvidersEmptyState } from "@/components/scans/scans-providers-empty-state"; import { getScanJobsTab, getScanJobsTabFilters, getScanJobsUserFilters, } from "@/components/scans/scans.utils"; -import { ScansPageShell } from "@/components/scans/scans-page-shell"; -import { ScansProvidersEmptyState } from "@/components/scans/scans-providers-empty-state"; import { SkeletonTableScans } from "@/components/scans/table"; import { ScanJobsTable } from "@/components/scans/table/scan-jobs-table"; import { ContentLayout } from "@/components/ui"; diff --git a/ui/components/ThemeSwitch.tsx b/ui/components/ThemeSwitch.tsx index 0d48367e0c..eae18202c9 100644 --- a/ui/components/ThemeSwitch.tsx +++ b/ui/components/ThemeSwitch.tsx @@ -4,9 +4,9 @@ import type { SwitchProps } from "@heroui/switch"; import { useSwitch } from "@heroui/switch"; import { useIsSSR } from "@react-aria/ssr"; import { VisuallyHidden } from "@react-aria/visually-hidden"; -import clsx from "clsx"; +import { clsx } from "clsx"; import { useTheme } from "next-themes"; -import React, { FC } from "react"; +import { FC } from "react"; import { Tooltip, diff --git a/ui/components/invitations/workflow/vertical-steps.tsx b/ui/components/invitations/workflow/vertical-steps.tsx index 16dd7c9647..ce66a3749f 100644 --- a/ui/components/invitations/workflow/vertical-steps.tsx +++ b/ui/components/invitations/workflow/vertical-steps.tsx @@ -3,17 +3,16 @@ import { cn } from "@heroui/theme"; import { useControlledState } from "@react-stately/utils"; import { domAnimation, LazyMotion, m } from "framer-motion"; -import type { ComponentProps } from "react"; -import React from "react"; +import type { ComponentProps, HTMLAttributes, ReactNode } from "react"; +import { forwardRef, useMemo } from "react"; export type VerticalStepProps = { className?: string; - description?: React.ReactNode; - title?: React.ReactNode; + description?: ReactNode; + title?: ReactNode; }; -export interface VerticalStepsProps - extends React.HTMLAttributes { +export interface VerticalStepsProps extends HTMLAttributes { /** * An array of steps. * @@ -88,10 +87,7 @@ function CheckIcon(props: ComponentProps<"svg">) { ); } -export const VerticalSteps = React.forwardRef< - HTMLButtonElement, - VerticalStepsProps ->( +export const VerticalSteps = forwardRef( ( { color = "primary", @@ -112,7 +108,7 @@ export const VerticalSteps = React.forwardRef< onStepChange, ); - const colors = React.useMemo(() => { + const colors = useMemo(() => { let userColor; let fgColor; diff --git a/ui/components/roles/workflow/forms/add-role-form.tsx b/ui/components/roles/workflow/forms/add-role-form.tsx index 2ae5db944d..dc97d7cc07 100644 --- a/ui/components/roles/workflow/forms/add-role-form.tsx +++ b/ui/components/roles/workflow/forms/add-role-form.tsx @@ -4,7 +4,7 @@ import { Checkbox } from "@heroui/checkbox"; import { Divider } from "@heroui/divider"; import { Tooltip } from "@heroui/tooltip"; import { zodResolver } from "@hookform/resolvers/zod"; -import clsx from "clsx"; +import { clsx } from "clsx"; import { InfoIcon } from "lucide-react"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; diff --git a/ui/components/roles/workflow/vertical-steps.tsx b/ui/components/roles/workflow/vertical-steps.tsx index 13202083d1..f5ce30aea6 100644 --- a/ui/components/roles/workflow/vertical-steps.tsx +++ b/ui/components/roles/workflow/vertical-steps.tsx @@ -3,17 +3,16 @@ import { cn } from "@heroui/theme"; import { useControlledState } from "@react-stately/utils"; import { domAnimation, LazyMotion, m } from "framer-motion"; -import type { ComponentProps } from "react"; -import React from "react"; +import type { ComponentProps, HTMLAttributes, ReactNode } from "react"; +import { forwardRef, useMemo } from "react"; export type VerticalStepProps = { className?: string; - description?: React.ReactNode; - title?: React.ReactNode; + description?: ReactNode; + title?: ReactNode; }; -export interface VerticalStepsProps - extends React.HTMLAttributes { +export interface VerticalStepsProps extends HTMLAttributes { /** * An array of steps. * @@ -88,10 +87,7 @@ function CheckIcon(props: ComponentProps<"svg">) { ); } -export const VerticalSteps = React.forwardRef< - HTMLButtonElement, - VerticalStepsProps ->( +export const VerticalSteps = forwardRef( ( { color = "primary", @@ -112,7 +108,7 @@ export const VerticalSteps = React.forwardRef< onStepChange, ); - const colors = React.useMemo(() => { + const colors = useMemo(() => { let userColor; let fgColor; diff --git a/ui/components/scans/table/scan-jobs-columns.test.tsx b/ui/components/scans/table/scan-jobs-columns.test.tsx index 03f22cecc0..829f24ed7f 100644 --- a/ui/components/scans/table/scan-jobs-columns.test.tsx +++ b/ui/components/scans/table/scan-jobs-columns.test.tsx @@ -2,7 +2,7 @@ import type { CellContext, HeaderContext } from "@tanstack/react-table"; import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; -import type { ScanProps } from "@/types"; +import { type ScanProps, SCAN_JOBS_TAB, type ScanJobsTab } from "@/types"; vi.mock("@/components/shadcn", () => ({ Badge: ({ children }: { children: React.ReactNode }) => ( @@ -51,8 +51,6 @@ vi.mock("./scan-jobs-row-actions", () => ({ ScanJobsRowActions: () =>