mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Fix @typescript-eslint/no-unsafe-return errors
This commit is contained in:
parent
c347ce8483
commit
e266dd00f2
15 changed files with 41 additions and 16 deletions
|
|
@ -106,7 +106,6 @@
|
||||||
"@typescript-eslint/no-shadow": ["error"],
|
"@typescript-eslint/no-shadow": ["error"],
|
||||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||||
"@typescript-eslint/no-unsafe-return": "off",
|
|
||||||
"@typescript-eslint/restrict-template-expressions": "off"
|
"@typescript-eslint/restrict-template-expressions": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ const _watch = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
cfg = _import();
|
cfg = _import();
|
||||||
notify('Configuration updated', 'Hyper configuration reloaded!');
|
notify('Configuration updated', 'Hyper configuration reloaded!');
|
||||||
watchers.forEach((fn) => fn());
|
watchers.forEach((fn) => {
|
||||||
|
fn();
|
||||||
|
});
|
||||||
checkDeprecatedConfig();
|
checkDeprecatedConfig();
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ const _extract = (script?: vm.Script): Record<string, any> => {
|
||||||
if (!module.exports) {
|
if (!module.exports) {
|
||||||
throw new Error('Error reading configuration: `module.exports` not set');
|
throw new Error('Error reading configuration: `module.exports` not set');
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return module.exports;
|
return module.exports;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,9 @@ app.on('ready', () =>
|
||||||
|
|
||||||
app.on('open-file', (event, path) => {
|
app.on('open-file', (event, path) => {
|
||||||
const lastWindow = app.getLastFocusedWindow();
|
const lastWindow = app.getLastFocusedWindow();
|
||||||
const callback = (win: BrowserWindow) => win.rpc.emit('open file', {path});
|
const callback = (win: BrowserWindow) => {
|
||||||
|
win.rpc.emit('open file', {path});
|
||||||
|
};
|
||||||
if (lastWindow) {
|
if (lastWindow) {
|
||||||
callback(lastWindow);
|
callback(lastWindow);
|
||||||
} else if (!lastWindow && {}.hasOwnProperty.call(app, 'createWindow')) {
|
} else if (!lastWindow && {}.hasOwnProperty.call(app, 'createWindow')) {
|
||||||
|
|
@ -219,7 +221,9 @@ app.on('open-file', (event, path) => {
|
||||||
|
|
||||||
app.on('open-url', (event, sshUrl) => {
|
app.on('open-url', (event, sshUrl) => {
|
||||||
const lastWindow = app.getLastFocusedWindow();
|
const lastWindow = app.getLastFocusedWindow();
|
||||||
const callback = (win: BrowserWindow) => win.rpc.emit('open ssh', sshUrl);
|
const callback = (win: BrowserWindow) => {
|
||||||
|
win.rpc.emit('open ssh', sshUrl);
|
||||||
|
};
|
||||||
if (lastWindow) {
|
if (lastWindow) {
|
||||||
callback(lastWindow);
|
callback(lastWindow);
|
||||||
} else if (!lastWindow && {}.hasOwnProperty.call(app, 'createWindow')) {
|
} else if (!lastWindow && {}.hasOwnProperty.call(app, 'createWindow')) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
import {app, dialog, BrowserWindow, App} from 'electron';
|
import {app, dialog, BrowserWindow, App} from 'electron';
|
||||||
import {resolve, basename} from 'path';
|
import {resolve, basename} from 'path';
|
||||||
|
|
@ -100,7 +101,7 @@ function updatePlugins({force = false} = {}) {
|
||||||
updating = true;
|
updating = true;
|
||||||
syncPackageJSON();
|
syncPackageJSON();
|
||||||
const id_ = id;
|
const id_ = id;
|
||||||
install((err: any) => {
|
install((err) => {
|
||||||
updating = false;
|
updating = false;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -125,7 +126,9 @@ function updatePlugins({force = false} = {}) {
|
||||||
cache.set('hyper.plugin-versions', pluginVersions);
|
cache.set('hyper.plugin-versions', pluginVersions);
|
||||||
|
|
||||||
// notify watchers
|
// notify watchers
|
||||||
watchers.forEach((fn) => fn(err, {force}));
|
watchers.forEach((fn) => {
|
||||||
|
fn(err, {force});
|
||||||
|
});
|
||||||
|
|
||||||
if (force || changed) {
|
if (force || changed) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
@ -142,7 +145,7 @@ function updatePlugins({force = false} = {}) {
|
||||||
function getPluginVersions() {
|
function getPluginVersions() {
|
||||||
const paths_ = paths.plugins.concat(paths.localPlugins);
|
const paths_ = paths.plugins.concat(paths.localPlugins);
|
||||||
return paths_.map((path_) => {
|
return paths_.map((path_) => {
|
||||||
let version = null;
|
let version: string | null = null;
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
version = require(resolve(path_, 'package.json')).version;
|
version = require(resolve(path_, 'package.json')).version;
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ import queue from 'queue';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import {yarn, plugs} from '../config/paths';
|
import {yarn, plugs} from '../config/paths';
|
||||||
|
|
||||||
export const install = (fn: Function) => {
|
export const install = (fn: (err: string | null) => void) => {
|
||||||
const spawnQueue = queue({concurrency: 1});
|
const spawnQueue = queue({concurrency: 1});
|
||||||
function yarnFn(args: string[], cb: Function) {
|
function yarnFn(args: string[], cb: (err: string | null) => void) {
|
||||||
const env = {
|
const env = {
|
||||||
NODE_ENV: 'production',
|
NODE_ENV: 'production',
|
||||||
ELECTRON_RUN_AS_NODE: 'true'
|
ELECTRON_RUN_AS_NODE: 'true'
|
||||||
|
|
@ -38,7 +38,7 @@ export const install = (fn: Function) => {
|
||||||
spawnQueue.start();
|
spawnQueue.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
yarnFn(['install', '--no-emoji', '--no-lockfile', '--cache-folder', plugs.cache], (err: any) => {
|
yarnFn(['install', '--no-emoji', '--no-lockfile', '--cache-folder', plugs.cache], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return fn(err);
|
return fn(err);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,9 @@ export function newWindow(
|
||||||
// If no callback is passed to createWindow,
|
// If no callback is passed to createWindow,
|
||||||
// a new session will be created by default.
|
// a new session will be created by default.
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
fn = (win: BrowserWindow) => win.rpc.emit('termgroup add req', {});
|
fn = (win: BrowserWindow) => {
|
||||||
|
win.rpc.emit('termgroup add req', {});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// app.windowCallback is the createWindow callback
|
// app.windowCallback is the createWindow callback
|
||||||
|
|
@ -219,7 +221,9 @@ export function newWindow(
|
||||||
// is maximized on Windows results in unmaximize, without hitting any
|
// is maximized on Windows results in unmaximize, without hitting any
|
||||||
// app buttons
|
// app buttons
|
||||||
for (const ev of ['maximize', 'unmaximize', 'minimize', 'restore'] as any) {
|
for (const ev of ['maximize', 'unmaximize', 'minimize', 'restore'] as any) {
|
||||||
window.on(ev, () => rpc.emit('windowGeometry change', {}));
|
window.on(ev, () => {
|
||||||
|
rpc.emit('windowGeometry change', {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
window.on('move', () => {
|
window.on('move', () => {
|
||||||
const position = window.getPosition();
|
const position = window.getPosition();
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,12 @@ export const getColorMap: {
|
||||||
if (!Array.isArray(colors)) {
|
if (!Array.isArray(colors)) {
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return colors.reduce((result, color, index) => {
|
return colors.reduce((result, color, index) => {
|
||||||
if (index < colorList.length) {
|
if (index < colorList.length) {
|
||||||
result[colorList[index]] = color;
|
result[colorList[index]] = color;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return result;
|
return result;
|
||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,9 @@ const lsRemote = (pattern?: string) => {
|
||||||
const URL = `https://api.npms.io/v2/search?q=${
|
const URL = `https://api.npms.io/v2/search?q=${
|
||||||
(pattern && `${pattern}+`) || ''
|
(pattern && `${pattern}+`) || ''
|
||||||
}keywords:hyper-plugin,hyper-theme&size=250`;
|
}keywords:hyper-plugin,hyper-theme&size=250`;
|
||||||
|
type npmResult = {package: {name: string; description: string}};
|
||||||
return got(URL)
|
return got(URL)
|
||||||
.then((response) => JSON.parse(response.body).results as any[])
|
.then((response) => JSON.parse(response.body).results as npmResult[])
|
||||||
.then((entries) => entries.map((entry) => entry.package))
|
.then((entries) => entries.map((entry) => entry.package))
|
||||||
.then((entries) =>
|
.then((entries) =>
|
||||||
entries.map(({name, description}) => {
|
entries.map(({name, description}) => {
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,8 @@ export default class Term extends React.PureComponent<TermProps> {
|
||||||
}
|
}
|
||||||
Term.reportRenderer(props.uid, useWebGL ? 'WebGL' : 'Canvas');
|
Term.reportRenderer(props.uid, useWebGL ? 'WebGL' : 'Canvas');
|
||||||
|
|
||||||
const shallActivateWebLink = (event: Record<string, any> | undefined) => {
|
const shallActivateWebLink = (event: Record<string, any> | undefined): boolean => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return event && (!props.webLinksActivationKey || event[`${props.webLinksActivationKey}Key`]);
|
return event && (!props.webLinksActivationKey || event[`${props.webLinksActivationKey}Key`]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const effectsMiddleware: Middleware = () => (next) => (action) => {
|
||||||
action.effect();
|
action.effect();
|
||||||
delete action.effect;
|
delete action.effect;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
export default effectsMiddleware;
|
export default effectsMiddleware;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
const valsCache = new WeakMap();
|
const valsCache = new WeakMap();
|
||||||
|
|
||||||
export function values(imm: Record<string, any>) {
|
export function values(imm: Record<string, any>) {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
import {remote} from 'electron';
|
import {remote} from 'electron';
|
||||||
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
|
// TODO: Should be updates to new async API https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
/* eslint-disable eslint-comments/disable-enable-pair */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue