From 6f8056c2f355b8f2a416d300aee115093ccdd8ec Mon Sep 17 00:00:00 2001 From: wooferzfg Date: Sun, 5 May 2024 12:01:32 -0400 Subject: [PATCH] Update Tooltip to use default argument --- .eslintrc | 3 +++ src/ui/tooltip.jsx | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index 00f0489d1e..f891b154e1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,6 +23,9 @@ "no-underscore-dangle": "off", "valid-jsdoc": ["error", { "requireReturn": false + }], + "react/require-default-props": ["error", { + "functions": "defaultArguments" }] }, "settings": { diff --git a/src/ui/tooltip.jsx b/src/ui/tooltip.jsx index 2304f4a00d..9be3117a3b 100644 --- a/src/ui/tooltip.jsx +++ b/src/ui/tooltip.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import React, { useId } from 'react'; import { Tooltip as ReactTooltip } from 'react-tooltip'; -function Tooltip({ children, tooltipContent }) { +function Tooltip({ children, tooltipContent = null }) { if (_.isNil(tooltipContent)) { return children; } @@ -28,10 +28,6 @@ function Tooltip({ children, tooltipContent }) { ); } -Tooltip.defaultProps = { - tooltipContent: null, -}; - Tooltip.propTypes = { children: PropTypes.element.isRequired, tooltipContent: PropTypes.node,