diff --git a/.eslintrc.js b/.eslintrc.js index 14f816be..4a82f923 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -50,10 +50,10 @@ module.exports = { 'max-len': ["warn", { "code": 100 }], "template-curly-spacing": "off", "comma-dangle": ["warn", { - "arrays": "never", - "objects": "always", - "imports": "never", - "exports": "never", + "arrays": "always-multiline", + "objects": "always-multiline", + "imports": "always-multiline", + "exports": "always-multiline", "functions": "never" }], indent: "off" diff --git a/src/components/editors/ImageGrid/index.tsx b/src/components/editors/ImageGrid/index.tsx index 74453cff..ba57ebd5 100644 --- a/src/components/editors/ImageGrid/index.tsx +++ b/src/components/editors/ImageGrid/index.tsx @@ -1,5 +1,5 @@ import React, { - FC, ReactChildren, useCallback, ChangeEventHandler, DragEventHandler + FC, useCallback, ChangeEventHandler, DragEventHandler } from 'react'; import { SortableContainer, SortableElement } from 'react-sortable-hoc'; import * as styles from './styles.scss'; @@ -15,7 +15,7 @@ interface IProps { onDrop: DragEventHandler; } -const SortableItem = SortableElement(({ children }) => ( +const SortableItem = SortableElement(({ children, }) => (
{children}
)); @@ -23,7 +23,7 @@ const SortableList = SortableContainer( ({ items, locked, - onDrop + onDrop, }: { items: IFile[]; locked: IUploadStatus[]; @@ -46,9 +46,9 @@ const SortableList = SortableContainer( ); const ImageGrid: FC = ({ - items, locked, onFileMove, onUpload, onDrop + items, locked, onFileMove, onUpload, onDrop, }) => { - const onMove = useCallback(({ oldIndex, newIndex }) => onFileMove(oldIndex, newIndex), [ + const onMove = useCallback(({ oldIndex, newIndex, }) => onFileMove(oldIndex, newIndex), [ onFileMove ]); @@ -60,7 +60,7 @@ const ImageGrid: FC = ({ locked={locked} onUpload={onUpload} onDrop={onDrop} - pressDelay={100} + pressDelay={window.innerWidth < 768 ? 200 : 0} helperClass={styles.helper} /> ); diff --git a/src/redux/store.ts b/src/redux/store.ts index 93a1a638..ffaf9c48 100644 --- a/src/redux/store.ts +++ b/src/redux/store.ts @@ -1,6 +1,4 @@ -import { - createStore, applyMiddleware, combineReducers, compose, Store -} from 'redux'; +import { createStore, applyMiddleware, combineReducers, compose, Store } from 'redux'; import { persistStore, persistReducer } from 'redux-persist'; import storage from 'redux-persist/lib/storage'; @@ -25,7 +23,7 @@ import modalReducer, { IModalState } from '~/redux/modal/reducer'; const authPersistConfig: PersistConfig = { key: 'auth', whitelist: ['token', 'user'], - storage + storage, }; export interface IState { @@ -39,9 +37,10 @@ export interface IState { export const sagaMiddleware = createSagaMiddleware(); export const history = createBrowserHistory(); -const composeEnhancers = typeof window === 'object' && (window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ - ? (window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) - : compose; +const composeEnhancers = + typeof window === 'object' && (window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ + ? (window).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) + : compose; export const store = createStore( combineReducers({ diff --git a/src/redux/uploads/handlers.ts b/src/redux/uploads/handlers.ts index 3aae7028..e24fe4f2 100644 --- a/src/redux/uploads/handlers.ts +++ b/src/redux/uploads/handlers.ts @@ -9,35 +9,35 @@ import { IUploadState } from './reducer'; const addStatus = ( state: IUploadState, - { temp_id, status }: ReturnType + { temp_id, status, }: ReturnType ): IUploadState => assocPath( ['statuses'], - { ...state.statuses, [temp_id]: { ...EMPTY_UPLOAD_STATUS, ...status } }, + { ...state.statuses, [temp_id]: { ...EMPTY_UPLOAD_STATUS, ...status, }, }, state ); const dropStatus = ( state: IUploadState, - { temp_id }: ReturnType + { temp_id, }: ReturnType ): IUploadState => assocPath(['statuses'], omit([temp_id], state.statuses), state); const setStatus = ( state: IUploadState, - { temp_id, status }: ReturnType + { temp_id, status, }: ReturnType ): IUploadState => assocPath( ['statuses'], { ...state.statuses, - [temp_id]: { ...(state.statuses[temp_id] || EMPTY_UPLOAD_STATUS), ...status } + [temp_id]: { ...(state.statuses[temp_id] || EMPTY_UPLOAD_STATUS), ...status, }, }, state ); -const addFile = (state: IUploadState, { file }: ReturnType): IUploadState => assocPath(['files'], { ...state.files, [file.id]: file }, state); +const addFile = (state: IUploadState, { file, }: ReturnType): IUploadState => assocPath(['files'], { ...state.files, [file.id]: file, }, state); export const UPLOAD_HANDLERS = { [UPLOAD_ACTIONS.ADD_STATUS]: addStatus, [UPLOAD_ACTIONS.DROP_STATUS]: dropStatus, [UPLOAD_ACTIONS.SET_STATUS]: setStatus, - [UPLOAD_ACTIONS.ADD_FILE]: addFile + [UPLOAD_ACTIONS.ADD_FILE]: addFile, };