eslint: consistent type imports

This commit is contained in:
Labhansh Agrawal 2023-06-26 14:59:50 +05:30
parent 0eb05e8416
commit 928209b914
65 changed files with 141 additions and 112 deletions

View file

@ -92,7 +92,13 @@
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off"
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"disallowTypeAnnotations": false
}
]
}
},
{

View file

@ -1,4 +1,5 @@
import {app, Menu, BrowserWindow} from 'electron';
import type {BrowserWindow} from 'electron';
import {app, Menu} from 'electron';
import {openConfig, getConfig} from './config';
import {updatePlugins} from './plugins';
import {installCLI} from './utils/cli-install';

View file

@ -4,7 +4,7 @@ import {_import, getDefaultConfig} from './config/import';
import _openConfig from './config/open';
import {cfgPath, cfgDir} from './config/paths';
import {getColorMap} from './utils/colors';
import {parsedConfig, configOptions} from '../lib/config';
import type {parsedConfig, configOptions} from '../lib/config';
import {app} from 'electron';
const watchers: Function[] = [];

View file

@ -2,7 +2,7 @@ import {readFileSync, mkdirpSync} from 'fs-extra';
import {defaultCfg, cfgPath, plugs, defaultPlatformKeyPath} from './paths';
import {_init} from './init';
import notify from '../notify';
import {rawConfig} from '../../lib/config';
import type {rawConfig} from '../../lib/config';
import {migrateHyper3Config} from './migrate';
let defaultConfig: rawConfig;

View file

@ -1,7 +1,7 @@
import vm from 'vm';
import notify from '../notify';
import mapKeys from '../utils/map-keys';
import {parsedConfig, rawConfig, configOptions} from '../../lib/config';
import type {parsedConfig, rawConfig, configOptions} from '../../lib/config';
import _ from 'lodash';
const _extract = (script?: vm.Script): Record<string, any> => {

View file

@ -1,5 +1,5 @@
import Config from 'electron-store';
import {BrowserWindow} from 'electron';
import type {BrowserWindow} from 'electron';
export const defaults = {
windowPosition: [50, 50] as [number, number],

View file

@ -1,5 +1,6 @@
// Packages
import {app, dialog, Menu, BrowserWindow} from 'electron';
import type {BrowserWindow} from 'electron';
import {app, dialog, Menu} from 'electron';
// Utilities
import {getConfig} from '../config';

View file

@ -1,6 +1,7 @@
// This menu label is overrided by OSX to be the appName
// The label is set to appName here so it matches actual behavior
import {app, BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import {app} from 'electron';
export default (
commandKeys: Record<string, string>,

View file

@ -1,4 +1,4 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commandKeys: Record<string, string>,

View file

@ -1,5 +1,6 @@
import {release} from 'os';
import {app, shell, MenuItemConstructorOptions, dialog, clipboard} from 'electron';
import type {MenuItemConstructorOptions} from 'electron';
import {app, shell, dialog, clipboard} from 'electron';
import {getConfig, getPlugins} from '../../config';
const {arch, env, platform, versions} = process;
import {version} from '../../package.json';

View file

@ -1,4 +1,4 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commandKeys: Record<string, string>,

View file

@ -1,4 +1,4 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commands: Record<string, string>,

View file

@ -1,4 +1,4 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commandKeys: Record<string, string>,

View file

@ -1,4 +1,4 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commandKeys: Record<string, string>,

View file

@ -1,7 +1,7 @@
import ms from 'ms';
import fetch from 'electron-fetch';
import {version} from './package.json';
import {BrowserWindow} from 'electron';
import type {BrowserWindow} from 'electron';
const NEWS_URL = 'https://hyper-news.now.sh';

View file

@ -1,7 +1,8 @@
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import {app, dialog, BrowserWindow, App, ipcMain as _ipcMain, MenuItemConstructorOptions} from 'electron';
import type {BrowserWindow, App, MenuItemConstructorOptions} from 'electron';
import {app, dialog, ipcMain as _ipcMain} from 'electron';
import {resolve, basename} from 'path';
import {writeFileSync} from 'fs';
import Config from 'electron-store';
@ -14,10 +15,10 @@ import {availableExtensions} from './plugins/extensions';
import {install} from './plugins/install';
import {plugs} from './config/paths';
import mapKeys from './utils/map-keys';
import {configOptions} from '../lib/config';
import type {configOptions} from '../lib/config';
import {promisify} from 'util';
import {exec, execFile} from 'child_process';
import {IpcMainWithCommands} from '../common';
import type {IpcMainWithCommands} from '../common';
// local storage
const cache = new Config();

View file

@ -1,7 +1,8 @@
import {EventEmitter} from 'events';
import {ipcMain, BrowserWindow, IpcMainEvent} from 'electron';
import type {BrowserWindow, IpcMainEvent} from 'electron';
import {ipcMain} from 'electron';
import {v4 as uuidv4} from 'uuid';
import {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../common';
import type {TypedEmitter, MainEvents, RendererEvents, FilterNever} from '../common';
export class Server {
emitter: TypedEmitter<MainEvents>;

View file

@ -4,7 +4,7 @@ import defaultShell from 'default-shell';
import {getDecoratedEnv} from './plugins';
import {productName, version} from './package.json';
import * as config from './config';
import {IPty, IWindowsPtyForkOptions, spawn as npSpawn} from 'node-pty';
import type {IPty, IWindowsPtyForkOptions, spawn as npSpawn} from 'node-pty';
import {cliScriptPath} from './config/paths';
import {dirname} from 'path';
import shellEnv from 'shell-env';

View file

@ -2,7 +2,7 @@ import editMenu from '../menus/menus/edit';
import shellMenu from '../menus/menus/shell';
import {execCommand} from '../commands';
import {getDecoratedKeymaps} from '../plugins';
import {MenuItemConstructorOptions, BrowserWindow} from 'electron';
import type {MenuItemConstructorOptions, BrowserWindow} from 'electron';
const separator: MenuItemConstructorOptions = {type: 'separator'};
const getCommandKeys = (keymaps: Record<string, string[]>): Record<string, string> =>

View file

@ -1,4 +1,5 @@
import {app, BrowserWindow, shell, Menu, BrowserWindowConstructorOptions} from 'electron';
import type {BrowserWindowConstructorOptions} from 'electron';
import {app, BrowserWindow, shell, Menu} from 'electron';
import {isAbsolute, normalize, sep} from 'path';
import {URL, fileURLToPath} from 'url';
import {v4 as uuidv4} from 'uuid';
@ -15,7 +16,7 @@ import {execCommand} from '../commands';
import {setRendererType, unsetRendererType} from '../utils/renderer-utils';
import {decorateSessionOptions, decorateSessionClass} from '../plugins';
import {enable as remoteEnable} from '@electron/remote/main';
import {configOptions} from '../../lib/config';
import type {configOptions} from '../../lib/config';
import {getWorkingDirectoryFromPID} from 'native-process-working-directory';
import {existsSync} from 'fs';

View file

@ -1,5 +1,6 @@
// Packages
import electron, {app, BrowserWindow, AutoUpdater} from 'electron';
import type {BrowserWindow, AutoUpdater} from 'electron';
import electron, {app} from 'electron';
import ms from 'ms';
import retry from 'async-retry';

View file

@ -1,6 +1,7 @@
// This is a CLI tool, using console is OK
/* eslint no-console: 0 */
import {spawn, exec, SpawnOptions} from 'child_process';
import type {SpawnOptions} from 'child_process';
import {spawn, exec} from 'child_process';
import {isAbsolute, resolve} from 'path';
import {existsSync} from 'fs';
import {version} from '../app/package.json';

View file

@ -1,6 +1,6 @@
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config';
import {HyperActions} from '../hyper';
import {configOptions} from '../config';
import type {HyperActions} from '../hyper';
import type {configOptions} from '../config';
export function loadConfig(config: configOptions): HyperActions {
return {

View file

@ -8,7 +8,7 @@ import {
} from '../constants/ui';
import rpc from '../rpc';
import {userExitTermGroup, setActiveGroup} from './term-groups';
import {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../hyper';
export function closeTab(uid: string) {
return (dispatch: HyperDispatch) => {

View file

@ -1,6 +1,6 @@
import rpc from '../rpc';
import {INIT} from '../constants';
import {HyperDispatch} from '../hyper';
import type {HyperDispatch} from '../hyper';
export default function init() {
return (dispatch: HyperDispatch) => {

View file

@ -1,5 +1,5 @@
import {NOTIFICATION_MESSAGE, NOTIFICATION_DISMISS} from '../constants/notifications';
import {HyperActions} from '../hyper';
import type {HyperActions} from '../hyper';
export function dismissNotification(id: string): HyperActions {
return {

View file

@ -15,7 +15,7 @@ import {
SESSION_SET_XTERM_TITLE,
SESSION_SEARCH
} from '../constants/sessions';
import {HyperState, session, HyperDispatch, HyperActions} from '../hyper';
import type {HyperState, session, HyperDispatch, HyperActions} from '../hyper';
export function addSession({
uid,

View file

@ -10,7 +10,7 @@ import {SESSION_REQUEST} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {getRootGroups} from '../selectors';
import {setActiveSession, ptyExitSession, userExitSession} from './sessions';
import {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../hyper';
import type {ITermState, ITermGroup, HyperState, HyperDispatch, HyperActions} from '../hyper';
function requestSplit(direction: 'VERTICAL' | 'HORIZONTAL') {
return (activeUid: string | undefined) =>

View file

@ -27,9 +27,10 @@ import {
} from '../constants/ui';
import {setActiveGroup} from './term-groups';
import parseUrl from 'parse-url';
import {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../hyper';
import {stat, Stats} from 'fs';
import type parseUrl from 'parse-url';
import type {HyperState, HyperDispatch, HyperActions, ITermGroups} from '../hyper';
import type {Stats} from 'fs';
import {stat} from 'fs';
export function openContextMenu(uid: string, selection: string) {
return (dispatch: HyperDispatch, getState: () => HyperState) => {

View file

@ -1,6 +1,6 @@
import {UPDATE_INSTALL, UPDATE_AVAILABLE} from '../constants/updater';
import rpc from '../rpc';
import {HyperActions} from '../hyper';
import type {HyperActions} from '../hyper';
export function installUpdate(): HyperActions {
return {

View file

@ -1,5 +1,5 @@
import {require as remoteRequire} from '@electron/remote';
import {HyperDispatch} from './hyper';
import type {HyperDispatch} from './hyper';
import {closeSearch} from './actions/sessions';
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31

View file

@ -3,7 +3,7 @@ import React from 'react';
import {decorate, getTabsProps} from '../utils/plugins';
import Tabs_ from './tabs';
import {HeaderProps} from '../hyper';
import type {HeaderProps} from '../hyper';
const Tabs = decorate(Tabs_, 'Tabs');

View file

@ -1,5 +1,5 @@
import React from 'react';
import {NotificationProps, NotificationState} from '../hyper';
import type {NotificationProps, NotificationState} from '../hyper';
export default class Notification extends React.PureComponent<NotificationProps, NotificationState> {
dismissTimer!: NodeJS.Timeout;

View file

@ -3,7 +3,7 @@ import React from 'react';
import {decorate} from '../utils/plugins';
import Notification_ from './notification';
import {NotificationsProps} from '../hyper';
import type {NotificationsProps} from '../hyper';
const Notification = decorate(Notification_, 'Notification');

View file

@ -1,5 +1,5 @@
import React, {useCallback} from 'react';
import {SearchBoxProps} from '../hyper';
import type {SearchBoxProps} from '../hyper';
import {VscArrowUp} from '@react-icons/all-files/vsc/VscArrowUp';
import {VscArrowDown} from '@react-icons/all-files/vsc/VscArrowDown';
import {VscClose} from '@react-icons/all-files/vsc/VscClose';

View file

@ -1,6 +1,6 @@
import React from 'react';
import _ from 'lodash';
import {SplitPaneProps} from '../hyper';
import type {SplitPaneProps} from '../hyper';
export default class SplitPane extends React.PureComponent<SplitPaneProps, {dragging: boolean}> {
dragPanePosition!: number;

View file

@ -1,5 +1,5 @@
import React from 'react';
import {StyleSheetProps} from '../hyper';
import type {StyleSheetProps} from '../hyper';
export default class StyleSheet extends React.PureComponent<StyleSheetProps> {
render() {

View file

@ -1,5 +1,5 @@
import React from 'react';
import {TabProps} from '../hyper';
import type {TabProps} from '../hyper';
export default class Tab extends React.PureComponent<TabProps> {
constructor(props: TabProps) {

View file

@ -3,7 +3,7 @@ import React from 'react';
import {decorate, getTabProps} from '../utils/plugins';
import Tab_ from './tab';
import {TabsProps} from '../hyper';
import type {TabsProps} from '../hyper';
const Tab = decorate(Tab_, 'Tab');
const isMac = /Mac/.test(navigator.userAgent);

View file

@ -4,7 +4,7 @@ import {decorate, getTermProps, getTermGroupProps} from '../utils/plugins';
import {resizeTermGroup} from '../actions/term-groups';
import Term_ from './term';
import SplitPane_ from './split-pane';
import {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../hyper';
import type {HyperState, HyperDispatch, TermGroupProps, TermGroupOwnProps} from '../hyper';
const Term = decorate(Term_, 'Term');
const SplitPane = decorate(SplitPane_, 'SplitPane');

View file

@ -1,8 +1,10 @@
import React from 'react';
import {Terminal, ITerminalOptions, IDisposable} from 'xterm';
import type {ITerminalOptions, IDisposable} from 'xterm';
import {Terminal} from 'xterm';
import {FitAddon} from 'xterm-addon-fit';
import {WebLinksAddon} from 'xterm-addon-web-links';
import {SearchAddon, ISearchDecorationOptions} from 'xterm-addon-search';
import type {ISearchDecorationOptions} from 'xterm-addon-search';
import {SearchAddon} from 'xterm-addon-search';
import {WebglAddon} from 'xterm-addon-webgl';
import {CanvasAddon} from 'xterm-addon-canvas';
import {LigaturesAddon} from 'xterm-addon-ligatures';
@ -12,7 +14,7 @@ import Color from 'color';
import terms from '../terms';
import processClipboard from '../utils/paste';
import _SearchBox from './searchBox';
import {TermProps} from '../hyper';
import type {TermProps} from '../hyper';
import {pickBy, isEqual} from 'lodash';
import {decorate} from '../utils/plugins';
import 'xterm/css/xterm.css';

View file

@ -3,8 +3,8 @@ import {decorate, getTermGroupProps} from '../utils/plugins';
import {registerCommandHandlers} from '../command-registry';
import TermGroup_ from './term-group';
import StyleSheet_ from './style-sheet';
import {TermsProps, HyperDispatch} from '../hyper';
import Term from './term';
import type {TermsProps, HyperDispatch} from '../hyper';
import type Term from './term';
import {ObjectTypedKeys} from '../utils/object';
const TermGroup = decorate(TermGroup_, 'TermGroup');

2
lib/config.d.ts vendored
View file

@ -1,4 +1,4 @@
import {FontWeight} from 'xterm';
import type {FontWeight} from 'xterm';
export type ColorMap = {
black: string;

View file

@ -1,4 +1,4 @@
import {configOptions} from '../config';
import type {configOptions} from '../config';
export const CONFIG_LOAD = 'CONFIG_LOAD';
export const CONFIG_RELOAD = 'CONFIG_RELOAD';

View file

@ -4,7 +4,7 @@ import Header from '../components/header';
import {closeTab, changeTab, maximize, openHamburgerMenu, unmaximize, minimize, close} from '../actions/header';
import {connect} from '../utils/plugins';
import {getRootGroups} from '../selectors';
import {HyperState, HyperDispatch, ITab} from '../hyper';
import type {HyperState, HyperDispatch, ITab} from '../hyper';
const isMac = /Mac/.test(navigator.userAgent);

View file

@ -1,5 +1,6 @@
import React from 'react';
import Mousetrap, {MousetrapInstance} from 'mousetrap';
import type {MousetrapInstance} from 'mousetrap';
import Mousetrap from 'mousetrap';
import {connect} from '../utils/plugins';
import * as uiActions from '../actions/ui';
@ -9,8 +10,8 @@ import stylis from 'stylis';
import {HeaderContainer} from './header';
import TermsContainer from './terms';
import NotificationsContainer from './notifications';
import {HyperState, HyperProps, HyperDispatch} from '../hyper';
import Terms from '../components/terms';
import type {HyperState, HyperProps, HyperDispatch} from '../hyper';
import type Terms from '../components/terms';
const isMac = /Mac/.test(navigator.userAgent);

View file

@ -2,7 +2,7 @@ import Notifications from '../components/notifications';
import {installUpdate} from '../actions/updater';
import {connect} from '../utils/plugins';
import {dismissNotification} from '../actions/notifications';
import {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../hyper';
const mapStateToProps = (state: HyperState) => {
const {ui} = state;

View file

@ -11,7 +11,7 @@ import {
import {openContextMenu} from '../actions/ui';
import {getRootGroups} from '../selectors';
import {HyperState, HyperDispatch} from '../hyper';
import type {HyperState, HyperDispatch} from '../hyper';
const mapStateToProps = (state: HyperState) => {
const {sessions} = state.sessions;

48
lib/hyper.d.ts vendored
View file

@ -1,5 +1,5 @@
import {Immutable} from 'seamless-immutable';
import Client from './utils/rpc';
import type {Immutable} from 'seamless-immutable';
import type Client from './utils/rpc';
declare global {
interface Window {
@ -38,8 +38,8 @@ export type ITermState = Immutable<{
}>;
export type cursorShapes = 'BEAM' | 'UNDERLINE' | 'BLOCK';
import {FontWeight, IWindowsPty, Terminal} from 'xterm';
import {ColorMap} from './config';
import type {FontWeight, IWindowsPty, Terminal} from 'xterm';
import type {ColorMap} from './config';
export type uiState = Immutable<{
_lastUpdate: number | null;
@ -133,7 +133,7 @@ export type IUiReducer = Reducer<uiState, HyperActions>;
export type ISessionReducer = Reducer<sessionState, HyperActions>;
import {Middleware, Reducer} from 'redux';
import type {Middleware, Reducer} from 'redux';
export type hyperPlugin = {
getTabProps: any;
getTabsProps: any;
@ -163,14 +163,14 @@ export type HyperState = {
termGroups: ITermState;
};
import {UIActions} from './constants/ui';
import {ConfigActions} from './constants/config';
import {SessionActions} from './constants/sessions';
import {NotificationActions} from './constants/notifications';
import {UpdateActions} from './constants/updater';
import {TermGroupActions} from './constants/term-groups';
import {InitActions} from './constants';
import {TabActions} from './constants/tabs';
import type {UIActions} from './constants/ui';
import type {ConfigActions} from './constants/config';
import type {SessionActions} from './constants/sessions';
import type {NotificationActions} from './constants/notifications';
import type {UpdateActions} from './constants/updater';
import type {TermGroupActions} from './constants/term-groups';
import type {InitActions} from './constants';
import type {TabActions} from './constants/tabs';
export type HyperActions = (
| UIActions
@ -183,10 +183,10 @@ export type HyperActions = (
| TabActions
) & {effect?: () => void};
import configureStore from './store/configure-store';
import type configureStore from './store/configure-store';
export type HyperDispatch = ReturnType<typeof configureStore>['dispatch'];
import {ReactChild} from 'react';
import type {ReactChild} from 'react';
type extensionProps = Partial<{
customChildren: ReactChild | ReactChild[];
customChildrenBefore: ReactChild | ReactChild[];
@ -194,17 +194,17 @@ type extensionProps = Partial<{
customInnerChildren: ReactChild | ReactChild[];
}>;
import {HeaderConnectedProps} from './containers/header';
import type {HeaderConnectedProps} from './containers/header';
export type HeaderProps = HeaderConnectedProps & extensionProps;
import {HyperConnectedProps} from './containers/hyper';
import type {HyperConnectedProps} from './containers/hyper';
export type HyperProps = HyperConnectedProps & extensionProps;
import {NotificationsConnectedProps} from './containers/notifications';
import type {NotificationsConnectedProps} from './containers/notifications';
export type NotificationsProps = NotificationsConnectedProps & extensionProps;
import Terms from './components/terms';
import {TermsConnectedProps} from './containers/terms';
import type Terms from './components/terms';
import type {TermsConnectedProps} from './containers/terms';
export type TermsProps = TermsConnectedProps & extensionProps & {ref_: (terms: Terms | null) => void};
export type StyleSheetProps = {
@ -262,7 +262,7 @@ export type SplitPaneProps = {
sizes?: Immutable<number[]> | null;
};
import Term from './components/term';
import type Term from './components/term';
export type TermGroupOwnProps = {
cursorAccentColor?: string;
@ -314,7 +314,7 @@ export type TermGroupOwnProps = {
| 'imageSupport'
>;
import {TermGroupConnectedProps} from './components/term-group';
import type {TermGroupConnectedProps} from './components/term-group';
export type TermGroupProps = TermGroupConnectedProps & TermGroupOwnProps;
export type SearchBoxProps = {
@ -335,8 +335,8 @@ export type SearchBoxProps = {
font: string;
};
import {FitAddon} from 'xterm-addon-fit';
import {SearchAddon} from 'xterm-addon-search';
import type {FitAddon} from 'xterm-addon-fit';
import type {SearchAddon} from 'xterm-addon-search';
export type TermProps = {
backgroundColor: string;
bell: string;

View file

@ -18,7 +18,7 @@ import {addNotificationMessage} from './actions/notifications';
import {loadConfig, reloadConfig} from './actions/config';
import HyperContainer from './containers/hyper';
import configureStore from './store/configure-store';
import {configOptions} from './config';
import type {configOptions} from './config';
// On Linux, the default zoom was somehow changed with Electron 3 (or maybe 2).
// Setting zoom factor to 1.2 brings back the normal default size

View file

@ -1,8 +1,9 @@
import {combineReducers, Reducer} from 'redux';
import type {Reducer} from 'redux';
import {combineReducers} from 'redux';
import ui from './ui';
import sessions from './sessions';
import termGroups from './term-groups';
import {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../hyper';
export default combineReducers({
ui,

View file

@ -12,7 +12,7 @@ import {
SESSION_SET_CWD,
SESSION_SEARCH
} from '../constants/sessions';
import {sessionState, session, Mutable, ISessionReducer} from '../hyper';
import type {sessionState, session, Mutable, ISessionReducer} from '../hyper';
const initialState: sessionState = Immutable<Mutable<sessionState>>({
sessions: {},

View file

@ -1,10 +1,12 @@
import {v4 as uuidv4} from 'uuid';
import Immutable, {Immutable as ImmutableType} from 'seamless-immutable';
import type {Immutable as ImmutableType} from 'seamless-immutable';
import Immutable from 'seamless-immutable';
import {TERM_GROUP_EXIT, TERM_GROUP_RESIZE} from '../constants/term-groups';
import {SESSION_ADD, SESSION_SET_ACTIVE, SessionAddAction} from '../constants/sessions';
import type {SessionAddAction} from '../constants/sessions';
import {SESSION_ADD, SESSION_SET_ACTIVE} from '../constants/sessions';
import findBySession from '../utils/term-groups';
import {decorateTermGroupsReducer} from '../utils/plugins';
import {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../hyper';
import type {ITermGroup, ITermState, ITermGroups, ITermGroupReducer, Mutable} from '../hyper';
const MIN_SIZE = 0.05;
const initialState: ITermState = Immutable<Mutable<ITermState>>({

View file

@ -1,4 +1,5 @@
import Immutable, {Immutable as ImmutableType} from 'seamless-immutable';
import type {Immutable as ImmutableType} from 'seamless-immutable';
import Immutable from 'seamless-immutable';
import {decorateUIReducer} from '../utils/plugins';
import {CONFIG_LOAD, CONFIG_RELOAD} from '../constants/config';
import {
@ -21,7 +22,7 @@ import {
SESSION_SET_CWD
} from '../constants/sessions';
import {UPDATE_AVAILABLE} from '../constants/updater';
import {uiState, Mutable, IUiReducer} from '../hyper';
import type {uiState, Mutable, IUiReducer} from '../hyper';
import {release} from 'os';
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(navigator.platform) || process.platform === 'win32';

View file

@ -1,5 +1,5 @@
import {createSelector} from 'reselect';
import {HyperState} from './hyper';
import type {HyperState} from './hyper';
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>

View file

@ -1,11 +1,12 @@
import {createStore, applyMiddleware} from 'redux';
import _thunk, {ThunkMiddleware} from 'redux-thunk';
import type {ThunkMiddleware} from 'redux-thunk';
import _thunk from 'redux-thunk';
import rootReducer from '../reducers/index';
import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import {composeWithDevTools} from 'redux-devtools-extension';
import {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () => {

View file

@ -1,10 +1,11 @@
import {createStore, applyMiddleware} from 'redux';
import _thunk, {ThunkMiddleware} from 'redux-thunk';
import type {ThunkMiddleware} from 'redux-thunk';
import _thunk from 'redux-thunk';
import rootReducer from '../reducers/index';
import effects from '../utils/effects';
import * as plugins from '../utils/plugins';
import writeMiddleware from './write-middleware';
import {HyperState, HyperActions} from '../hyper';
import type {HyperState, HyperActions} from '../hyper';
const thunk: ThunkMiddleware<HyperState, HyperActions> = _thunk;
export default () =>

View file

@ -1,6 +1,6 @@
import {HyperActions, HyperState} from '../hyper';
import type {HyperActions, HyperState} from '../hyper';
import terms from '../terms';
import {Dispatch, Middleware} from 'redux';
import type {Dispatch, Middleware} from 'redux';
// the only side effect we perform from middleware
// is to write to the react term instance directly

View file

@ -1,4 +1,4 @@
import Term from './components/term';
import type Term from './components/term';
// react Term components add themselves
// to this object upon mounting / unmounting

View file

@ -1,5 +1,5 @@
import {Dispatch, Middleware} from 'redux';
import {HyperActions, HyperState} from '../hyper';
import type {Dispatch, Middleware} from 'redux';
import type {HyperActions, HyperState} from '../hyper';
/**
* Simple redux middleware that executes
* the `effect` field if provided in an action

View file

@ -10,7 +10,8 @@
* PR: https://github.com/kevva/executable/pull/10
*/
import fs, {Stats} from 'fs';
import type {Stats} from 'fs';
import fs from 'fs';
export function isExecutable(fileStat: Stats): boolean {
if (process.platform === 'win32') {

View file

@ -3,17 +3,19 @@
import {require as remoteRequire} from '@electron/remote';
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
import {connect as reduxConnect, Options} from 'react-redux';
import type {Options} from 'react-redux';
import {connect as reduxConnect} from 'react-redux';
import {basename} from 'path';
// patching Module._load
// so plugins can `require` them without needing their own version
// https://github.com/vercel/hyper/issues/619
import React, {ComponentType, PureComponent} from 'react';
import type {ComponentType} from 'react';
import React, {PureComponent} from 'react';
import ReactDOM from 'react-dom';
import Notification from '../components/notification';
import notify from './notify';
import {
import type {
hyperPlugin,
IUiReducer,
ISessionReducer,
@ -27,7 +29,7 @@ import {
Assignable,
HyperActions
} from '../hyper';
import {Dispatch, Middleware} from 'redux';
import type {Dispatch, Middleware} from 'redux';
import {ObjectTypedKeys} from './object';
import IPCChildProcess from './ipc-child-process';
import ChildProcess from 'child_process';

View file

@ -1,7 +1,7 @@
import {EventEmitter} from 'events';
import {IpcRenderer, IpcRendererEvent} from 'electron';
import type {IpcRenderer, IpcRendererEvent} from 'electron';
import electron from 'electron';
import {FilterNever, MainEvents, RendererEvents, TypedEmitter} from '../../common';
import type {FilterNever, MainEvents, RendererEvents, TypedEmitter} from '../../common';
export default class Client {
emitter: TypedEmitter<RendererEvents>;

View file

@ -1,4 +1,4 @@
import {ITermState} from '../hyper';
import type {ITermState} from '../hyper';
export default function findBySession(termGroupState: ITermState, sessionUid: string) {
const {termGroups} = termGroupState;

View file

@ -4,7 +4,8 @@ import fs from 'fs-extra';
// Packages
import test from 'ava';
import {_electron, ElectronApplication} from 'playwright';
import type {ElectronApplication} from 'playwright';
import {_electron} from 'playwright';
let app: ElectronApplication;