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