π OpenHands: AI-Driven Development
Fix issue #2029: Replace defaultProps with JavaScript default parameters (#2106)
Prithvi13d04fa36c04
diff --git a/frontend/.eslintrc b/frontend/.eslintrcindex 3b2799979e..8569f120fb 100644--- a/frontend/.eslintrc+++ b/frontend/.eslintrc@@ -44,6 +44,7 @@}],// For https://stackoverflow.com/questions/55844608/stuck-with-eslint-error-i-e-separately-loops-should-be-avoided-in-favor-of-arra"no-restricted-syntax": "off",+ "react/require-default-props": "off","import/prefer-default-export": "off","no-underscore-dangle": "off","jsx-a11y/no-static-element-interactions": "off",diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex 66df1434d6..c6e79aee86 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -9037,6 +9037,7 @@"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz","integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==","dev": true,+ "license": "MIT","dependencies": {"@eslint-community/eslint-utils": "^4.2.0","@eslint-community/regexpp": "^4.6.1",diff --git a/frontend/src/components/AgentControlBar.tsx b/frontend/src/components/AgentControlBar.tsxindex 32eddb3eb3..6994df61b3 100644--- a/frontend/src/components/AgentControlBar.tsx+++ b/frontend/src/components/AgentControlBar.tsx@@ -41,7 +41,7 @@ function ActionButton({action,handleAction,children,- large,+ large = false,}: React.PropsWithChildren<ButtonProps>): React.ReactNode {return (<Tooltip content={content} closeDelay={100}>@@ -57,10 +57,6 @@ function ActionButton({);}-ActionButton.defaultProps = {- large: false,-};-function AgentControlBar() {const { curAgentState } = useSelector((state: RootState) => state.agent);const [desiredState, setDesiredState] = React.useState(AgentState.INIT);diff --git a/frontend/src/components/IconButton.tsx b/frontend/src/components/IconButton.tsxindex 30f69cdb48..ad19a4f35c 100644--- a/frontend/src/components/IconButton.tsx+++ b/frontend/src/components/IconButton.tsx@@ -12,7 +12,7 @@ function IconButton({icon,onClick,ariaLabel,- testId,+ testId = "",}: IconButtonProps): React.ReactElement {return (<Button@@ -28,8 +28,4 @@ function IconButton({);}-IconButton.defaultProps = {- testId: "",-};-export default IconButton;diff --git a/frontend/src/components/chat/ChatInput.tsx b/frontend/src/components/chat/ChatInput.tsxindex 568e43ef5e..b1cee26688 100644--- a/frontend/src/components/chat/ChatInput.tsx+++ b/frontend/src/components/chat/ChatInput.tsx@@ -10,7 +10,7 @@ interface ChatInputProps {onSendMessage: (message: string) => void;}-function ChatInput({ disabled, onSendMessage }: ChatInputProps) {+function ChatInput({ disabled = false, onSendMessage }: ChatInputProps) {const { t } = useTranslation();const [message, setMessage] = React.useState("");@@ -70,8 +70,4 @@ function ChatInput({ disabled, onSendMessage }: ChatInputProps) {);}-ChatInput.defaultProps = {- disabled: false,-};-export default ChatInput;diff --git a/frontend/src/components/file-explorer/ExplorerTree.tsx b/frontend/src/components/file-explorer/ExplorerTree.tsxindex ceb37f05eb..0356f505e0 100644--- a/frontend/src/components/file-explorer/ExplorerTree.tsx+++ b/frontend/src/components/file-explorer/ExplorerTree.tsx@@ -16,8 +16,4 @@ function ExplorerTree({ files, defaultOpen = false }: ExplorerTreeProps) {);}-ExplorerTree.defaultProps = {- defaultOpen: false,-};-export default ExplorerTree;diff --git a/frontend/src/components/file-explorer/TreeNode.tsx b/frontend/src/components/file-explorer/TreeNode.tsxindex df22093ede..31c86d1d0f 100644--- a/frontend/src/components/file-explorer/TreeNode.tsx+++ b/frontend/src/components/file-explorer/TreeNode.tsx@@ -94,8 +94,4 @@ function TreeNode({ path, defaultOpen = false }: TreeNodeProps) {);}-TreeNode.defaultProps = {- defaultOpen: false,-};-export default React.memo(TreeNode);diff --git a/frontend/src/components/modals/base-modal/BaseModal.tsx b/frontend/src/components/modals/base-modal/BaseModal.tsxindex a0231258ad..5c239de108 100644--- a/frontend/src/components/modals/base-modal/BaseModal.tsx+++ b/frontend/src/components/modals/base-modal/BaseModal.tsx@@ -24,9 +24,9 @@ function BaseModal({onOpenChange,title,isDismissable = true,- subtitle,- actions,- children,+ subtitle = undefined,+ actions = [],+ children = null,}: BaseModalProps) {return (<Modal@@ -60,11 +60,4 @@ function BaseModal({);}-BaseModal.defaultProps = {- isDismissable: true,- subtitle: undefined,- actions: [],- children: null,-};-export default BaseModal;diff --git a/frontend/src/components/modals/base-modal/HeaderContent.tsx b/frontend/src/components/modals/base-modal/HeaderContent.tsxindex 945b9a8147..147797f54a 100644--- a/frontend/src/components/modals/base-modal/HeaderContent.tsx+++ b/frontend/src/components/modals/base-modal/HeaderContent.tsx@@ -5,7 +5,10 @@ interface HeaderContentProps {subtitle?: string;}-export function HeaderContent({ title, subtitle }: HeaderContentProps) {+export function HeaderContent({+ title,+ subtitle = undefined,+}: HeaderContentProps) {return (<><h3>{title}</h3>@@ -15,7 +18,3 @@ export function HeaderContent({ title, subtitle }: HeaderContentProps) {</>);}--HeaderContent.defaultProps = {- subtitle: undefined,-};diff --git a/frontend/src/components/modals/settings/AutocompleteCombobox.tsx b/frontend/src/components/modals/settings/AutocompleteCombobox.tsxindex a04ad9965d..090b1a9055 100644--- a/frontend/src/components/modals/settings/AutocompleteCombobox.tsx+++ b/frontend/src/components/modals/settings/AutocompleteCombobox.tsx@@ -77,8 +77,3 @@ export function AutocompleteCombobox({</Tooltip>);}--AutocompleteCombobox.defaultProps = {- allowCustomValue: false,- disabled: false,-};