Fix Flipper lints #2
Summary: Per title. Reviewed By: timur-valiev Differential Revision: D30843077 fbshipit-source-id: 1a3f4757518610b8caf41c62af7e27723d0de8d6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
50f19ed3a0
commit
1b8da297e3
@@ -18,8 +18,9 @@ import dispatcher, {
|
||||
} from '../plugins';
|
||||
import {BundledPluginDetails, InstalledPluginDetails} from 'flipper-plugin-lib';
|
||||
import path from 'path';
|
||||
// Allowed in a test.
|
||||
// eslint-disable-next-line flipper/no-electron-remote-imports
|
||||
import {remote} from 'electron';
|
||||
import {FlipperPlugin} from '../../plugin';
|
||||
import {createRootReducer, State} from '../../reducers/index';
|
||||
import {getInstance} from '../../fb-stubs/Logger';
|
||||
import configureStore from 'redux-mock-store';
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
// Fine for app startup.
|
||||
// eslint-disable-next-line flipper/no-electron-remote-imports
|
||||
import {remote, ipcRenderer, IpcRendererEvent} from 'electron';
|
||||
import {Store} from '../reducers/index';
|
||||
import {Logger} from '../fb-interfaces/Logger';
|
||||
|
||||
@@ -155,6 +155,7 @@ export async function handleClientConnected(store: Store, client: Client) {
|
||||
payload: client,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line node/no-sync
|
||||
const device = client.deviceSync;
|
||||
if (device) {
|
||||
store.dispatch(selectDevice(device));
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
// Used responsibly.
|
||||
// eslint-disable-next-line flipper/no-electron-remote-imports
|
||||
import {remote} from 'electron';
|
||||
import flipperServer from './flipperServer';
|
||||
import application from './application';
|
||||
|
||||
@@ -86,10 +86,8 @@ async function handlePluginDownload(
|
||||
const tmpFile = path.join(tmpDir, `${name}-${version}.tgz`);
|
||||
let installedPlugin: InstalledPluginDetails | undefined;
|
||||
try {
|
||||
const cancellationSource = axios.CancelToken.source();
|
||||
dispatch(
|
||||
pluginDownloadStarted({plugin, cancel: cancellationSource.cancel}),
|
||||
);
|
||||
const cancelationSource = axios.CancelToken.source();
|
||||
dispatch(pluginDownloadStarted({plugin, cancel: cancelationSource.cancel}));
|
||||
if (await fs.pathExists(installationDir)) {
|
||||
console.log(
|
||||
`Using existing files instead of downloading plugin "${title}" v${version} from "${downloadUrl}" to "${installationDir}"`,
|
||||
@@ -100,7 +98,7 @@ async function handlePluginDownload(
|
||||
let percentCompleted = 0;
|
||||
const response = await axios.get(plugin.downloadUrl, {
|
||||
adapter: axiosHttpAdapter,
|
||||
cancelToken: cancellationSource.token,
|
||||
cancelToken: cancelationSource.token,
|
||||
responseType: 'stream',
|
||||
headers: {
|
||||
'Sec-Fetch-Site': 'none',
|
||||
|
||||
@@ -51,13 +51,11 @@ import {getPluginKey} from '../utils/pluginKey';
|
||||
|
||||
const maxInstalledPluginVersionsToKeep = 2;
|
||||
|
||||
function refreshInstalledPlugins(store: Store) {
|
||||
removePlugins(store.getState().plugins.uninstalledPluginNames.values())
|
||||
.then(() =>
|
||||
cleanupOldInstalledPluginVersions(maxInstalledPluginVersionsToKeep),
|
||||
)
|
||||
.then(() => getInstalledPlugins())
|
||||
.then((plugins) => store.dispatch(registerInstalledPlugins(plugins)));
|
||||
async function refreshInstalledPlugins(store: Store) {
|
||||
await removePlugins(store.getState().plugins.uninstalledPluginNames.values());
|
||||
await cleanupOldInstalledPluginVersions(maxInstalledPluginVersionsToKeep);
|
||||
const plugins = await getInstalledPlugins();
|
||||
return store.dispatch(registerInstalledPlugins(plugins));
|
||||
}
|
||||
|
||||
export default (
|
||||
@@ -70,7 +68,9 @@ export default (
|
||||
// This needn't happen immediately and is (light) I/O work.
|
||||
if (window.requestIdleCallback) {
|
||||
window.requestIdleCallback(() => {
|
||||
refreshInstalledPlugins(store);
|
||||
refreshInstalledPlugins(store).catch((err) =>
|
||||
console.error('Failed to refresh installed plugins:', err),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
// Used to register a shortcut. Don't have an alternative for that.
|
||||
// eslint-disable-next-line flipper/no-electron-remote-imports
|
||||
import {remote} from 'electron';
|
||||
import MetroDevice from '../server/devices/metro/MetroDevice';
|
||||
import {Store} from '../reducers';
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
// Used for PID tracking.
|
||||
// eslint-disable-next-line flipper/no-electron-remote-imports
|
||||
import {ipcRenderer, remote} from 'electron';
|
||||
import {performance} from 'perf_hooks';
|
||||
import {EventEmitter} from 'events';
|
||||
|
||||
Reference in New Issue
Block a user