Skip to content

Commit 8ea923a

Browse files
chore: fix eslint-react type issues
Our prop types are fine, but eslint-react isn't detecting them correctly. With a little help jsx-eslint/eslint-plugin-react#3284 (comment) we can tell it what the props are.
1 parent 7a04866 commit 8ea923a

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

src/alert/alert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from "react";
1+
import React, { type ComponentProps } from "react";
22

33
type AlertVariant = "success" | "info" | "warning" | "danger";
44

5-
export type AlertProps = React.ComponentProps<"div"> & {
5+
export type AlertProps = ComponentProps<"div"> & {
66
variant: AlertVariant;
77
};
88

src/drop-down/menu-item/menu-item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Menu } from "@headlessui/react";
2-
import React from "react";
2+
import React, { type ComponentPropsWithoutRef } from "react";
33
import { type ButtonProps, HeadlessButton } from "../../button";
44

5-
export type MenuItemsProps = React.ComponentPropsWithoutRef<typeof Menu.Items> &
5+
export type MenuItemsProps = ComponentPropsWithoutRef<typeof Menu.Items> &
66
ButtonProps;
77

88
const defaultClass =

src/form-control/form-control-feedback.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from "react";
1+
import React, { type ComponentProps } from "react";
22

33
export const FormControlFeedback = ({
44
children,
55
className,
66
...props
7-
}: React.ComponentProps<"span">): JSX.Element => {
7+
}: ComponentProps<"span">): JSX.Element => {
88
const defaultClasses =
99
"absolute top-[30px] right-0 z-2 block w-8 h-8 leading-8 text-center pointer-events-none text-green-700";
1010

src/form-control/form-control-static.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from "react";
1+
import React, { type ComponentProps } from "react";
22

33
export const FormControlStatic = ({
44
className,
55
children,
66
...props
7-
}: React.ComponentProps<"p">): JSX.Element => {
7+
}: ComponentProps<"p">): JSX.Element => {
88
const defaultClasses = "py-1.5 mb-0 min-h-43-px text-foreground-secondary";
99

1010
const classes = [defaultClasses, className].join(" ");

src/form-control/form-control.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { type ComponentProps } from "react";
22
import { Meta, StoryFn, StoryObj } from "@storybook/react";
33
import { FormControl } from ".";
44

@@ -49,7 +49,7 @@ export const Static: StoryObj<typeof FormControl.Static> = {
4949
},
5050
};
5151

52-
const FeedBackTemplate: StoryFn<React.ComponentProps<"span">> = (args) => {
52+
const FeedBackTemplate: StoryFn<ComponentProps<"span">> = (args) => {
5353
return <FormControl.Feedback {...args} />;
5454
};
5555

src/form-control/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from "react";
1+
import React, { type ComponentProps } from "react";
22

33
export type FormControlProps<
44
TElement extends
55
| keyof JSX.IntrinsicElements
66
| React.JSXElementConstructor<unknown> = "input",
77
> = {
88
componentClass?: TElement | string;
9-
} & React.ComponentProps<TElement>;
9+
} & ComponentProps<TElement>;

src/help-block/help-block.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext } from "react";
1+
import React, { useContext, type ComponentProps } from "react";
22
import { FormContext } from "../form-group/form-group";
33

44
const defaultClasses = "block mt-1 mb-2";
@@ -10,7 +10,7 @@ const validationLabel = {
1010

1111
export const HelpBlock = React.forwardRef<
1212
HTMLSpanElement,
13-
React.ComponentProps<"span">
13+
ComponentProps<"span">
1414
>(({ className, children, ...props }, ref): JSX.Element => {
1515
const { validationState } = useContext(FormContext);
1616

src/modal/modal.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const DefaultTemplate: StoryFn<StoryProps> = ({
3737
showCloseButton,
3838
alignment,
3939
...modalProps
40-
}) => {
40+
}: StoryProps) => {
4141
const [open, setOpen] = useState(false);
4242

4343
const handleClose = () => setOpen(false);

src/panel/panel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { createContext, useContext } from "react";
1+
import React, { createContext, useContext, type ComponentProps } from "react";
22

33
import { PanelProps } from "./types";
44

@@ -22,7 +22,7 @@ const Body = ({
2222
children,
2323
className,
2424
...props
25-
}: React.ComponentProps<"div">): JSX.Element => {
25+
}: ComponentProps<"div">): JSX.Element => {
2626
const classes = [className, "p-3.5"].join(" ");
2727
return (
2828
<div className={classes} {...props}>
@@ -35,7 +35,7 @@ export const Heading = ({
3535
children,
3636
className,
3737
...props
38-
}: React.ComponentProps<"div">): JSX.Element => {
38+
}: ComponentProps<"div">): JSX.Element => {
3939
const { variant } = useContext(PanelContext);
4040

4141
const headingStyles = variant
@@ -53,7 +53,7 @@ export const Heading = ({
5353
export const Title = ({
5454
children,
5555
...props
56-
}: React.ComponentProps<"h3">): JSX.Element => {
56+
}: ComponentProps<"h3">): JSX.Element => {
5757
return (
5858
<h3 className="text-inherit mb-0 text-xl" {...props}>
5959
{children}

src/tabs/tabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { type ComponentPropsWithoutRef } from "react";
22
import { Root, List, Trigger, Content } from "@radix-ui/react-tabs";
33

44
const buttonClassNames =
@@ -10,15 +10,15 @@ const listClassNames =
1010

1111
export const TabsTrigger = React.forwardRef<
1212
React.ElementRef<typeof Trigger>,
13-
React.ComponentPropsWithoutRef<typeof Trigger>
13+
ComponentPropsWithoutRef<typeof Trigger>
1414
>(({ className, ...props }, ref) => {
1515
const triggerClasses = [buttonClassNames, className].join(" ");
1616
return <Trigger ref={ref} className={triggerClasses} {...props} />;
1717
});
1818

1919
export const TabsList = React.forwardRef<
2020
React.ElementRef<typeof List>,
21-
React.ComponentPropsWithoutRef<typeof List>
21+
ComponentPropsWithoutRef<typeof List>
2222
>(({ className, ...props }, ref) => {
2323
const listClasses = [listClassNames, className].join(" ");
2424
return <List ref={ref} className={listClasses} {...props} />;

0 commit comments

Comments
 (0)