Skip to content

Commit 04a037e

Browse files
lkostrowskiclaude
andauthored
refactor: replace JSX.Element return types with React.ReactNode (#6926)
JSX.Element excludes null, strings, numbers, and fragments that components legitimately return. Fixes all 340 react-doctor no-jsx-element-type diagnostics. createNavigationLucideIcon's factories declared `() => JSX.Element` as a function type, which the rule does not flag but which blocked widening the components they return, so those widened too. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d168166 commit 04a037e

278 files changed

Lines changed: 360 additions & 345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/attributes/components/AssignedAttributesCard/AssignedAttributesBulkDeleteButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface AssignedAttributesBulkDeleteButtonProps {
1111
export const AssignedAttributesBulkDeleteButton = ({
1212
onClick,
1313
label,
14-
}: AssignedAttributesBulkDeleteButtonProps): JSX.Element => (
14+
}: AssignedAttributesBulkDeleteButtonProps): React.ReactNode => (
1515
<Button
1616
data-test-id="bulk-delete-button"
1717
variant="tertiary"

src/attributes/components/AssignedAttributesCard/AssignedAttributesCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const AssignedAttributesCard = ({
7878
onAttributeCreate,
7979
onAttributeReorder,
8080
onAttributeUnassign,
81-
}: AssignedAttributesCardProps): JSX.Element => {
81+
}: AssignedAttributesCardProps): React.ReactNode => {
8282
const intl = useIntl();
8383
const { items: orderedAttributes, onSortEnd } = useOptimisticListReorder(
8484
attributes,

src/attributes/components/AttributeAssignedTypesCard/AttributeAssignedTypesCard.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { MemoryRouter } from "react-router-dom";
66

77
import { AttributeAssignedTypesCard } from "./AttributeAssignedTypesCard";
88

9-
const RouterWrapper = ({ children }: { children: ReactNode }): JSX.Element => (
9+
const RouterWrapper = ({ children }: { children: ReactNode }): React.ReactNode => (
1010
<MemoryRouter>
1111
<Wrapper>{children}</Wrapper>
1212
</MemoryRouter>

src/attributes/components/AttributeAssignedTypesCard/AttributeAssignedTypesCard.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface UsageTypeRowProps {
3333
roles?: AssignedTypeRole[];
3434
}
3535

36-
const UsageTypeRow = ({ name, href, roles }: UsageTypeRowProps): JSX.Element => {
36+
const UsageTypeRow = ({ name, href, roles }: UsageTypeRowProps): React.ReactNode => {
3737
const intl = useIntl();
3838

3939
return (
@@ -71,7 +71,7 @@ interface UsageListProps {
7171
showRoles: boolean;
7272
}
7373

74-
const UsageList = ({ types, getTypeUrl, showRoles }: UsageListProps): JSX.Element => (
74+
const UsageList = ({ types, getTypeUrl, showRoles }: UsageListProps): React.ReactNode => (
7575
<Box as="ul" className={styles.list} data-test-id="attribute-usage-list">
7676
{types.map(type => (
7777
<UsageTypeRow
@@ -97,7 +97,7 @@ interface UsageCardSkeletonProps {
9797
showRolePills: boolean;
9898
}
9999

100-
const UsageCardSkeleton = ({ showRolePills }: UsageCardSkeletonProps): JSX.Element => (
100+
const UsageCardSkeleton = ({ showRolePills }: UsageCardSkeletonProps): React.ReactNode => (
101101
<Box as="ul" className={styles.list} data-test-id="attribute-usage-card-skeleton">
102102
{USAGE_SKELETON_ROW_WIDTHS.map(width => (
103103
<Box as="li" key={width} className={styles.listItem}>
@@ -115,7 +115,7 @@ const UsageEmptyState = ({
115115
hintMessage,
116116
linkMessage,
117117
href,
118-
}: UsageEmptyStateProps): JSX.Element => (
118+
}: UsageEmptyStateProps): React.ReactNode => (
119119
<Box display="flex" flexDirection="column" gap={2}>
120120
<Text size={3} color="default2">
121121
<FormattedMessage {...message} />
@@ -142,7 +142,7 @@ export const AttributeAssignedTypesCard = ({
142142
variantTypes,
143143
modelTypes,
144144
modelTypesListHasMore = false,
145-
}: AttributeAssignedTypesCardProps): JSX.Element => {
145+
}: AttributeAssignedTypesCardProps): React.ReactNode => {
146146
const intl = useIntl();
147147
const isProductAttribute = attributeType === AttributeTypeEnum.PRODUCT_TYPE;
148148
const productUsage = mergeProductAssignedTypeUsage(productTypes, variantTypes);

src/attributes/components/AttributeDetails/AttributeDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ interface AttributeDetailsProps
6868
variant?: "card" | "embedded";
6969
}
7070

71-
const AttributeDetails = (props: AttributeDetailsProps): JSX.Element => {
71+
const AttributeDetails = (props: AttributeDetailsProps): React.ReactNode => {
7272
const {
7373
canChangeType,
7474
errors,

src/attributes/components/AttributeListTableSkeleton/AttributeListTableSkeleton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface AttributeListTableSkeletonRowsProps {
1212
export const AttributeListTableSkeletonRows = ({
1313
rowCount = 3,
1414
variantColumn,
15-
}: AttributeListTableSkeletonRowsProps): JSX.Element => (
15+
}: AttributeListTableSkeletonRowsProps): React.ReactNode => (
1616
<>
1717
{Array.from({ length: rowCount }, (_, index) => (
1818
<TableRow key={index} className={tableStyles.row}>

src/attributes/components/AttributeOrganization/AttributeOrganization.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const ClassTile = ({
4141
tileRef: (node: HTMLElement | null) => void;
4242
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
4343
onSelect: (value: AttributeTypeEnum) => void;
44-
}): JSX.Element => {
44+
}): React.ReactNode => {
4545
const Icon = option.icon;
4646

4747
return (
@@ -89,7 +89,7 @@ const AttributeOrganization = ({
8989
data,
9090
disabled,
9191
onChange,
92-
}: AttributeOrganizationProps): JSX.Element => {
92+
}: AttributeOrganizationProps): React.ReactNode => {
9393
const intl = useIntl();
9494
const tileRefs = useRef<Partial<Record<AttributeTypeEnum, HTMLElement | null>>>({});
9595
const value = data.type ?? AttributeTypeEnum.PRODUCT_TYPE;

src/attributes/components/AttributePage/AttributePage.topNav.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const staffUser: UserFragment = {
3131
restrictedAccessToChannels: false,
3232
};
3333

34-
const Wrapper = ({ children }: { children: ReactNode }): JSX.Element => (
34+
const Wrapper = ({ children }: { children: ReactNode }): React.ReactNode => (
3535
<MemoryRouter>
3636
<UserContext.Provider
3737
value={{

src/attributes/components/AttributePage/Title.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const mockUser: UserFragment = {
4040
restrictedAccessToChannels: false,
4141
};
4242

43-
const Wrapper = ({ children }: { children: ReactNode }): JSX.Element => (
43+
const Wrapper = ({ children }: { children: ReactNode }): React.ReactNode => (
4444
<MemoryRouter>
4545
<UserContext.Provider
4646
value={{

src/attributes/components/AttributeProperties/AttributeProperties.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const AttributePropertiesPlayground = ({
1919
initial,
2020
}: {
2121
initial: Partial<AttributePageFormData>;
22-
}): JSX.Element => {
22+
}): React.ReactNode => {
2323
const [data, setData] = useState<AttributePageFormData>({
2424
...getAttributePageInitialForm(),
2525
...initial,

0 commit comments

Comments
 (0)