mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
fix prettier errors
This commit is contained in:
parent
d2d31e346a
commit
41b1ac1852
39 changed files with 150 additions and 153 deletions
|
|
@ -8,41 +8,41 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
// If window is created on the same tick, it will consume event too
|
||||
setTimeout(app.createWindow, 0);
|
||||
},
|
||||
'tab:new': focusedWindow => {
|
||||
'tab:new': (focusedWindow) => {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.rpc.emit('termgroup add req', {});
|
||||
} else {
|
||||
setTimeout(app.createWindow, 0);
|
||||
}
|
||||
},
|
||||
'pane:splitRight': focusedWindow => {
|
||||
'pane:splitRight': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('split request vertical', {});
|
||||
},
|
||||
'pane:splitDown': focusedWindow => {
|
||||
'pane:splitDown': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('split request horizontal', {});
|
||||
},
|
||||
'pane:close': focusedWindow => {
|
||||
'pane:close': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('termgroup close req');
|
||||
},
|
||||
'window:preferences': () => {
|
||||
openConfig();
|
||||
},
|
||||
'editor:clearBuffer': focusedWindow => {
|
||||
'editor:clearBuffer': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session clear req');
|
||||
},
|
||||
'editor:selectAll': focusedWindow => {
|
||||
'editor:selectAll': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('term selectAll');
|
||||
},
|
||||
'plugins:update': () => {
|
||||
updatePlugins();
|
||||
},
|
||||
'window:reload': focusedWindow => {
|
||||
'window:reload': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('reload');
|
||||
},
|
||||
'window:reloadFull': focusedWindow => {
|
||||
'window:reloadFull': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.reload();
|
||||
},
|
||||
'window:devtools': focusedWindow => {
|
||||
'window:devtools': (focusedWindow) => {
|
||||
if (!focusedWindow) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -53,58 +53,58 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
webContents.openDevTools({mode: 'detach'});
|
||||
}
|
||||
},
|
||||
'zoom:reset': focusedWindow => {
|
||||
'zoom:reset': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
||||
},
|
||||
'zoom:in': focusedWindow => {
|
||||
'zoom:in': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('increase fontSize req');
|
||||
},
|
||||
'zoom:out': focusedWindow => {
|
||||
'zoom:out': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('decrease fontSize req');
|
||||
},
|
||||
'tab:prev': focusedWindow => {
|
||||
'tab:prev': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move left req');
|
||||
},
|
||||
'tab:next': focusedWindow => {
|
||||
'tab:next': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move right req');
|
||||
},
|
||||
'pane:prev': focusedWindow => {
|
||||
'pane:prev': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('prev pane req');
|
||||
},
|
||||
'pane:next': focusedWindow => {
|
||||
'pane:next': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('next pane req');
|
||||
},
|
||||
'editor:movePreviousWord': focusedWindow => {
|
||||
'editor:movePreviousWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word left req');
|
||||
},
|
||||
'editor:moveNextWord': focusedWindow => {
|
||||
'editor:moveNextWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move word right req');
|
||||
},
|
||||
'editor:moveBeginningLine': focusedWindow => {
|
||||
'editor:moveBeginningLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line beginning req');
|
||||
},
|
||||
'editor:moveEndLine': focusedWindow => {
|
||||
'editor:moveEndLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session move line end req');
|
||||
},
|
||||
'editor:deletePreviousWord': focusedWindow => {
|
||||
'editor:deletePreviousWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word left req');
|
||||
},
|
||||
'editor:deleteNextWord': focusedWindow => {
|
||||
'editor:deleteNextWord': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del word right req');
|
||||
},
|
||||
'editor:deleteBeginningLine': focusedWindow => {
|
||||
'editor:deleteBeginningLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line beginning req');
|
||||
},
|
||||
'editor:deleteEndLine': focusedWindow => {
|
||||
'editor:deleteEndLine': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session del line end req');
|
||||
},
|
||||
'editor:break': focusedWindow => {
|
||||
'editor:break': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session break req');
|
||||
},
|
||||
'editor:search': focusedWindow => {
|
||||
'editor:search': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session search');
|
||||
},
|
||||
'editor:search-close': focusedWindow => {
|
||||
'editor:search-close': (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('session search close');
|
||||
},
|
||||
'cli:install': () => {
|
||||
|
|
@ -118,9 +118,9 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
|
|||
};
|
||||
|
||||
//Special numeric command
|
||||
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach(cmdIndex => {
|
||||
([1, 2, 3, 4, 5, 6, 7, 8, 'last'] as const).forEach((cmdIndex) => {
|
||||
const index = cmdIndex === 'last' ? cmdIndex : cmdIndex - 1;
|
||||
commands[`tab:jump:${cmdIndex}`] = focusedWindow => {
|
||||
commands[`tab:jump:${cmdIndex}`] = (focusedWindow) => {
|
||||
focusedWindow && focusedWindow.rpc.emit('move jump req', index);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ let _watcher: fs.FSWatcher;
|
|||
export const getDeprecatedCSS = (config: Record<string, any>) => {
|
||||
const deprecated: string[] = [];
|
||||
const deprecatedCSS = ['x-screen', 'x-row', 'cursor-node', '::selection'];
|
||||
deprecatedCSS.forEach(css => {
|
||||
deprecatedCSS.forEach((css) => {
|
||||
if ((config.css && config.css.includes(css)) || (config.termCSS && config.termCSS.includes(css))) {
|
||||
deprecated.push(css);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ const _watch = () => {
|
|||
setTimeout(() => {
|
||||
cfg = _import();
|
||||
notify('Configuration updated', 'Hyper configuration reloaded!');
|
||||
watchers.forEach(fn => fn());
|
||||
watchers.forEach((fn) => fn());
|
||||
checkDeprecatedConfig();
|
||||
}, 100);
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ const _watch = () => {
|
|||
// macOS/Linux
|
||||
function setWatcher() {
|
||||
try {
|
||||
_watcher = fs.watch(cfgPath, eventType => {
|
||||
_watcher = fs.watch(cfgPath, (eventType) => {
|
||||
if (eventType === 'rename') {
|
||||
_watcher.close();
|
||||
// Ensure that new file has been written
|
||||
|
|
@ -76,7 +76,7 @@ const _watch = () => {
|
|||
return;
|
||||
}
|
||||
_watcher.on('change', onChange);
|
||||
_watcher.on('error', error => {
|
||||
_watcher.on('error', (error) => {
|
||||
console.error('error watching config', error);
|
||||
});
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ export const htermConfigTranslate = (config: Record<string, any>) => {
|
|||
'x-screen a([ {.[])': '.terminal a$1',
|
||||
'x-row a([ {.[])': '.terminal a$1'
|
||||
};
|
||||
Object.keys(cssReplacements).forEach(pattern => {
|
||||
Object.keys(cssReplacements).forEach((pattern) => {
|
||||
const searchvalue = new RegExp(pattern, 'g');
|
||||
const newvalue = cssReplacements[pattern];
|
||||
config.css = config.css && config.css.replace(searchvalue, newvalue);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default () => {
|
|||
Registry.closeKey(fileExtsKeys);
|
||||
|
||||
// Find UserChoice key
|
||||
const userChoice = keys.find(k => k.endsWith('UserChoice'));
|
||||
const userChoice = keys.find((k) => k.endsWith('UserChoice'));
|
||||
return userChoice
|
||||
? `Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.js\\${userChoice}`
|
||||
: userChoice;
|
||||
|
|
@ -44,13 +44,13 @@ export default () => {
|
|||
// Load key values
|
||||
const userChoiceKey = Registry.openKey(Registry.HKCU, userChoice, Registry.Access.READ)!;
|
||||
const values: string[] = Registry.enumValueNames(userChoiceKey).map(
|
||||
x => (Registry.queryValue(userChoiceKey, x) as string) || ''
|
||||
(x) => (Registry.queryValue(userChoiceKey, x) as string) || ''
|
||||
);
|
||||
Registry.closeKey(userChoiceKey);
|
||||
|
||||
// Look for default program
|
||||
const hasDefaultProgramConfigured = values.every(
|
||||
value => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
|
||||
(value) => value && typeof value === 'string' && !value.includes('WScript.exe') && !value.includes('JSFile')
|
||||
);
|
||||
|
||||
return hasDefaultProgramConfigured;
|
||||
|
|
@ -62,21 +62,21 @@ export default () => {
|
|||
|
||||
// This mimics shell.openItem, true if it worked, false if not.
|
||||
const openNotepad = (file: string) =>
|
||||
new Promise<boolean>(resolve => {
|
||||
exec(`start notepad.exe ${file}`, error => {
|
||||
new Promise<boolean>((resolve) => {
|
||||
exec(`start notepad.exe ${file}`, (error) => {
|
||||
resolve(!error);
|
||||
});
|
||||
});
|
||||
|
||||
return hasDefaultSet()
|
||||
.then(yes => {
|
||||
.then((yes) => {
|
||||
if (yes) {
|
||||
return shell.openItem(cfgPath);
|
||||
}
|
||||
console.warn('No default app set for .js files, using notepad.exe fallback');
|
||||
return openNotepad(cfgPath);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.error('Open config with default app error:', err);
|
||||
return openNotepad(cfgPath);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ function installDevExtensions(isDev_: boolean) {
|
|||
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const;
|
||||
const forceDownload = Boolean(process.env.UPGRADE_EXTENSIONS);
|
||||
|
||||
return Promise.all(extensions.map(name => installer.default(installer[name], forceDownload)));
|
||||
return Promise.all(extensions.map((name) => installer.default(installer[name], forceDownload)));
|
||||
}
|
||||
|
||||
app.on('ready', () =>
|
||||
|
|
@ -249,7 +249,7 @@ app.on('ready', () =>
|
|||
installCLI(false);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.error('Error while loading devtools extensions', err);
|
||||
})
|
||||
);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const createMenu = (
|
|||
const showAbout = () => {
|
||||
const loadedPlugins = getLoadedPluginVersions();
|
||||
const pluginList =
|
||||
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map(plugin => `\n ${plugin.name} (${plugin.version})`);
|
||||
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map((plugin) => `\n ${plugin.name} (${plugin.version})`);
|
||||
|
||||
const rendererCounts = Object.values(getRendererTypes()).reduce((acc: Record<string, number>, type) => {
|
||||
acc[type] = acc[type] ? acc[type] + 1 : 1;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ export default function fetchNotifications(win: BrowserWindow) {
|
|||
'X-Hyper-Platform': process.platform
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
const {message} = data || {};
|
||||
if (typeof message !== 'object' && message !== '') {
|
||||
throw new Error('Bad response');
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ function patchModuleLoad() {
|
|||
}
|
||||
|
||||
function checkDeprecatedExtendKeymaps() {
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (plugin.extendKeymaps) {
|
||||
notify('Plugin warning!', `"${plugin._name}" use deprecated "extendKeymaps" handler`);
|
||||
return;
|
||||
|
|
@ -124,7 +124,7 @@ function updatePlugins({force = false} = {}) {
|
|||
cache.set('hyper.plugin-versions', pluginVersions);
|
||||
|
||||
// notify watchers
|
||||
watchers.forEach(fn => fn(err, {force}));
|
||||
watchers.forEach((fn) => fn(err, {force}));
|
||||
|
||||
if (force || changed) {
|
||||
if (changed) {
|
||||
|
|
@ -140,7 +140,7 @@ function updatePlugins({force = false} = {}) {
|
|||
|
||||
function getPluginVersions() {
|
||||
const paths_ = paths.plugins.concat(paths.localPlugins);
|
||||
return paths_.map(path_ => {
|
||||
return paths_.map((path_) => {
|
||||
let version = null;
|
||||
try {
|
||||
version = require(resolve(path_, 'package.json')).version;
|
||||
|
|
@ -152,7 +152,7 @@ function getPluginVersions() {
|
|||
|
||||
function clearCache() {
|
||||
// trigger unload hooks
|
||||
modules.forEach(mod => {
|
||||
modules.forEach((mod) => {
|
||||
if (mod.onUnload) {
|
||||
mod.onUnload(app);
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ function clearCache() {
|
|||
export {updatePlugins};
|
||||
|
||||
export const getLoadedPluginVersions = () => {
|
||||
return modules.map(mod => ({name: mod._name, version: mod._version}));
|
||||
return modules.map((mod) => ({name: mod._name, version: mod._version}));
|
||||
};
|
||||
|
||||
// we schedule the initial plugins update
|
||||
|
|
@ -224,7 +224,7 @@ function alert(message: string) {
|
|||
|
||||
function toDependencies(plugins_: {plugins: string[]}) {
|
||||
const obj: Record<string, string> = {};
|
||||
plugins_.plugins.forEach(plugin => {
|
||||
plugins_.plugins.forEach((plugin) => {
|
||||
const regex = /.(@|#)/;
|
||||
const match = regex.exec(plugin);
|
||||
|
||||
|
|
@ -251,10 +251,10 @@ export const subscribe = (fn: Function) => {
|
|||
|
||||
function getPaths() {
|
||||
return {
|
||||
plugins: plugins.plugins.map(name => {
|
||||
plugins: plugins.plugins.map((name) => {
|
||||
return resolve(path, 'node_modules', name.split('#')[0]);
|
||||
}),
|
||||
localPlugins: plugins.localPlugins.map(name => {
|
||||
localPlugins: plugins.localPlugins.map((name) => {
|
||||
return resolve(localPath, name);
|
||||
})
|
||||
};
|
||||
|
|
@ -275,7 +275,7 @@ function requirePlugins(): any[] {
|
|||
let mod: any;
|
||||
try {
|
||||
mod = require(path_);
|
||||
const exposed = mod && Object.keys(mod).some(key => availableExtensions.has(key));
|
||||
const exposed = mod && Object.keys(mod).some((key) => availableExtensions.has(key));
|
||||
if (!exposed) {
|
||||
notify('Plugin error!', `${`Plugin "${basename(path_)}" does not expose any `}Hyper extension API methods`);
|
||||
return;
|
||||
|
|
@ -303,11 +303,11 @@ function requirePlugins(): any[] {
|
|||
return plugins_
|
||||
.map(load)
|
||||
.concat(localPlugins.map(load))
|
||||
.filter(v => Boolean(v));
|
||||
.filter((v) => Boolean(v));
|
||||
}
|
||||
|
||||
export const onApp = (app_: App) => {
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (plugin.onApp) {
|
||||
try {
|
||||
plugin.onApp(app_);
|
||||
|
|
@ -321,7 +321,7 @@ export const onApp = (app_: App) => {
|
|||
};
|
||||
|
||||
export const onWindowClass = (win: BrowserWindow) => {
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (plugin.onWindowClass) {
|
||||
try {
|
||||
plugin.onWindowClass(win);
|
||||
|
|
@ -335,7 +335,7 @@ export const onWindowClass = (win: BrowserWindow) => {
|
|||
};
|
||||
|
||||
export const onWindow = (win: BrowserWindow) => {
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (plugin.onWindow) {
|
||||
try {
|
||||
plugin.onWindow(win);
|
||||
|
|
@ -352,7 +352,7 @@ export const onWindow = (win: BrowserWindow) => {
|
|||
// for all the available plugins
|
||||
function decorateEntity(base: any, key: string, type: 'object' | 'function') {
|
||||
let decorated = base;
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (plugin[key]) {
|
||||
let res;
|
||||
try {
|
||||
|
|
@ -383,7 +383,7 @@ function decorateClass(base: any, key: string) {
|
|||
export const getDeprecatedConfig = () => {
|
||||
const deprecated: Record<string, any> = {};
|
||||
const baseConfig = config.getConfig();
|
||||
modules.forEach(plugin => {
|
||||
modules.forEach((plugin) => {
|
||||
if (!plugin.decorateConfig) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const install = (fn: Function) => {
|
|||
NODE_ENV: 'production',
|
||||
ELECTRON_RUN_AS_NODE: 'true'
|
||||
};
|
||||
spawnQueue.push(end => {
|
||||
spawnQueue.push((end) => {
|
||||
const cmd = [process.execPath, yarn].concat(args).join(' ');
|
||||
console.log('Launching yarn:', cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,14 +146,14 @@ export default class Session extends EventEmitter {
|
|||
}
|
||||
|
||||
this.batcher = new DataBatcher(uid);
|
||||
this.pty.onData(chunk => {
|
||||
this.pty.onData((chunk) => {
|
||||
if (this.ended) {
|
||||
return;
|
||||
}
|
||||
this.batcher?.write(chunk as any);
|
||||
});
|
||||
|
||||
this.batcher.on('flush', data => {
|
||||
this.batcher.on('flush', (data) => {
|
||||
this.emit('data', data);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ export default (
|
|||
const _edit = editMenu(commandKeys, execCommand).submenu.filter(filterCutCopy.bind(null, selection));
|
||||
return _edit
|
||||
.concat(separator, _shell)
|
||||
.filter(menuItem => !Object.prototype.hasOwnProperty.call(menuItem, 'enabled') || menuItem.enabled);
|
||||
.filter((menuItem) => !Object.prototype.hasOwnProperty.call(menuItem, 'enabled') || menuItem.enabled);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ export function newWindow(
|
|||
function createSession(extraOptions: any = {}) {
|
||||
const uid = uuidv4();
|
||||
const extraOptionsFiltered: any = {};
|
||||
Object.keys(extraOptions).forEach(key => {
|
||||
Object.keys(extraOptions).forEach((key) => {
|
||||
if (extraOptions[key] !== undefined) extraOptionsFiltered[key] = extraOptions[key];
|
||||
});
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ export function newWindow(
|
|||
return {session, options};
|
||||
}
|
||||
|
||||
rpc.on('new', extraOptions => {
|
||||
rpc.on('new', (extraOptions) => {
|
||||
const {session, options} = createSession(extraOptions);
|
||||
|
||||
sessions.set(options.uid, session);
|
||||
|
|
@ -202,7 +202,7 @@ export function newWindow(
|
|||
rpc.on('open external', ({url}) => {
|
||||
shell.openExternal(url);
|
||||
});
|
||||
rpc.on('open context menu', selection => {
|
||||
rpc.on('open context menu', (selection) => {
|
||||
const {createWindow} = app;
|
||||
const {buildFromTemplate} = Menu;
|
||||
buildFromTemplate(contextMenuTemplate(createWindow, selection)).popup({window});
|
||||
|
|
@ -223,7 +223,7 @@ export function newWindow(
|
|||
rpc.on('close', () => {
|
||||
window.close();
|
||||
});
|
||||
rpc.on('command', command => {
|
||||
rpc.on('command', (command) => {
|
||||
const focusedWindow = BrowserWindow.getFocusedWindow();
|
||||
execCommand(command, focusedWindow!);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const buildFeedUrl = (canary: boolean, currentVersion: string) => {
|
|||
const isCanary = (updateChannel: string) => updateChannel === 'canary';
|
||||
|
||||
async function init() {
|
||||
autoUpdater.on('error', err => {
|
||||
autoUpdater.on('error', (err) => {
|
||||
console.error('Error fetching updates', `${err.message} (${err.stack})`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ const symlink = pify(fs.symlink);
|
|||
|
||||
const checkInstall = () => {
|
||||
return readlink(cliLinkPath)
|
||||
.then(link => link === cliScriptPath)
|
||||
.catch(err => {
|
||||
.then((link) => link === cliScriptPath)
|
||||
.catch((err) => {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ const checkInstall = () => {
|
|||
};
|
||||
|
||||
const addSymlink = () => {
|
||||
return checkInstall().then(isInstalled => {
|
||||
return checkInstall().then((isInstalled) => {
|
||||
if (isInstalled) {
|
||||
console.log('Hyper CLI already in PATH');
|
||||
return Promise.resolve();
|
||||
|
|
@ -50,7 +50,7 @@ const addBinToUserPath = () => {
|
|||
const basePath = path.resolve(binPath, '../../..');
|
||||
|
||||
const items = Registry.enumValueNames(envKey);
|
||||
const pathItem = items.find(item => item.toUpperCase() === 'PATH');
|
||||
const pathItem = items.find((item) => item.toUpperCase() === 'PATH');
|
||||
const pathItemName = pathItem || 'PATH';
|
||||
|
||||
let newPathValue = binPath;
|
||||
|
|
@ -72,7 +72,7 @@ const addBinToUserPath = () => {
|
|||
|
||||
// Because version is in path we need to remove old path if present and add current path
|
||||
newPathValue = pathParts
|
||||
.filter(pathPart => !pathPart.startsWith(basePath))
|
||||
.filter((pathPart) => !pathPart.startsWith(basePath))
|
||||
.concat([binPath])
|
||||
.join(';');
|
||||
}
|
||||
|
|
@ -101,13 +101,13 @@ export const installCLI = (withNotification: boolean) => {
|
|||
'You may need to restart your computer to complete this installation process.'
|
||||
)
|
||||
)
|
||||
.catch(err =>
|
||||
.catch((err) =>
|
||||
logNotify(withNotification, 'Hyper CLI installation failed', `Failed to add Hyper CLI path to user PATH ${err}`)
|
||||
);
|
||||
} else if (process.platform === 'darwin') {
|
||||
addSymlink()
|
||||
.then(() => logNotify(withNotification, 'Hyper CLI installed', `Symlink created at ${cliLinkPath}`))
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
// 'EINVAL' is returned by readlink,
|
||||
// 'EEXIST' is returned by symlink
|
||||
const error =
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const colorList = [
|
|||
|
||||
export const getColorMap: {
|
||||
<T>(colors: T): T extends (infer U)[] ? {[k: string]: U} : T;
|
||||
} = colors => {
|
||||
} = (colors) => {
|
||||
if (!Array.isArray(colors)) {
|
||||
return colors;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const generatePrefixedCommand = (command: string, shortcuts: string[]) => {
|
|||
for (let i = 1; i <= 9; i++) {
|
||||
// 9 is a special number because it means 'last'
|
||||
const index = i === 9 ? 'last' : i;
|
||||
const prefixedShortcuts = shortcuts.map(shortcut => `${shortcut}+${i}`);
|
||||
const prefixedShortcuts = shortcuts.map((shortcut) => `${shortcut}+${i}`);
|
||||
result[`${baseCmd}:${index}`] = prefixedShortcuts;
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ export default (config: Record<string, string[] | string>) => {
|
|||
const _shortcuts = config[command];
|
||||
const shortcuts = Array.isArray(_shortcuts) ? _shortcuts : [_shortcuts];
|
||||
const fixedShortcuts: string[] = [];
|
||||
shortcuts.forEach(shortcut => {
|
||||
shortcuts.forEach((shortcut) => {
|
||||
let newShortcut = shortcut;
|
||||
if (newShortcut.indexOf('cmd') !== -1) {
|
||||
// Mousetrap use `command` and not `cmd`
|
||||
|
|
|
|||
|
|
@ -13,8 +13,5 @@ export default (bgColor: string) => {
|
|||
|
||||
// http://stackoverflow.com/a/11019879/1202488
|
||||
const alphaHex = Math.round(color.alpha() * 255).toString(16);
|
||||
return `#${alphaHex}${color
|
||||
.hex()
|
||||
.toString()
|
||||
.substr(1)}`;
|
||||
return `#${alphaHex}${color.hex().toString().substr(1)}`;
|
||||
};
|
||||
|
|
|
|||
10
cli/api.ts
10
cli/api.ts
|
|
@ -54,7 +54,7 @@ const getFileContents = memoize(() => {
|
|||
|
||||
const getParsedFile = memoize(() => recast.parse(getFileContents()!));
|
||||
|
||||
const getProperties = memoize(() => ((getParsedFile()?.program?.body as any[]) || []).map(obj => obj));
|
||||
const getProperties = memoize(() => ((getParsedFile()?.program?.body as any[]) || []).map((obj) => obj));
|
||||
|
||||
const getPluginsByKey = (key: string) => {
|
||||
const properties = getProperties();
|
||||
|
|
@ -84,7 +84,7 @@ function exists() {
|
|||
function isInstalled(plugin: string, locally?: boolean) {
|
||||
const array = (locally ? getLocalPlugins() : getPlugins()) || [];
|
||||
if (array && Array.isArray(array)) {
|
||||
return array.some(entry => entry.value === plugin);
|
||||
return array.some((entry) => entry.value === plugin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ function existsOnNpm(plugin: string) {
|
|||
const name = getPackageName(plugin);
|
||||
return got
|
||||
.get<any>(registryUrl + name.toLowerCase(), {timeout: 10000, responseType: 'json'})
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
if (!res.body.versions) {
|
||||
return Promise.reject(res);
|
||||
} else {
|
||||
|
|
@ -142,7 +142,7 @@ function uninstall(plugin: string) {
|
|||
return Promise.reject(`${plugin} is not installed`);
|
||||
}
|
||||
|
||||
const index = getPlugins()!.findIndex(entry => entry.value === plugin);
|
||||
const index = getPlugins()!.findIndex((entry) => entry.value === plugin);
|
||||
getPlugins()!.splice(index, 1);
|
||||
return save();
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ function uninstall(plugin: string) {
|
|||
function list() {
|
||||
if (Array.isArray(getPlugins())) {
|
||||
return getPlugins()!
|
||||
.map(plugin => plugin.value)
|
||||
.map((plugin) => plugin.value)
|
||||
.join('\n');
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
30
cli/index.ts
30
cli/index.ts
|
|
@ -59,7 +59,7 @@ args.command(
|
|||
commandPromise = api
|
||||
.uninstall(pluginName)
|
||||
.then(() => console.log(chalk.green(`${pluginName} uninstalled successfully!`)))
|
||||
.catch(err => console.log(chalk.red(err)));
|
||||
.catch((err) => console.log(chalk.red(err)));
|
||||
},
|
||||
['u', 'rm', 'remove']
|
||||
);
|
||||
|
|
@ -85,16 +85,16 @@ const lsRemote = (pattern?: string) => {
|
|||
// note that no errors are catched by this function
|
||||
const URL = `https://api.npms.io/v2/search?q=${(pattern && `${pattern}+`) || ''}keywords:hyper-plugin,hyper-theme`;
|
||||
return got(URL)
|
||||
.then(response => JSON.parse(response.body).results as any[])
|
||||
.then(entries => entries.map(entry => entry.package))
|
||||
.then(entries => entries.filter(entry => entry.name.indexOf(PLUGIN_PREFIX) === 0))
|
||||
.then(entries =>
|
||||
.then((response) => JSON.parse(response.body).results as any[])
|
||||
.then((entries) => entries.map((entry) => entry.package))
|
||||
.then((entries) => entries.filter((entry) => entry.name.indexOf(PLUGIN_PREFIX) === 0))
|
||||
.then((entries) =>
|
||||
entries.map(({name, description}) => {
|
||||
return {name, description};
|
||||
})
|
||||
)
|
||||
.then(entries =>
|
||||
entries.map(entry => {
|
||||
.then((entries) =>
|
||||
entries.map((entry) => {
|
||||
entry.name = chalk.green(entry.name);
|
||||
return entry;
|
||||
})
|
||||
|
|
@ -109,7 +109,7 @@ args.command(
|
|||
const query = args_[0] ? args_[0].toLowerCase() : '';
|
||||
|
||||
commandPromise = lsRemote(query)
|
||||
.then(entries => {
|
||||
.then((entries) => {
|
||||
if (entries.length === 0) {
|
||||
spinner.fail();
|
||||
console.error(chalk.red(`Your search '${query}' did not match any plugins`));
|
||||
|
|
@ -122,7 +122,7 @@ args.command(
|
|||
console.log(msg);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
spinner.fail();
|
||||
console.error(chalk.red(err)); // TODO
|
||||
});
|
||||
|
|
@ -137,14 +137,14 @@ args.command(
|
|||
const spinner = ora('Searching').start();
|
||||
|
||||
commandPromise = lsRemote()
|
||||
.then(entries => {
|
||||
.then((entries) => {
|
||||
let msg = columnify(entries);
|
||||
|
||||
spinner.succeed();
|
||||
msg = msg.substring(msg.indexOf('\n') + 1); // remove header
|
||||
console.log(msg);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
spinner.fail();
|
||||
console.error(chalk.red(err)); // TODO
|
||||
});
|
||||
|
|
@ -208,7 +208,7 @@ const main = (argv: string[]) => {
|
|||
env
|
||||
};
|
||||
|
||||
const args_ = args.sub.map(arg => {
|
||||
const args_ = args.sub.map((arg) => {
|
||||
const cwd = isAbsolute(arg) ? arg : resolve(process.cwd(), arg);
|
||||
if (!existsSync(cwd)) {
|
||||
console.error(chalk.red(`Error! Directory or file does not exist: ${cwd}`));
|
||||
|
|
@ -232,11 +232,11 @@ const main = (argv: string[]) => {
|
|||
const child = spawn(process.execPath, args_, options);
|
||||
|
||||
if (flags.verbose) {
|
||||
child.stdout.on('data', data => console.log(data.toString('utf8')));
|
||||
child.stderr.on('data', data => console.error(data.toString('utf8')));
|
||||
child.stdout.on('data', (data) => console.log(data.toString('utf8')));
|
||||
child.stderr.on('data', (data) => console.error(data.toString('utf8')));
|
||||
}
|
||||
if (flags.verbose) {
|
||||
return new Promise(c => child.once('exit', () => c(null)));
|
||||
return new Promise((c) => child.once('exit', () => c(null)));
|
||||
}
|
||||
child.unref();
|
||||
return Promise.resolve();
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ export function userExitTermGroup(uid: string) {
|
|||
if (group.sessionUid) {
|
||||
dispatch(userExitSession(group.sessionUid));
|
||||
} else {
|
||||
group.children.forEach(childUid => {
|
||||
group.children.forEach((childUid) => {
|
||||
dispatch(userExitTermGroup(childUid));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ export function moveTo(i: number | 'last') {
|
|||
const {termGroups} = getState().termGroups;
|
||||
i =
|
||||
Object.keys(termGroups)
|
||||
.map(uid => termGroups[uid])
|
||||
.map((uid) => termGroups[uid])
|
||||
.filter(({parentUid}) => !parentUid).length - 1;
|
||||
}
|
||||
dispatch({
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
|||
<a
|
||||
key="link"
|
||||
style={{color: '#fff'}}
|
||||
onClick={ev => {
|
||||
onClick={(ev) => {
|
||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||
ev.preventDefault();
|
||||
}}
|
||||
|
|
@ -77,7 +77,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
|||
{this.props.updateNote && ` ${this.props.updateNote.trim().replace(/\.$/, '')}`} (
|
||||
<a
|
||||
style={{color: '#000'}}
|
||||
onClick={ev => {
|
||||
onClick={(ev) => {
|
||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||
ev.preventDefault();
|
||||
}}
|
||||
|
|
@ -105,7 +105,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
|
|||
textDecoration: 'underline',
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
onClick={ev => {
|
||||
onClick={(ev) => {
|
||||
window.require('electron').shell.openExternal(ev.currentTarget.href);
|
||||
ev.preventDefault();
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default class SearchBox extends React.PureComponent<SearchBoxProps> {
|
|||
render() {
|
||||
return (
|
||||
<div style={searchBoxStyling}>
|
||||
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={input => input && input.focus()} />
|
||||
<input type="text" className="search-box" onKeyUp={this.handleChange} ref={(input) => input && input.focus()} />
|
||||
<span className="search-button" onClick={() => this.props.prev(this.searchTerm)}>
|
||||
{' '}
|
||||
←{' '}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
|
|||
return this.renderTerm(termGroup.sessionUid);
|
||||
}
|
||||
|
||||
const groups = childGroups.asMutable().map(child => {
|
||||
const groups = childGroups.asMutable().map((child) => {
|
||||
const props = getTermGroupProps(
|
||||
child.uid,
|
||||
this.props.parentProps,
|
||||
|
|
@ -134,7 +134,7 @@ class TermGroup_ extends React.PureComponent<TermGroupProps> {
|
|||
}
|
||||
|
||||
const mapStateToProps = (state: HyperState, ownProps: TermGroupOwnProps) => ({
|
||||
childGroups: ownProps.termGroup.children.map(uid => state.termGroups.termGroups[uid])
|
||||
childGroups: ownProps.termGroup.children.map((uid) => state.termGroups.termGroups[uid])
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch: HyperDispatch, ownProps: TermGroupOwnProps) => ({
|
||||
|
|
|
|||
|
|
@ -326,8 +326,8 @@ export default class Term extends React.PureComponent<TermProps> {
|
|||
|
||||
// Update only options that have changed.
|
||||
ObjectTypedKeys(nextTermOptions)
|
||||
.filter(option => option !== 'theme' && nextTermOptions[option] !== this.termOptions[option])
|
||||
.forEach(option => {
|
||||
.filter((option) => option !== 'theme' && nextTermOptions[option] !== this.termOptions[option])
|
||||
.forEach((option) => {
|
||||
try {
|
||||
this.term.setOption(option, nextTermOptions[option]);
|
||||
} catch (e) {
|
||||
|
|
@ -344,7 +344,7 @@ export default class Term extends React.PureComponent<TermProps> {
|
|||
!this.termOptions.theme ||
|
||||
nextTermOptions.rendererType !== this.termOptions.rendererType ||
|
||||
ObjectTypedKeys(nextTermOptions.theme!).some(
|
||||
option => nextTermOptions.theme![option] !== this.termOptions.theme![option]
|
||||
(option) => nextTermOptions.theme![option] !== this.termOptions.theme![option]
|
||||
);
|
||||
if (shouldUpdateTheme) {
|
||||
this.term.setOption('theme', nextTermOptions.theme);
|
||||
|
|
@ -392,7 +392,7 @@ export default class Term extends React.PureComponent<TermProps> {
|
|||
// instead of invoking `destroy`, since it will make the
|
||||
// term insta un-attachable in the future (which we need
|
||||
// to do in case of splitting, see `componentDidMount`
|
||||
this.disposableListeners.forEach(handler => handler.dispose());
|
||||
this.disposableListeners.forEach((handler) => handler.dispose());
|
||||
this.disposableListeners = [];
|
||||
|
||||
window.removeEventListener('paste', this.onWindowPaste, {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ export default class Terms extends React.Component<TermsProps> {
|
|||
|
||||
shouldComponentUpdate(nextProps: TermsProps & {children: any}) {
|
||||
return (
|
||||
ObjectTypedKeys(nextProps).some(i => i !== 'write' && this.props[i] !== nextProps[i]) ||
|
||||
ObjectTypedKeys(this.props).some(i => i !== 'write' && this.props[i] !== nextProps[i])
|
||||
ObjectTypedKeys(nextProps).some((i) => i !== 'write' && this.props[i] !== nextProps[i]) ||
|
||||
ObjectTypedKeys(this.props).some((i) => i !== 'write' && this.props[i] !== nextProps[i])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ export default class Terms extends React.Component<TermsProps> {
|
|||
return (
|
||||
<div className={`terms_terms ${shift ? 'terms_termsShifted' : 'terms_termsNotShifted'}`}>
|
||||
{this.props.customChildrenBefore}
|
||||
{this.props.termGroups.map(termGroup => {
|
||||
{this.props.termGroups.map((termGroup) => {
|
||||
const {uid} = termGroup;
|
||||
const isActive = uid === this.props.activeRootGroup;
|
||||
const props = getTermGroupProps(uid, this.props, {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class Hyper extends React.PureComponent<HyperProps> {
|
|||
}
|
||||
|
||||
const keys = getRegisteredKeys();
|
||||
Object.keys(keys).forEach(commandKeys => {
|
||||
Object.keys(keys).forEach((commandKeys) => {
|
||||
this.mousetrap.bind(
|
||||
commandKeys,
|
||||
(e: any) => {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const fetchFileData = (configData: any) => {
|
|||
return;
|
||||
}
|
||||
|
||||
getBase64FileData(configInfo.bellSoundURL).then(base64FileData => {
|
||||
getBase64FileData(configInfo.bellSoundURL).then((base64FileData) => {
|
||||
// prepend "base64," to the result of this method in order for this to work properly within xterm.js
|
||||
const bellSound = !base64FileData ? null : 'base64,' + base64FileData;
|
||||
configInfo.bellSound = bellSound;
|
||||
|
|
@ -71,11 +71,11 @@ rpc.on('ready', () => {
|
|||
store_.dispatch(uiActions.setFontSmoothing());
|
||||
});
|
||||
|
||||
rpc.on('session add', data => {
|
||||
rpc.on('session add', (data) => {
|
||||
store_.dispatch(sessionActions.addSession(data));
|
||||
});
|
||||
|
||||
rpc.on('session data', d => {
|
||||
rpc.on('session data', (d) => {
|
||||
// the uid is a uuid v4 so it's 36 chars long
|
||||
const uid = d.slice(0, 36);
|
||||
const data = d.slice(36);
|
||||
|
|
@ -174,7 +174,7 @@ rpc.on('move right req', () => {
|
|||
store_.dispatch(uiActions.moveRight());
|
||||
});
|
||||
|
||||
rpc.on('move jump req', index => {
|
||||
rpc.on('move jump req', (index) => {
|
||||
store_.dispatch(uiActions.moveTo(index));
|
||||
});
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ rpc.on('open file', ({path}) => {
|
|||
store_.dispatch(uiActions.openFile(path));
|
||||
});
|
||||
|
||||
rpc.on('open ssh', url => {
|
||||
rpc.on('open ssh', (url) => {
|
||||
store_.dispatch(uiActions.openSSH(url));
|
||||
});
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ rpc.on('update available', ({releaseName, releaseNotes, releaseUrl, canInstall})
|
|||
store_.dispatch(updaterActions.updateAvailable(releaseName, releaseNotes, releaseUrl, canInstall));
|
||||
});
|
||||
|
||||
rpc.on('move', window => {
|
||||
rpc.on('move', (window) => {
|
||||
store_.dispatch(uiActions.windowMove(window));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const insertRebalance = (oldSizes: ImmutableType<number[]>, index: any) => {
|
|||
const newSize = 1 / (oldSizes.length + 1);
|
||||
// We spread out how much each pane should be reduced
|
||||
// with based on their existing size:
|
||||
const balanced = oldSizes.map(size => size - newSize * size);
|
||||
const balanced = oldSizes.map((size) => size - newSize * size);
|
||||
return [...balanced.slice(0, index).asMutable(), newSize, ...balanced.slice(index).asMutable()];
|
||||
};
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ const removeGroup = (state: ImmutableType<ITermState>, uid: string) => {
|
|||
|
||||
const resizeGroup = (state: ImmutableType<ITermState>, uid: any, sizes: number[]) => {
|
||||
// Make sure none of the sizes fall below MIN_SIZE:
|
||||
if (sizes.find(size => size < MIN_SIZE)) {
|
||||
if (sizes.find((size) => size < MIN_SIZE)) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import {createSelector} from 'reselect';
|
|||
import {HyperState} from './hyper';
|
||||
|
||||
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
|
||||
export const getRootGroups = createSelector(getTermGroups, termGroups =>
|
||||
export const getRootGroups = createSelector(getTermGroups, (termGroups) =>
|
||||
Object.keys(termGroups)
|
||||
.map(uid => termGroups[uid])
|
||||
.map((uid) => termGroups[uid])
|
||||
.filter(({parentUid}) => !parentUid)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {Middleware} from 'redux';
|
|||
// the only side effect we perform from middleware
|
||||
// is to write to the react term instance directly
|
||||
// to avoid a performance hit
|
||||
const writeMiddleware: Middleware = () => next => action => {
|
||||
const writeMiddleware: Middleware = () => (next) => (action) => {
|
||||
if (action.type === 'SESSION_PTY_DATA') {
|
||||
const term = terms[action.uid];
|
||||
if (term) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* as the result of an action being triggered.
|
||||
*/
|
||||
import {Middleware} from 'redux';
|
||||
const effectsMiddleware: Middleware = () => next => action => {
|
||||
const effectsMiddleware: Middleware = () => (next) => (action) => {
|
||||
const ret = next(action);
|
||||
if (action.effect) {
|
||||
action.effect();
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ const loadModules = () => {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
ObjectTypedKeys(mod).forEach(i => {
|
||||
ObjectTypedKeys(mod).forEach((i) => {
|
||||
if (Object.hasOwnProperty.call(mod, i)) {
|
||||
mod[i]._pluginName = pluginName;
|
||||
mod[i]._pluginVersion = pluginVersion;
|
||||
|
|
@ -364,7 +364,7 @@ const loadModules = () => {
|
|||
.filter((mod: any) => Boolean(mod));
|
||||
|
||||
const deprecatedPlugins: Record<string, any> = plugins.getDeprecatedConfig();
|
||||
Object.keys(deprecatedPlugins).forEach(name => {
|
||||
Object.keys(deprecatedPlugins).forEach((name) => {
|
||||
const {css} = deprecatedPlugins[name];
|
||||
if (css) {
|
||||
console.warn(`Warning: "${name}" plugin uses some deprecated CSS classes (${css.join(', ')}).`);
|
||||
|
|
@ -387,7 +387,7 @@ function getProps(name: keyof typeof propsDecorators, props: any, ...fnArgs: any
|
|||
const decorators = propsDecorators[name];
|
||||
let props_: typeof props;
|
||||
|
||||
decorators.forEach(fn => {
|
||||
decorators.forEach((fn) => {
|
||||
let ret_;
|
||||
|
||||
if (!props_) {
|
||||
|
|
@ -445,9 +445,9 @@ export function connect<stateProps, dispatchProps>(
|
|||
) {
|
||||
return (Class: any, name: keyof typeof connectors) => {
|
||||
return reduxConnect<stateProps, dispatchProps, any, HyperState>(
|
||||
state => {
|
||||
(state) => {
|
||||
let ret = stateFn(state);
|
||||
connectors[name].state.forEach(fn => {
|
||||
connectors[name].state.forEach((fn) => {
|
||||
let ret_;
|
||||
|
||||
try {
|
||||
|
|
@ -470,9 +470,9 @@ export function connect<stateProps, dispatchProps>(
|
|||
});
|
||||
return ret;
|
||||
},
|
||||
dispatch => {
|
||||
(dispatch) => {
|
||||
let ret = dispatchFn(dispatch);
|
||||
connectors[name].dispatch.forEach(fn => {
|
||||
connectors[name].dispatch.forEach((fn) => {
|
||||
let ret_;
|
||||
|
||||
try {
|
||||
|
|
@ -550,7 +550,7 @@ export function decorateSessionsReducer(fn: ISessionReducer) {
|
|||
}
|
||||
|
||||
// redux middleware generator
|
||||
export const middleware: Middleware = store => next => action => {
|
||||
export const middleware: Middleware = (store) => (next) => (action) => {
|
||||
const nextMiddleware = (remaining: Middleware[]) => (action_: any) =>
|
||||
remaining.length ? remaining[0](store)(nextMiddleware(remaining.slice(1)))(action_) : next(action_);
|
||||
nextMiddleware(middlewares)(action);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ import {Immutable} from 'seamless-immutable';
|
|||
export default function findBySession(termGroupState: Immutable<ITermState>, sessionUid: string) {
|
||||
const {termGroups} = termGroupState;
|
||||
return Object.keys(termGroups)
|
||||
.map(uid => termGroups[uid])
|
||||
.find(group => group.sessionUid === sessionUid);
|
||||
.map((uid) => termGroups[uid])
|
||||
.find((group) => group.sessionUid === sessionUid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Packages
|
||||
const {prompt} = require('inquirer');
|
||||
|
||||
module.exports = async markdown => {
|
||||
module.exports = async (markdown) => {
|
||||
const answers = await prompt([
|
||||
{
|
||||
name: 'intro',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ test.after(async () => {
|
|||
await app.stop();
|
||||
});
|
||||
|
||||
test('see if dev tools are open', async t => {
|
||||
test('see if dev tools are open', async (t) => {
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
t.false(await app.webContents.isDevToolsOpened());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import test from 'ava';
|
||||
const proxyquire = require('proxyquire').noCallThru();
|
||||
|
||||
test('existsOnNpm() builds the url for non-scoped packages', t => {
|
||||
test('existsOnNpm() builds the url for non-scoped packages', (t) => {
|
||||
let getUrl: string;
|
||||
const {existsOnNpm} = proxyquire('../../cli/api', {
|
||||
got: {
|
||||
|
|
@ -22,7 +22,7 @@ test('existsOnNpm() builds the url for non-scoped packages', t => {
|
|||
});
|
||||
});
|
||||
|
||||
test('existsOnNpm() builds the url for scoped packages', t => {
|
||||
test('existsOnNpm() builds the url for scoped packages', (t) => {
|
||||
let getUrl: string;
|
||||
const {existsOnNpm} = proxyquire('../../cli/api', {
|
||||
got: {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import test from 'ava';
|
|||
import toElectronBackgroundColor from '../../app/utils/to-electron-background-color';
|
||||
import {isHexColor} from '../testUtils/is-hex-color';
|
||||
|
||||
test('toElectronBackgroundColor', t => {
|
||||
test('toElectronBackgroundColor', (t) => {
|
||||
t.false(false);
|
||||
});
|
||||
|
||||
test(`returns a color that's in hex`, t => {
|
||||
test(`returns a color that's in hex`, (t) => {
|
||||
const hexColor = '#BADA55';
|
||||
const rgbColor = 'rgb(0,0,0)';
|
||||
const rgbaColor = 'rgb(0,0,0, 55)';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import test from 'ava';
|
||||
const proxyquire = require('proxyquire').noCallThru();
|
||||
|
||||
test('positionIsValid() returns true when window is on only screen', t => {
|
||||
test('positionIsValid() returns true when window is on only screen', (t) => {
|
||||
const position = [50, 50];
|
||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||
electron: {
|
||||
|
|
@ -27,7 +27,7 @@ test('positionIsValid() returns true when window is on only screen', t => {
|
|||
t.true(result);
|
||||
});
|
||||
|
||||
test('positionIsValid() returns true when window is on second screen', t => {
|
||||
test('positionIsValid() returns true when window is on second screen', (t) => {
|
||||
const position = [750, 50];
|
||||
const windowUtils = proxyquire('../../app/utils/window-utils', {
|
||||
electron: {
|
||||
|
|
@ -61,7 +61,7 @@ test('positionIsValid() returns true when window is on second screen', t => {
|
|||
t.true(result);
|
||||
});
|
||||
|
||||
test('positionIsValid() returns false when position isnt valid', t => {
|
||||
test('positionIsValid() returns false when position isnt valid', (t) => {
|
||||
const primaryDisplay = {
|
||||
workArea: {
|
||||
x: 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue