Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable react/require-default-props rule #393

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/components/job/JobProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ export function JobProgress({ target, current, finished, error }: IJobProgress)
}
return null;
}

JobProgress.defaultProps = {
target: 0,
current: 0,
};
4 changes: 4 additions & 0 deletions src/components/lightbox/FileInfoComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ export function FileInfoComponent(props: { description?: string; info: string |
</Group>
);
}

FileInfoComponent.defaultProps = {
description: "",
};
16 changes: 15 additions & 1 deletion src/components/locationLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -224,3 +229,12 @@ export function LocationLink(props: Props) {
</div>
);
}

LocationLink.defaultProps = {
margin: {
top: 0,
left: 0,
right: 0,
bottom: 0,
},
};
6 changes: 6 additions & 0 deletions src/components/modals/ModalUserEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,9 @@ export function ModalUserEdit(props: Props) {
</Modal>
);
}

ModalUserEdit.defaultProps = {
updateAndScan: false,
selectedNodeId: "",
firstTimeSetup: false,
};
5 changes: 5 additions & 0 deletions src/components/react-pig/components/Tile/Tile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ const Tile = React.memo(
}
);

Tile.defaultProps = {
toprightoverlay: null,
bottomleftoverlay: null,
};

const ItemType = PropTypes.shape({
id: PropTypes.string,
dominantColor: PropTypes.string,
Expand Down
5 changes: 5 additions & 0 deletions src/components/settings/PasswordEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ export function PasswordEntry(props: Props): JSX.Element {
</Stack>
);
}

PasswordEntry.defaultProps = {
createNew: false,
closing: false,
};