From d95336a7a0ce4c1c105a78c1c0670eed36027930 Mon Sep 17 00:00:00 2001 From: Robin Date: Tue, 19 Dec 2023 11:00:33 -0500 Subject: [PATCH] Ensure that all our components have display names This turns on a lint rule to require display names for all of our components, which makes it a lot easier to find your way around the component tree in React's dev tools. --- .eslintrc.cjs | 1 + src/Tooltip.tsx | 4 ++++ src/button/Button.tsx | 3 +++ src/form/Form.tsx | 2 ++ src/input/AvatarInputField.tsx | 2 ++ src/input/Input.tsx | 2 ++ src/popover/Popover.tsx | 2 ++ src/popover/PopoverMenu.tsx | 2 ++ src/typography/Typography.tsx | 15 +++++++++++++++ src/video-grid/BigGrid.tsx | 2 ++ src/video-grid/TileWrapper.tsx | 26 +++++++++++++++----------- src/video-grid/VideoTile.tsx | 2 ++ 12 files changed, 52 insertions(+), 11 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 64d24ebb2..f6a2e5693 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -47,6 +47,7 @@ module.exports = { "These components are easy to misuse, please use the 'subscribe' component wrapper instead", }, ], + "react/display-name": "error", }, settings: { react: { diff --git a/src/Tooltip.tsx b/src/Tooltip.tsx index b90c3f861..adaa18b33 100644 --- a/src/Tooltip.tsx +++ b/src/Tooltip.tsx @@ -59,6 +59,8 @@ const Tooltip = forwardRef( }, ); +Tooltip.displayName = "Tooltip"; + interface TooltipTriggerProps { children: ReactElement; placement?: Placement; @@ -112,3 +114,5 @@ export const TooltipTrigger = forwardRef( ); }, ); + +TooltipTrigger.displayName = "TooltipTrigger"; diff --git a/src/button/Button.tsx b/src/button/Button.tsx index e4ad8eb29..3111ac933 100644 --- a/src/button/Button.tsx +++ b/src/button/Button.tsx @@ -80,6 +80,7 @@ interface Props { // TODO: add all props for