mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
eslint auto-fix
This commit is contained in:
parent
312156bdf8
commit
4c4461ea19
55 changed files with 107 additions and 110 deletions
|
@ -20,7 +20,7 @@ export const useFlow = () => {
|
|||
|
||||
const onChangeCellView = useCallback(
|
||||
(id: INode['id'], val: FlowDisplay) => dispatch(flowSetCellView(id, val)),
|
||||
[]
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
return { nodes, heroes, recent, updates, isFluid, toggleLayout, onChangeCellView };
|
||||
|
|
|
@ -9,7 +9,7 @@ export const useFlowCellControls = (
|
|||
) => {
|
||||
const onChange = useCallback(
|
||||
(value: Partial<FlowDisplay>) => onChangeCellView(id, { ...flow, ...value }),
|
||||
[flow, onChangeCellView]
|
||||
[flow, id, onChangeCellView]
|
||||
);
|
||||
|
||||
const hasDescription = !!description && description.length > 32;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { useCallback, useEffect } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { flowGetMore } from '~/redux/flow/actions';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useInfiniteLoader } from '~/utils/hooks/useInfiniteLoader';
|
||||
|
||||
export const useFlowPagination = ({ isLoading }) => {
|
||||
const dispatch = useDispatch();
|
||||
const loadMore = useCallback(() => dispatch(flowGetMore()), []);
|
||||
const loadMore = useCallback(() => dispatch(flowGetMore()), [dispatch]);
|
||||
useInfiniteLoader(loadMore, isLoading);
|
||||
};
|
||||
|
|
|
@ -53,6 +53,6 @@ export const useFileDropZone = (onUpload: (file: File[]) => void, allowedTypes?:
|
|||
|
||||
onUpload(files);
|
||||
},
|
||||
[onUpload]
|
||||
[allowedTypes, onUpload]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -40,5 +40,5 @@ export const useLabPagination = (
|
|||
return () => {
|
||||
lastItems.forEach(item => observer.unobserve(item));
|
||||
};
|
||||
}, [observer, columns]);
|
||||
}, [observer, columns, isLoading]);
|
||||
};
|
||||
|
|
|
@ -6,5 +6,5 @@ import { URLS } from '~/constants/urls';
|
|||
// useGotoNode returns fn, that navigates to node
|
||||
export const useGotoNode = (id: INode['id']) => {
|
||||
const history = useHistory();
|
||||
return useCallback(() => history.push(URLS.NODE_URL(id)), [id]);
|
||||
return useCallback(() => history.push(URLS.NODE_URL(id)), [history, id]);
|
||||
};
|
||||
|
|
|
@ -13,5 +13,5 @@ export const useGrouppedComments = (
|
|||
groupCommentsByUser(lastSeen),
|
||||
[]
|
||||
),
|
||||
[comments, order]
|
||||
[comments, lastSeen, order]
|
||||
);
|
||||
|
|
|
@ -14,5 +14,5 @@ export const useLoadNode = (id: any, isLoading: boolean) => {
|
|||
return () => {
|
||||
dispatch(nodeSetCurrent(EMPTY_NODE));
|
||||
};
|
||||
}, [dispatch, id]);
|
||||
}, [dispatch, id, isLoading]);
|
||||
};
|
||||
|
|
|
@ -6,14 +6,10 @@ import { nodeEdit, nodeLike, nodeLock, nodeStar } from '~/redux/node/actions';
|
|||
export const useNodeActions = (node: INode) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const onEdit = useCallback(() => dispatch(nodeEdit(node.id)), [dispatch, nodeEdit, node]);
|
||||
const onLike = useCallback(() => dispatch(nodeLike(node.id)), [dispatch, nodeLike, node]);
|
||||
const onStar = useCallback(() => dispatch(nodeStar(node.id)), [dispatch, nodeStar, node]);
|
||||
const onLock = useCallback(() => dispatch(nodeLock(node.id, !node.deleted_at)), [
|
||||
dispatch,
|
||||
nodeLock,
|
||||
node,
|
||||
]);
|
||||
const onEdit = useCallback(() => dispatch(nodeEdit(node.id)), [dispatch, node]);
|
||||
const onLike = useCallback(() => dispatch(nodeLike(node.id)), [dispatch, node]);
|
||||
const onStar = useCallback(() => dispatch(nodeStar(node.id)), [dispatch, node]);
|
||||
const onLock = useCallback(() => dispatch(nodeLock(node.id, !node.deleted_at)), [dispatch, node]);
|
||||
|
||||
return { onEdit, onLike, onStar, onLock };
|
||||
};
|
||||
|
|
|
@ -19,6 +19,6 @@ export const useBlockBackButton = (callback?: () => void) => {
|
|||
callback();
|
||||
}
|
||||
}),
|
||||
[callback, history]
|
||||
[callback]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ export const useClickOutsideFocus = () => {
|
|||
document.addEventListener('mouseup', deactivator);
|
||||
|
||||
return () => document.removeEventListener('mouseup', deactivator);
|
||||
}, [isActive]);
|
||||
}, [deactivate, isActive]);
|
||||
|
||||
useCloseOnEscape(deactivate);
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ import { stringToColour } from '~/utils/dom';
|
|||
export const useColorFromString = (val?: string, saturation = 3, lightness = 3) => {
|
||||
return useMemo(
|
||||
() => (val && normalizeBrightColor(stringToColour(val), saturation, lightness)) || '',
|
||||
[]
|
||||
[lightness, saturation, val]
|
||||
);
|
||||
};
|
||||
|
|
|
@ -19,4 +19,4 @@ export const useColorGradientFromString = (
|
|||
const third = normalizeBrightColor(adjustHue(color, 90), saturation, lightness);
|
||||
|
||||
return `linear-gradient(${angle}deg, ${color}, ${second}, ${third})`;
|
||||
}, [val]);
|
||||
}, [angle, lightness, saturation, val]);
|
||||
|
|
|
@ -71,7 +71,7 @@ export const useCommentFormFormik = (
|
|||
if (formik.status) {
|
||||
formik.setStatus('');
|
||||
}
|
||||
}, [formik.values.text]);
|
||||
}, [formik, formik.values.text]);
|
||||
|
||||
return formik;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import React, { FC, useContext } from 'react';
|
||||
import { createContext, useCallback, useEffect, useState } from 'react';
|
||||
import React, { createContext, FC, useCallback, useContext, useEffect, useState } from 'react';
|
||||
|
||||
const DragContext = createContext({
|
||||
isDragging: false,
|
||||
|
@ -44,7 +43,7 @@ export const useDragDetector = () => {
|
|||
document.removeEventListener('blur', removeClass);
|
||||
document.removeEventListener('drop', onStopDragging);
|
||||
};
|
||||
}, [setIsDragging]);
|
||||
}, [onStopDragging, setIsDragging]);
|
||||
|
||||
return { isDragging, onStopDragging };
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@ export const useInputPasteUpload = (
|
|||
if (!image) return;
|
||||
|
||||
onUpload([image]);
|
||||
}, []);
|
||||
}, [onUpload]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!input) return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { IComment, INode } from '~/redux/types';
|
||||
import { INode } from '~/redux/types';
|
||||
import { FileUploader } from '~/utils/hooks/useFileUploader';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { FormikHelpers, useFormik, useFormikContext } from 'formik';
|
||||
import { object, string } from 'yup';
|
||||
import { object } from 'yup';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { nodeSubmitLocal } from '~/redux/node/actions';
|
||||
import { keys } from 'ramda';
|
||||
|
@ -39,7 +39,7 @@ export const useNodeFormFormik = (
|
|||
const onSubmit = useCallback((values: INode, helpers: FormikHelpers<INode>) => {
|
||||
helpers.setSubmitting(true);
|
||||
dispatch(nodeSubmitLocal(values, onSuccess(helpers)));
|
||||
}, []);
|
||||
}, [dispatch]);
|
||||
|
||||
const { current: initialValues } = useRef(values);
|
||||
|
||||
|
@ -60,7 +60,7 @@ export const useNodeFormFormik = (
|
|||
|
||||
useEffect(() => {
|
||||
formik.setFieldValue('files', uploader.files);
|
||||
}, [formik.setFieldValue, uploader.files]);
|
||||
}, [formik, formik.setFieldValue, uploader.files]);
|
||||
|
||||
return formik;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue