From c29adbcedafe2edc400eded5f6308cd83bf11d38 Mon Sep 17 00:00:00 2001 From: sickelap Date: Sun, 5 Nov 2023 13:02:01 +0000 Subject: [PATCH] enable react/require-default-props rule --- .eslintrc.js | 1 - src/components/job/JobProgress.tsx | 5 +++++ src/components/lightbox/FileInfoComponent.tsx | 4 ++++ src/components/locationLink.tsx | 16 +++++++++++++++- src/components/modals/ModalUserEdit.tsx | 6 ++++++ .../react-pig/components/Tile/Tile.jsx | 5 +++++ src/components/settings/PasswordEntry.tsx | 5 +++++ 7 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 93da8239..dcc1a5f5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,7 +12,6 @@ module.exports = { "import/no-cycle": "warn", "react/jsx-props-no-spreading": "off", // some Mantine components need to use spread operator "react-hooks/exhaustive-deps": "off", // at this stage it is too risky to enable this - "react/require-default-props": "warn", }, parserOptions: { project: "./tsconfig.eslint.json", diff --git a/src/components/job/JobProgress.tsx b/src/components/job/JobProgress.tsx index 85344686..f4f8061b 100644 --- a/src/components/job/JobProgress.tsx +++ b/src/components/job/JobProgress.tsx @@ -32,3 +32,8 @@ export function JobProgress({ target, current, finished, error }: IJobProgress) } return null; } + +JobProgress.defaultProps = { + target: 0, + current: 0, +}; diff --git a/src/components/lightbox/FileInfoComponent.tsx b/src/components/lightbox/FileInfoComponent.tsx index e8e393e2..f8284d32 100644 --- a/src/components/lightbox/FileInfoComponent.tsx +++ b/src/components/lightbox/FileInfoComponent.tsx @@ -21,3 +21,7 @@ export function FileInfoComponent(props: { description?: string; info: string | ); } + +FileInfoComponent.defaultProps = { + description: "", +}; diff --git a/src/components/locationLink.tsx b/src/components/locationLink.tsx index 7b0cafbe..2cdf61e3 100644 --- a/src/components/locationLink.tsx +++ b/src/components/locationLink.tsx @@ -26,7 +26,12 @@ import { useAppDispatch, useAppSelector } from "../store/store"; type Props = { width: number; height: number; - margin?: { top: number; left: number; right: number; bottom: number }; + margin?: { + top: number; + left: number; + right: number; + bottom: number; + }; }; export function LocationLink(props: Props) { @@ -224,3 +229,12 @@ export function LocationLink(props: Props) { ); } + +LocationLink.defaultProps = { + margin: { + top: 0, + left: 0, + right: 0, + bottom: 0, + }, +}; diff --git a/src/components/modals/ModalUserEdit.tsx b/src/components/modals/ModalUserEdit.tsx index c2562983..eda97604 100644 --- a/src/components/modals/ModalUserEdit.tsx +++ b/src/components/modals/ModalUserEdit.tsx @@ -347,3 +347,9 @@ export function ModalUserEdit(props: Props) { ); } + +ModalUserEdit.defaultProps = { + updateAndScan: false, + selectedNodeId: "", + firstTimeSetup: false, +}; diff --git a/src/components/react-pig/components/Tile/Tile.jsx b/src/components/react-pig/components/Tile/Tile.jsx index 6ad40a45..3719894d 100644 --- a/src/components/react-pig/components/Tile/Tile.jsx +++ b/src/components/react-pig/components/Tile/Tile.jsx @@ -182,6 +182,11 @@ const Tile = React.memo( } ); +Tile.defaultProps = { + toprightoverlay: null, + bottomleftoverlay: null, +}; + const ItemType = PropTypes.shape({ id: PropTypes.string, dominantColor: PropTypes.string, diff --git a/src/components/settings/PasswordEntry.tsx b/src/components/settings/PasswordEntry.tsx index b92082ff..2b3c4693 100644 --- a/src/components/settings/PasswordEntry.tsx +++ b/src/components/settings/PasswordEntry.tsx @@ -100,3 +100,8 @@ export function PasswordEntry(props: Props): JSX.Element { ); } + +PasswordEntry.defaultProps = { + createNew: false, + closing: false, +};