From fedf6075b79aacdfffada8707af588967738cebf Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 24 Oct 2023 14:45:11 +0100 Subject: [PATCH] Remove unused imports --- libs/remix-ui/workspace/src/lib/actions/events.ts | 10 +++++----- .../workspace/src/lib/components/file-explorer.tsx | 4 ++-- .../workspace/src/lib/components/file-render.tsx | 4 ++-- .../workspace/src/lib/providers/FileSystemProvider.tsx | 2 +- libs/remix-ui/workspace/src/lib/reducers/workspace.ts | 4 ++-- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++-- libs/remix-ui/workspace/src/lib/types/index.ts | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/events.ts b/libs/remix-ui/workspace/src/lib/actions/events.ts index 5c9b03141c..3c85231cb6 100644 --- a/libs/remix-ui/workspace/src/lib/actions/events.ts +++ b/libs/remix-ui/workspace/src/lib/actions/events.ts @@ -1,7 +1,7 @@ import { fileDecoration } from '@remix-ui/file-decorators' import { extractParentFromKey } from '@remix-ui/helper' import React from 'react' -import { action, WorkspaceTemplate } from '../types' +import { action, FileTree, WorkspaceTemplate } from '../types' import { ROOT_PATH } from '../utils/constants' import { displayNotification, displayPopUp, fileAddedSuccess, fileRemovedSuccess, fileRenamedSuccess, folderAddedSuccess, loadLocalhostError, loadLocalhostRequest, loadLocalhostSuccess, removeContextMenuItem, removeFocus, rootFolderChangedSuccess, setContextMenuItem, setMode, setReadOnlyMode, setFileDecorationSuccess } from './payload' import { addInputField, createWorkspace, deleteWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from './workspace' @@ -173,8 +173,8 @@ const folderAdded = async (folderPath: string) => { const provider = plugin.fileManager.currentFileProvider() const path = extractParentFromKey(folderPath) || ROOT_PATH - const promise = new Promise((resolve) => { - provider.resolveDirectory(path, (error, fileTree) => { + const promise: Promise = new Promise((resolve) => { + provider.resolveDirectory(path, (error, fileTree: FileTree) => { if (error) console.error(error) resolve(fileTree) }) @@ -196,8 +196,8 @@ const fileRemoved = async (removePath: string) => { const fileRenamed = async (oldPath: string) => { const provider = plugin.fileManager.currentFileProvider() const path = extractParentFromKey(oldPath) || ROOT_PATH - const promise = new Promise((resolve) => { - provider.resolveDirectory(path, (error, fileTree) => { + const promise: Promise = new Promise((resolve) => { + provider.resolveDirectory(path, (error, fileTree: FileTree) => { if (error) console.error(error) resolve(fileTree) diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 69e072ff40..8ee532f4c8 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -3,7 +3,7 @@ import {useIntl} from 'react-intl' import {TreeView} from '@remix-ui/tree-view' // eslint-disable-line import {FileExplorerMenu} from './file-explorer-menu' // eslint-disable-line import {FileExplorerContextMenu} from './file-explorer-context-menu' // eslint-disable-line -import {FileExplorerProps, FileType, WorkSpaceState} from '../types' +import {FileExplorerProps, FileType, WorkSpaceState, WorkspaceElement} from '../types' import '../css/file-explorer.css' import {checkSpecialChars, extractNameFromKey, extractParentFromKey, joinPath} from '@remix-ui/helper' @@ -151,7 +151,7 @@ export const FileExplorer = (props: FileExplorerProps) => { ) } - const handleClickFile = (path: string, type: 'folder' | 'file' | 'gist') => { + const handleClickFile = (path: string, type: WorkspaceElement) => { if (!state.ctrlKey) { props.dispatchHandleClickFile(path, type) } else { diff --git a/libs/remix-ui/workspace/src/lib/components/file-render.tsx b/libs/remix-ui/workspace/src/lib/components/file-render.tsx index a23ed76df3..ffb08b2a31 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-render.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-render.tsx @@ -1,6 +1,6 @@ // eslint-disable-next-line no-use-before-define import React, {SyntheticEvent, useEffect, useState} from 'react' -import {FileType} from '../types' +import {FileType, WorkspaceElement} from '../types' // eslint-disable-next-line @typescript-eslint/no-unused-vars import {TreeView, TreeViewItem} from '@remix-ui/tree-view' import {getPathIcon} from '@remix-ui/helper' @@ -14,7 +14,7 @@ export interface RenderFileProps { file: FileType index: number focusEdit: {element: string; type: string; isNew: boolean; lastEdit: string} - focusElement: {key: string; type: 'file' | 'folder' | 'gist'}[] + focusElement: {key: string; type: WorkspaceElement}[] focusContext: {element: string; x: number; y: number; type: string} ctrlKey: boolean expandPath: string[] diff --git a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx index 13adb71235..740c8c2e2d 100644 --- a/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx +++ b/libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx @@ -1,5 +1,5 @@ // eslint-disable-next-line no-use-before-define -import React, {useReducer, useState, useEffect, SyntheticEvent} from 'react' +import {useReducer, useState, useEffect, SyntheticEvent} from 'react' import {ModalDialog} from '@remix-ui/modal-dialog' // eslint-disable-line import {Toaster} from '@remix-ui/toaster' // eslint-disable-line // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index 05163370c0..adec39d281 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -1,5 +1,5 @@ import {extractNameFromKey} from '@remix-ui/helper' -import {action, Actions, FileType} from '../types' +import {action, Actions, FileType, WorkspaceElement} from '../types' import * as _ from 'lodash' import {fileDecoration} from '@remix-ui/file-decorators' import {ROOT_PATH} from '../utils/constants' @@ -59,7 +59,7 @@ export interface BrowserState { readonly: boolean popup: string focusEdit: string - focusElement: {key: string; type: 'file' | 'folder' | 'gist'}[] + focusElement: {key: string; type: WorkspaceElement}[] initializingFS: boolean gitConfig: {username: string; email: string; token: string} } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index e19799971d..87dd55d05d 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -1,7 +1,7 @@ -import React, {useState, useEffect, useRef, useContext, SyntheticEvent, ChangeEvent, KeyboardEvent, MouseEvent} from 'react' // eslint-disable-line +import {useState, useEffect, useRef, useContext, ChangeEvent} from 'react' // eslint-disable-line import {FormattedMessage, useIntl} from 'react-intl' import {Dropdown} from 'react-bootstrap' -import {CustomIconsToggle, CustomMenu, CustomToggle, CustomTooltip, extractNameFromKey, extractParentFromKey} from '@remix-ui/helper' +import {CustomIconsToggle, CustomMenu, CustomToggle, extractNameFromKey, extractParentFromKey} from '@remix-ui/helper' import {FileExplorer} from './components/file-explorer' // eslint-disable-line import {FileSystemContext} from './contexts' import './css/remix-ui-workspace.css' diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 27c3c10289..018a1cdb8e 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -88,7 +88,7 @@ export interface FileExplorerProps { focusEdit: string, hideIconsMenu: React.Dispatch>, showIconsMenu: boolean, - focusElement: { key: string, type: 'file' | 'folder' | 'gist' }[], + focusElement: { key: string, type: WorkspaceElement }[], dispatchCreateNewFile: (path: string, rootDir: string) => Promise, // eslint-disable-next-line no-undef modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, @@ -105,8 +105,8 @@ export interface FileExplorerProps { dispatchRunScript: (path: string) => Promise, dispatchPublishToGist: (path?: string, type?: string) => Promise, dispatchEmitContextMenuEvent: (cmd: customAction) => Promise, - dispatchHandleClickFile: (path: string, type: 'file' | 'folder' | 'gist') => Promise, - dispatchSetFocusElement: (elements: { key: string, type: 'file' | 'folder' | 'gist' }[]) => Promise, + dispatchHandleClickFile: (path: string, type: WorkspaceElement) => Promise, + dispatchSetFocusElement: (elements: { key: string, type: WorkspaceElement }[]) => Promise, dispatchFetchDirectory:(path: string) => Promise, dispatchRemoveInputField:(path: string) => Promise, dispatchAddInputField:(path: string, type: 'file' | 'folder') => Promise,