Skip to content

Commit

Permalink
🚨 front: linter empty function and react props warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlinagora committed Nov 13, 2024
1 parent a2840f1 commit 1c2a56a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type DriveItemOverlayProps = {
item: DriveItem|null;
className: string;
};
export const menuBuilder = async () => {};

export const CheckableIcon = ({
show,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ConfirmModalType = {
parent_id: string;
mode: 'move' | 'select-file' | 'select-files';
title: string;
onSelected: (ids: string[]) => Promise<void>;
onSelected?: (ids: string[]) => Promise<void>;
};

export const ConfirmModalAtom = atom<ConfirmModalType>({
Expand All @@ -21,7 +21,6 @@ export const ConfirmModalAtom = atom<ConfirmModalType>({
parent_id: '',
mode: 'move',
title: '',
onSelected: async () => {},
},
});

Expand All @@ -40,7 +39,7 @@ const ConfirmModalContent = () => {

const handleClose = async () => {
setLoading(true);
await state.onSelected(selected.map((i) => i.id));
state.onSelected && await state.onSelected(selected.map((i) => i.id));
setState({ ...state, open: false });
setLoading(false);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type SelectorModalType = {
parent_id: string;
mode: 'move' | 'select-file' | 'select-files';
title: string;
onSelected: (ids: string[]) => Promise<void>;
onSelected?: (ids: string[]) => Promise<void>;
};

export const SelectorModalAtom = atom<SelectorModalType>({
Expand All @@ -25,7 +25,6 @@ export const SelectorModalAtom = atom<SelectorModalType>({
parent_id: '',
mode: 'move',
title: '',
onSelected: async () => {},
},
});

Expand Down Expand Up @@ -135,7 +134,7 @@ const SelectorModalContent = (key: any) => {
className="float-right"
onClick={async () => {
setLoading(true);
await state.onSelected(selected.map(i => i.id));
state.onSelected && await state.onSelected(selected.map(i => i.id));
setState({ ...state, open: false });
setLoading(false);
}}
Expand Down
8 changes: 6 additions & 2 deletions tdrive/frontend/src/app/views/client/viewer/drive-preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom';
import { Transition } from '@headlessui/react';
import { fadeTransition } from 'src/utils/transitions';
Expand All @@ -24,7 +25,6 @@ import Controls from './controls';
interface DrivePreviewProps {
items: DriveItem[];
}

export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
const history = useHistory();
const company = useRouterCompany();
Expand Down Expand Up @@ -64,6 +64,7 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {

useEffect(() => {
if (items.length < 2)
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {};
addShortcut({ shortcut: 'Right', handler: handleSwitchRight });
addShortcut({ shortcut: 'Left', handler: handleSwitchLeft });
Expand Down Expand Up @@ -183,4 +184,7 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
</Transition>
</Modal>
);
};
};
DrivePreview.propTypes = {
items: PropTypes.any.isRequired,
}

0 comments on commit 1c2a56a

Please sign in to comment.