Bump prettier from 2.2.1 to 2.3.0 in /desktop (#2300)

Summary:
Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/releases">prettier's releases</a>.</em></p>
<blockquote>
<h2>2.3.0</h2>
<p><a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">diff</a></p>
<p>{emoji:1f517} <a href="https://prettier.io/blog/2021/05/09/2.3.0.html">Release Notes</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's changelog</a>.</em></p>
<blockquote>
<h1>2.3.0</h1>
<p><a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">diff</a></p>
<p>{emoji:1f517} <a href="https://prettier.io/blog/2021/05/09/2.3.0.html">Release Notes</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2afc3b9ae6"><code>2afc3b9</code></a> Release 2.3.0</li>
<li><a href="7cfa9aa89b"><code>7cfa9aa</code></a> Fix pre-commit hook setup command (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10710">#10710</a>)</li>
<li><a href="c8c02b4753"><code>c8c02b4</code></a> Build(deps-dev): Bump concurrently from 6.0.2 to 6.1.0 in /website (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10834">#10834</a>)</li>
<li><a href="6506e0f50e"><code>6506e0f</code></a> Build(deps-dev): Bump webpack-cli from 4.6.0 to 4.7.0 in /website (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10836">#10836</a>)</li>
<li><a href="69fae9c291"><code>69fae9c</code></a> Build(deps): Bump flow-parser from 0.150.0 to 0.150.1 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10839">#10839</a>)</li>
<li><a href="164a6e2351"><code>164a6e2</code></a> Switch CLI to async (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10804">#10804</a>)</li>
<li><a href="d3e7e2f634"><code>d3e7e2f</code></a> Build(deps): Bump codecov/codecov-action from v1.4.1 to v1.5.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10833">#10833</a>)</li>
<li><a href="9e09845da0"><code>9e09845</code></a> Build(deps): Bump <code>@​angular/compiler</code> from 11.2.12 to 11.2.13 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10838">#10838</a>)</li>
<li><a href="1bfab3d045"><code>1bfab3d</code></a> Build(deps-dev): Bump eslint from 7.25.0 to 7.26.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10840">#10840</a>)</li>
<li><a href="387fce4ed8"><code>387fce4</code></a> Minor formatting tweaks (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10807">#10807</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.2.1&new-version=2.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/2300

Reviewed By: passy

Differential Revision: D28323849

Pulled By: cekkaewnumchai

fbshipit-source-id: 1842877ccc9a9587af7f0d9ff9432c2075c8ee22
This commit is contained in:
dependabot[bot]
2021-05-11 05:50:25 -07:00
committed by Facebook GitHub Bot
parent b3bacc4812
commit 674f71a426
86 changed files with 476 additions and 708 deletions

View File

@@ -157,9 +157,8 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
); );
}; };
getFilter = (): ((n: PluginNotification) => boolean) => ( getFilter =
n: PluginNotification, (): ((n: PluginNotification) => boolean) => (n: PluginNotification) => {
) => {
const searchTerm = this.props.searchTerm.toLowerCase(); const searchTerm = this.props.searchTerm.toLowerCase();
// filter plugins // filter plugins

View File

@@ -207,13 +207,8 @@ class PluginContainer extends PureComponent<Props, State> {
} }
processMessageQueue() { processMessageQueue() {
const { const {pluginKey, pendingMessages, activePlugin, pluginIsEnabled, target} =
pluginKey, this.props;
pendingMessages,
activePlugin,
pluginIsEnabled,
target,
} = this.props;
if (pluginKey !== this.pluginBeingProcessed) { if (pluginKey !== this.pluginBeingProcessed) {
this.pluginBeingProcessed = pluginKey; this.pluginBeingProcessed = pluginKey;
this.cancelCurrentQueue(); this.cancelCurrentQueue();
@@ -273,13 +268,8 @@ class PluginContainer extends PureComponent<Props, State> {
} }
render() { render() {
const { const {activePlugin, pluginKey, target, pendingMessages, pluginIsEnabled} =
activePlugin, this.props;
pluginKey,
target,
pendingMessages,
pluginIsEnabled,
} = this.props;
if (!activePlugin || !target || !pluginKey) { if (!activePlugin || !target || !pluginKey) {
return null; return null;
} }

View File

@@ -150,13 +150,8 @@ test('PluginContainer can render Sandy plugins', async () => {
Component: MySandyPlugin, Component: MySandyPlugin,
}, },
); );
const { const {renderer, act, sendMessage, client, store} =
renderer, await renderMockFlipperWithPlugin(definition);
act,
sendMessage,
client,
store,
} = await renderMockFlipperWithPlugin(definition);
expect(client.rawSend).toBeCalledWith('init', {plugin: 'TestPlugin'}); expect(client.rawSend).toBeCalledWith('init', {plugin: 'TestPlugin'});
@@ -211,9 +206,8 @@ test('PluginContainer can render Sandy plugins', async () => {
`); `);
// make sure the plugin gets connected // make sure the plugin gets connected
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get(definition.id)!.instanceApi;
> = client.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.connectedStub).toBeCalledTimes(1); expect(pluginInstance.connectedStub).toBeCalledTimes(1);
expect(pluginInstance.disconnectedStub).toBeCalledTimes(0); expect(pluginInstance.disconnectedStub).toBeCalledTimes(0);
expect(pluginInstance.activatedStub).toBeCalledTimes(1); expect(pluginInstance.activatedStub).toBeCalledTimes(1);
@@ -359,9 +353,8 @@ test('PluginContainer triggers correct lifecycles for background plugin', async
expect(client.rawSend).toBeCalledWith('init', {plugin: 'TestPlugin'}); expect(client.rawSend).toBeCalledWith('init', {plugin: 'TestPlugin'});
(client.rawSend as jest.Mock).mockClear(); (client.rawSend as jest.Mock).mockClear();
// make sure the plugin gets connected // make sure the plugin gets connected
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get(definition.id)!.instanceApi;
> = client.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.connectedStub).toBeCalledTimes(1); expect(pluginInstance.connectedStub).toBeCalledTimes(1);
expect(pluginInstance.disconnectedStub).toBeCalledTimes(0); expect(pluginInstance.disconnectedStub).toBeCalledTimes(0);
expect(pluginInstance.activatedStub).toBeCalledTimes(1); expect(pluginInstance.activatedStub).toBeCalledTimes(1);
@@ -440,9 +433,8 @@ test('PluginContainer triggers correct lifecycles for background plugin', async
expect(pluginInstance.activatedStub).toBeCalledTimes(2); expect(pluginInstance.activatedStub).toBeCalledTimes(2);
expect(pluginInstance.deactivatedStub).toBeCalledTimes(2); expect(pluginInstance.deactivatedStub).toBeCalledTimes(2);
const newPluginInstance: ReturnType< const newPluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get('TestPlugin')!.instanceApi;
> = client.sandyPluginStates.get('TestPlugin')!.instanceApi;
expect(newPluginInstance.connectedStub).toBeCalledTimes(1); expect(newPluginInstance.connectedStub).toBeCalledTimes(1);
expect(newPluginInstance.disconnectedStub).toBeCalledTimes(0); expect(newPluginInstance.disconnectedStub).toBeCalledTimes(0);
expect(newPluginInstance.activatedStub).toBeCalledTimes(0); expect(newPluginInstance.activatedStub).toBeCalledTimes(0);
@@ -705,9 +697,8 @@ test('PluginContainer can render Sandy device plugins', async () => {
`); `);
// make sure the plugin gets connected // make sure the plugin gets connected
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof devicePlugin> =
typeof devicePlugin device.sandyPluginStates.get(definition.id)!.instanceApi;
> = device.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.activatedStub).toBeCalledTimes(1); expect(pluginInstance.activatedStub).toBeCalledTimes(1);
expect(pluginInstance.deactivatedStub).toBeCalledTimes(0); expect(pluginInstance.deactivatedStub).toBeCalledTimes(0);
@@ -959,9 +950,8 @@ test('Sandy plugins support isPluginSupported + selectPlugin', async () => {
`); `);
expect(renders).toBe(1); expect(renders).toBe(1);
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get(definition.id)!.instanceApi;
> = client.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.isPluginAvailable(definition.id)).toBeTruthy(); expect(pluginInstance.isPluginAvailable(definition.id)).toBeTruthy();
expect(pluginInstance.isPluginAvailable('nonsense')).toBeFalsy(); expect(pluginInstance.isPluginAvailable('nonsense')).toBeFalsy();
expect(pluginInstance.isPluginAvailable(definition2.id)).toBeFalsy(); // not enabled yet expect(pluginInstance.isPluginAvailable(definition2.id)).toBeFalsy(); // not enabled yet
@@ -1076,12 +1066,10 @@ test('PluginContainer can render Sandy plugins for archived devices', async () =
Component: MySandyPlugin, Component: MySandyPlugin,
}, },
); );
const { const {renderer, act, client, store} = await renderMockFlipperWithPlugin(
renderer, definition,
act, {archivedDevice: true},
client, );
store,
} = await renderMockFlipperWithPlugin(definition, {archivedDevice: true});
expect(client.rawSend).not.toBeCalled(); expect(client.rawSend).not.toBeCalled();
@@ -1106,9 +1094,8 @@ test('PluginContainer can render Sandy plugins for archived devices', async () =
expect(renders).toBe(1); expect(renders).toBe(1);
// make sure the plugin gets activated, but not connected! // make sure the plugin gets activated, but not connected!
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get(definition.id)!.instanceApi;
> = client.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.connectedStub).toBeCalledTimes(0); expect(pluginInstance.connectedStub).toBeCalledTimes(0);
expect(pluginInstance.disconnectedStub).toBeCalledTimes(0); expect(pluginInstance.disconnectedStub).toBeCalledTimes(0);
expect(pluginInstance.activatedStub).toBeCalledTimes(1); expect(pluginInstance.activatedStub).toBeCalledTimes(1);
@@ -1210,9 +1197,8 @@ test('PluginContainer triggers correct lifecycles for background plugin', async
expect(client.rawSend).not.toBeCalled(); expect(client.rawSend).not.toBeCalled();
// make sure the plugin gets connected // make sure the plugin gets connected
const pluginInstance: ReturnType< const pluginInstance: ReturnType<typeof plugin> =
typeof plugin client.sandyPluginStates.get(definition.id)!.instanceApi;
> = client.sandyPluginStates.get(definition.id)!.instanceApi;
expect(pluginInstance.connectedStub).toBeCalledTimes(0); expect(pluginInstance.connectedStub).toBeCalledTimes(0);
expect(pluginInstance.disconnectedStub).toBeCalledTimes(0); expect(pluginInstance.disconnectedStub).toBeCalledTimes(0);
expect(pluginInstance.activatedStub).toBeCalledTimes(1); expect(pluginInstance.activatedStub).toBeCalledTimes(1);

View File

@@ -40,12 +40,8 @@ class TestPlugin extends FlipperPlugin<any, any, any> {
} }
test('can create a Fake flipper', async () => { test('can create a Fake flipper', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
expect(client).toBeTruthy(); expect(client).toBeTruthy();
expect(device).toBeTruthy(); expect(device).toBeTruthy();
expect(store).toBeTruthy(); expect(store).toBeTruthy();

View File

@@ -66,10 +66,7 @@ test('persistedStateReducer is adding data', () => {
const tablePlugin = createTablePlugin({...PROPS, method}); const tablePlugin = createTablePlugin({...PROPS, method});
const id = '1'; const id = '1';
const { const {rows, datas} = tablePlugin.persistedStateReducer(
rows,
datas,
} = tablePlugin.persistedStateReducer(
tablePlugin.defaultPersistedState, tablePlugin.defaultPersistedState,
method, method,
{id}, {id},

View File

@@ -213,12 +213,8 @@ test('new clients replace old ones', async () => {
}, },
}, },
); );
const { const {client, store, device, createClient} =
client, await createMockFlipperWithPlugin(plugin, {
store,
device,
createClient,
} = await createMockFlipperWithPlugin(plugin, {
asBackgroundPlugin: true, asBackgroundPlugin: true,
}); });

View File

@@ -372,10 +372,8 @@ class RatingButton extends Component<PropsFromState, State> {
} }
export function SandyRatingButton() { export function SandyRatingButton() {
const [ const [promptData, setPromptData] =
promptData, useState<UserFeedback.FeedbackPrompt | null>(null);
setPromptData,
] = useState<UserFeedback.FeedbackPrompt | null>(null);
const [isShown, setIsShown] = useState(false); const [isShown, setIsShown] = useState(false);
const [hasTriggered, setHasTriggered] = useState(false); const [hasTriggered, setHasTriggered] = useState(false);
const sessionId = useStore((store) => store.application.sessionId); const sessionId = useStore((store) => store.application.sessionId);

View File

@@ -122,10 +122,8 @@ export default class ShareSheetExportUrl extends Component<Props, State> {
this.setState({statusUpdate: msg}); this.setState({statusUpdate: msg});
} }
}; };
const { const {serializedString, fetchMetaDataErrors} =
serializedString, await reportPlatformFailures(
fetchMetaDataErrors,
} = await reportPlatformFailures(
exportStore(this.store, false, this.idler, statusUpdate), exportStore(this.store, false, this.idler, statusUpdate),
`${EXPORT_FLIPPER_TRACE_EVENT}:UI_LINK`, `${EXPORT_FLIPPER_TRACE_EVENT}:UI_LINK`,
); );

View File

@@ -32,10 +32,8 @@ export type VersionCheckResult =
}; };
export default function UpdateIndicator() { export default function UpdateIndicator() {
const [ const [versionCheckResult, setVersionCheckResult] =
versionCheckResult, useState<VersionCheckResult>({kind: 'up-to-date'});
setVersionCheckResult,
] = useState<VersionCheckResult>({kind: 'up-to-date'});
const launcherMsg = useStore((state) => state.application.launcherMsg); const launcherMsg = useStore((state) => state.application.launcherMsg);
// Effect to show notification if details change // Effect to show notification if details change

View File

@@ -42,13 +42,8 @@ TestDevicePlugin.defaultPersistedState = {msg: 'TestDevicePlugin'};
test('SettingsSheet snapshot with nothing enabled', async () => { test('SettingsSheet snapshot with nothing enabled', async () => {
let root: ReactTestRenderer; let root: ReactTestRenderer;
const { const {store, togglePlugin, client, device, pluginKey} =
store, await createMockFlipperWithPlugin(TestPlugin, {
togglePlugin,
client,
device,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin, {
additionalPlugins: [TestDevicePlugin], additionalPlugins: [TestDevicePlugin],
}); });

View File

@@ -185,10 +185,9 @@ function InstallButton(props: {
| {kind: 'Remove'; error?: string} | {kind: 'Remove'; error?: string}
| {kind: 'Update'; error?: string}; | {kind: 'Update'; error?: string};
const catchError = ( const catchError =
actionKind: 'Install' | 'Remove' | 'Update', (actionKind: 'Install' | 'Remove' | 'Update', fn: () => Promise<void>) =>
fn: () => Promise<void>, async () => {
) => async () => {
try { try {
await fn(); await fn();
} catch (err) { } catch (err) {

View File

@@ -112,12 +112,10 @@ const KeyboardShortcutInput = (props: {
const [initialPressedKeys] = useState<PressedKeys>( const [initialPressedKeys] = useState<PressedKeys>(
getInitialStateFromProps(), getInitialStateFromProps(),
); );
const [pressedKeys, setPressedKeys] = useState<PressedKeys>( const [pressedKeys, setPressedKeys] =
initialPressedKeys, useState<PressedKeys>(initialPressedKeys);
); const [isShortcutValid, setIsShortcutValid] =
const [isShortcutValid, setIsShortcutValid] = useState<boolean | undefined>( useState<boolean | undefined>(undefined);
undefined,
);
useEffect(() => { useEffect(() => {
if (!isShortcutValid) { if (!isShortcutValid) {

View File

@@ -69,8 +69,8 @@ const iosEmulatorDevicePlugin = new _SandyPluginDefinition(
iosEmulatorlDevicePluginDetails, iosEmulatorlDevicePluginDetails,
DeviceTestPluginModule, DeviceTestPluginModule,
); );
const androiKaiosPhysicalDevicePluginDetails = TestUtils.createMockPluginDetails( const androiKaiosPhysicalDevicePluginDetails =
{ TestUtils.createMockPluginDetails({
id: 'androidPhysicalDevicePlugin', id: 'androidPhysicalDevicePlugin',
name: 'flipper-plugin-android-physical-device', name: 'flipper-plugin-android-physical-device',
version: '0.0.1', version: '0.0.1',
@@ -82,8 +82,7 @@ const androiKaiosPhysicalDevicePluginDetails = TestUtils.createMockPluginDetails
specs: ['KaiOS'], specs: ['KaiOS'],
}, },
], ],
}, });
);
const androidKaiosPhysicalDevicePlugin = new _SandyPluginDefinition( const androidKaiosPhysicalDevicePlugin = new _SandyPluginDefinition(
androiKaiosPhysicalDevicePluginDetails, androiKaiosPhysicalDevicePluginDetails,
DeviceTestPluginModule, DeviceTestPluginModule,

View File

@@ -47,16 +47,9 @@ function createDevice(
const isKaiOSDevice = Object.keys(props).some( const isKaiOSDevice = Object.keys(props).some(
(name) => name.startsWith('kaios') || name.startsWith('ro.kaios'), (name) => name.startsWith('kaios') || name.startsWith('ro.kaios'),
); );
const androidLikeDevice = new (isKaiOSDevice const androidLikeDevice = new (
? KaiOSDevice isKaiOSDevice ? KaiOSDevice : AndroidDevice
: AndroidDevice)( )(device.id, type, name, adbClient, abiList, sdkVersion);
device.id,
type,
name,
adbClient,
abiList,
sdkVersion,
);
if (ports) { if (ports) {
await androidLikeDevice await androidLikeDevice
.reverse([ports.secure, ports.insecure]) .reverse([ports.secure, ports.insecure])

View File

@@ -100,9 +100,8 @@ export default (store: Store, logger: Logger) => {
return; return;
} }
const persistingPlugin: undefined | PluginDefinition = getPlugin( const persistingPlugin: undefined | PluginDefinition =
pluginName, getPlugin(pluginName);
);
if ( if (
persistingPlugin && persistingPlugin &&
!isSandyPlugin(persistingPlugin) && !isSandyPlugin(persistingPlugin) &&
@@ -129,11 +128,8 @@ export default (store: Store, logger: Logger) => {
} }
}); });
const { const {activeNotifications, blocklistedPlugins, blocklistedCategories} =
activeNotifications, notifications;
blocklistedPlugins,
blocklistedCategories,
} = notifications;
activeNotifications activeNotifications
.map((n) => ({ .map((n) => ({

View File

@@ -124,7 +124,7 @@ function reportVersion(pluginDetails: ActivatablePluginDetails) {
export function filterNewestVersionOfEachPlugin< export function filterNewestVersionOfEachPlugin<
T1 extends PluginDetails, T1 extends PluginDetails,
T2 extends PluginDetails T2 extends PluginDetails,
>(bundledPlugins: T1[], dynamicPlugins: T2[]): (T1 | T2)[] { >(bundledPlugins: T1[], dynamicPlugins: T2[]): (T1 | T2)[] {
const pluginByName: {[key: string]: T1 | T2} = {}; const pluginByName: {[key: string]: T1 | T2} = {};
for (const plugin of bundledPlugins) { for (const plugin of bundledPlugins) {
@@ -170,9 +170,9 @@ export async function getDynamicPlugins() {
} }
} }
export const checkGK = (gatekeepedPlugins: Array<ActivatablePluginDetails>) => ( export const checkGK =
plugin: ActivatablePluginDetails, (gatekeepedPlugins: Array<ActivatablePluginDetails>) =>
): boolean => { (plugin: ActivatablePluginDetails): boolean => {
try { try {
if (!plugin.gatekeeper) { if (!plugin.gatekeeper) {
return true; return true;
@@ -186,7 +186,7 @@ export const checkGK = (gatekeepedPlugins: Array<ActivatablePluginDetails>) => (
console.error(`Failed to check GK for plugin ${plugin.id}`, err); console.error(`Failed to check GK for plugin ${plugin.id}`, err);
return false; return false;
} }
}; };
export const checkDisabled = ( export const checkDisabled = (
disabledPlugins: Array<ActivatablePluginDetails>, disabledPlugins: Array<ActivatablePluginDetails>,

View File

@@ -89,11 +89,8 @@ export default (store: Store, logger: Logger) => {
timeSinceLastStartup, timeSinceLastStartup,
}); });
// create fresh exit data // create fresh exit data
const { const {selectedDevice, selectedApp, selectedPlugin} =
selectedDevice, store.getState().connections;
selectedApp,
selectedPlugin,
} = store.getState().connections;
persistExitData( persistExitData(
{ {
selectedDevice, selectedDevice,
@@ -142,12 +139,8 @@ export default (store: Store, logger: Logger) => {
); );
return; return;
} }
const { const {selectedDevice, selectedPlugin, selectedApp, clients} =
selectedDevice, state.connections;
selectedPlugin,
selectedApp,
clients,
} = state.connections;
persistExitData( persistExitData(
{selectedDevice, selectedPlugin, selectedApp}, {selectedDevice, selectedPlugin, selectedApp},

View File

@@ -20,9 +20,10 @@ const instance = {
debug: jest.fn(), debug: jest.fn(),
}; };
export function extractError( export function extractError(...data: Array<any>): {
...data: Array<any> message: string;
): {message: string; error: Error} { error: Error;
} {
const message = data.map(getStringFromErrorLike).join(' '); const message = data.map(getStringFromErrorLike).join(' ');
const error = data.find((e) => e instanceof Error) || new Error(message); const error = data.find((e) => e instanceof Error) || new Error(message);
return { return {

View File

@@ -206,11 +206,9 @@ function init() {
dark: state.settingsState.darkMode, dark: state.settingsState.darkMode,
}), }),
(theme) => { (theme) => {
(document.getElementById( (
'flipper-theme-import', document.getElementById('flipper-theme-import') as HTMLLinkElement
) as HTMLLinkElement).href = `themes/${ ).href = `themes/${theme.dark ? 'dark' : 'light'}.css`;
theme.dark ? 'dark' : 'light'
}.css`;
}, },
); );
} }

View File

@@ -96,7 +96,7 @@ type StaticPersistedState = any;
export abstract class FlipperBasePlugin< export abstract class FlipperBasePlugin<
State, State,
Actions extends BaseAction, Actions extends BaseAction,
PersistedState PersistedState,
> extends Component<Props<PersistedState>, State> { > extends Component<Props<PersistedState>, State> {
abstract ['constructor']: any; abstract ['constructor']: any;
static title: string | null = null; static title: string | null = null;
@@ -197,7 +197,7 @@ export abstract class FlipperBasePlugin<
export class FlipperDevicePlugin< export class FlipperDevicePlugin<
S, S,
A extends BaseAction, A extends BaseAction,
P P,
> extends FlipperBasePlugin<S, A, P> { > extends FlipperBasePlugin<S, A, P> {
['constructor']: typeof FlipperPlugin; ['constructor']: typeof FlipperPlugin;
device: BaseDevice; device: BaseDevice;
@@ -226,7 +226,7 @@ export class FlipperDevicePlugin<
export class FlipperPlugin< export class FlipperPlugin<
S, S,
A extends BaseAction, A extends BaseAction,
P P,
> extends FlipperBasePlugin<S, A, P> { > extends FlipperBasePlugin<S, A, P> {
['constructor']: typeof FlipperPlugin; ['constructor']: typeof FlipperPlugin;
constructor(props: Props<P>) { constructor(props: Props<P>) {

View File

@@ -470,13 +470,8 @@ export default function createTableNativePlugin(id: string, title: string) {
if (!this.props.persistedState.tableMetadata) { if (!this.props.persistedState.tableMetadata) {
return 'Loading...'; return 'Loading...';
} }
const { const {topToolbar, bottomToolbar, columns, columnSizes, columnOrder} =
topToolbar, this.props.persistedState.tableMetadata;
bottomToolbar,
columns,
columnSizes,
columnOrder,
} = this.props.persistedState.tableMetadata;
const {rows} = this.props.persistedState; const {rows} = this.props.persistedState;
const topToolbarComponent = topToolbar ? renderToolbar(topToolbar) : null; const topToolbarComponent = topToolbar ? renderToolbar(topToolbar) : null;

View File

@@ -71,8 +71,9 @@ test('it should initialize device sandy plugins', async () => {
expect(device.sandyPluginStates.get(TestPlugin.id)).toBeInstanceOf( expect(device.sandyPluginStates.get(TestPlugin.id)).toBeInstanceOf(
_SandyDevicePluginInstance, _SandyDevicePluginInstance,
); );
const instanceApi: PluginApi = device.sandyPluginStates.get(TestPlugin.id)! const instanceApi: PluginApi = device.sandyPluginStates.get(
.instanceApi; TestPlugin.id,
)!.instanceApi;
expect(instanceApi.activateStub).toBeCalledTimes(0); expect(instanceApi.activateStub).toBeCalledTimes(0);
selectTestPlugin(store); selectTestPlugin(store);

View File

@@ -85,8 +85,9 @@ test('it should initialize starred sandy plugins', async () => {
expect(client.sandyPluginStates.get(TestPlugin.id)).toBeInstanceOf( expect(client.sandyPluginStates.get(TestPlugin.id)).toBeInstanceOf(
_SandyPluginInstance, _SandyPluginInstance,
); );
const instanceApi: PluginApi = client.sandyPluginStates.get(TestPlugin.id)! const instanceApi: PluginApi = client.sandyPluginStates.get(
.instanceApi; TestPlugin.id,
)!.instanceApi;
expect(instanceApi.connectStub).toBeCalledTimes(0); expect(instanceApi.connectStub).toBeCalledTimes(0);
selectTestPlugin(store, client); selectTestPlugin(store, client);
@@ -104,8 +105,9 @@ test('it should cleanup a plugin if disabled', async () => {
const {client, store} = await createMockFlipperWithPlugin(TestPlugin); const {client, store} = await createMockFlipperWithPlugin(TestPlugin);
expect(TestPlugin.asPluginModule().plugin).toBeCalledTimes(1); expect(TestPlugin.asPluginModule().plugin).toBeCalledTimes(1);
const pluginInstance: PluginApi = client.sandyPluginStates.get(TestPlugin.id)! const pluginInstance: PluginApi = client.sandyPluginStates.get(
.instanceApi; TestPlugin.id,
)!.instanceApi;
expect(pluginInstance.destroyStub).toHaveBeenCalledTimes(0); expect(pluginInstance.destroyStub).toHaveBeenCalledTimes(0);
client.initPlugin(TestPlugin.id); client.initPlugin(TestPlugin.id);
expect(pluginInstance.connectStub).toHaveBeenCalledTimes(1); expect(pluginInstance.connectStub).toHaveBeenCalledTimes(1);
@@ -210,8 +212,9 @@ test('it trigger hooks for background plugins', async () => {
const {client} = await createMockFlipperWithPlugin(TestPlugin, { const {client} = await createMockFlipperWithPlugin(TestPlugin, {
asBackgroundPlugin: true, asBackgroundPlugin: true,
}); });
const pluginInstance: PluginApi = client.sandyPluginStates.get(TestPlugin.id)! const pluginInstance: PluginApi = client.sandyPluginStates.get(
.instanceApi; TestPlugin.id,
)!.instanceApi;
expect(client.isBackgroundPlugin(TestPlugin.id)).toBeTruthy(); expect(client.isBackgroundPlugin(TestPlugin.id)).toBeTruthy();
expect(pluginInstance.destroyStub).toHaveBeenCalledTimes(0); expect(pluginInstance.destroyStub).toHaveBeenCalledTimes(0);
expect(pluginInstance.connectStub).toHaveBeenCalledTimes(1); expect(pluginInstance.connectStub).toHaveBeenCalledTimes(1);
@@ -234,8 +237,9 @@ test('it can send messages from sandy clients', async () => {
} }
}, },
}); });
const pluginInstance: PluginApi = client.sandyPluginStates.get(TestPlugin.id)! const pluginInstance: PluginApi = client.sandyPluginStates.get(
.instanceApi; TestPlugin.id,
)!.instanceApi;
// without rendering, non-bg plugins won't connect automatically, // without rendering, non-bg plugins won't connect automatically,
client.initPlugin(TestPlugin.id); client.initPlugin(TestPlugin.id);
await pluginInstance.send('test', {test: 3}); await pluginInstance.send('test', {test: 3});

View File

@@ -124,8 +124,8 @@ export class Group {
let errorMessage: string | undefined = undefined; let errorMessage: string | undefined = undefined;
if (selectedApp) { if (selectedApp) {
const {app} = deconstructClientId(selectedApp); const {app} = deconstructClientId(selectedApp);
const enabledPlugins: Array<string> | null = store.getState().connections const enabledPlugins: Array<string> | null =
.enabledPlugins[app]; store.getState().connections.enabledPlugins[app];
const unsupportedPlugins = []; const unsupportedPlugins = [];
for (const requiredPlugin of this.requiredPlugins) { for (const requiredPlugin of this.requiredPlugins) {
const requiredPluginEnabled = const requiredPluginEnabled =

View File

@@ -61,10 +61,8 @@ export function SandyApp() {
* The logic here is to sync both, but without modifying the navigation related reducers to not break classic Flipper. * The logic here is to sync both, but without modifying the navigation related reducers to not break classic Flipper.
* It is possible to simplify this in the future. * It is possible to simplify this in the future.
*/ */
const [ const [toplevelSelection, setStoredToplevelSelection] =
toplevelSelection, useState<ToplevelNavItem>('appinspect');
setStoredToplevelSelection,
] = useState<ToplevelNavItem>('appinspect');
// Handle toplevel nav clicks from LeftRail // Handle toplevel nav clicks from LeftRail
const setToplevelSelection = useCallback( const setToplevelSelection = useCallback(

View File

@@ -212,9 +212,10 @@ export default function SetupDoctorScreen(props: {
const [acknowlodgeProblem, setAcknowlodgeProblem] = useState( const [acknowlodgeProblem, setAcknowlodgeProblem] = useState(
checkHasNewProblem(healthcheckReport.result), checkHasNewProblem(healthcheckReport.result),
); );
const hasProblem = useMemo(() => checkHasProblem(healthcheckReport.result), [ const hasProblem = useMemo(
healthcheckReport, () => checkHasProblem(healthcheckReport.result),
]); [healthcheckReport],
);
const onCloseModal = useCallback(() => { const onCloseModal = useCallback(() => {
const hasNewProblem = checkHasNewProblem(healthcheckReport.result); const hasNewProblem = checkHasNewProblem(healthcheckReport.result);
if (acknowlodgeProblem) { if (acknowlodgeProblem) {

View File

@@ -49,13 +49,8 @@ function getOsIcon(os?: OS) {
export function AppSelector() { export function AppSelector() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { const {devices, selectedDevice, clients, uninitializedClients, selectedApp} =
devices, useStore((state) => state.connections);
selectedDevice,
clients,
uninitializedClients,
selectedApp,
} = useStore((state) => state.connections);
useValue(selectedDevice?.connected, false); // subscribe to future archived state changes useValue(selectedDevice?.connected, false); // subscribe to future archived state changes
const onSelectDevice = useTrackedCallback( const onSelectDevice = useTrackedCallback(

View File

@@ -46,10 +46,10 @@ function BookmarkSectionInput({navPlugin}: {navPlugin: NavigationPlugin}) {
const bookmarks = useValue(navPlugin.bookmarks); const bookmarks = useValue(navPlugin.bookmarks);
const patterns = useValue(navPlugin.appMatchPatterns); const patterns = useValue(navPlugin.appMatchPatterns);
const isBookmarked = useMemo(() => bookmarks.has(currentURI), [ const isBookmarked = useMemo(
bookmarks, () => bookmarks.has(currentURI),
currentURI, [bookmarks, currentURI],
]); );
const autoCompleteItems = useMemoize( const autoCompleteItems = useMemoize(
navPlugin.getAutoCompleteAppMatchPatterns, navPlugin.getAutoCompleteAppMatchPatterns,

View File

@@ -493,10 +493,12 @@ const PluginMenu = styled(Menu)({
'.ant-menu-sub.ant-menu-inline': { '.ant-menu-sub.ant-menu-inline': {
background: theme.backgroundDefault, background: theme.backgroundDefault,
}, },
'.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-submenu-title ': { '.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-submenu-title ':
{
width: '100%', // reset to remove weird bonus pixel from ANT width: '100%', // reset to remove weird bonus pixel from ANT
}, },
'.ant-menu-submenu > .ant-menu-submenu-title, .ant-menu-sub.ant-menu-inline > .ant-menu-item': { '.ant-menu-submenu > .ant-menu-submenu-title, .ant-menu-sub.ant-menu-inline > .ant-menu-item':
{
borderRadius: theme.borderRadius, borderRadius: theme.borderRadius,
height: '32px', height: '32px',
lineHeight: '24px', lineHeight: '24px',
@@ -517,7 +519,8 @@ const PluginMenu = styled(Menu)({
color: theme.white, color: theme.white,
}, },
}, },
'.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow': { '.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow':
{
right: 8, right: 8,
}, },
'.ant-badge-count': { '.ant-badge-count': {

View File

@@ -292,16 +292,8 @@ class Server extends EventEmitter {
}); });
this.connectionTracker.logConnectionAttempt(clientData); this.connectionTracker.logConnectionAttempt(clientData);
const { const {app, os, device, device_id, sdk_version, csr, csr_path, medium} =
app, clientData;
os,
device,
device_id,
sdk_version,
csr,
csr_path,
medium,
} = clientData;
const transformedMedium = transformCertificateExchangeMediumToType(medium); const transformedMedium = transformCertificateExchangeMediumToType(medium);
if (transformedMedium === 'WWW') { if (transformedMedium === 'WWW') {
this.store.dispatch({ this.store.dispatch({
@@ -518,8 +510,11 @@ class Server extends EventEmitter {
// otherwise, use given device_id // otherwise, use given device_id
const {csr_path, csr} = csrQuery; const {csr_path, csr} = csrQuery;
// For iOS we do not need to confirm the device id, as it never changes unlike android. // For iOS we do not need to confirm the device id, as it never changes unlike android.
return (csr_path && csr && query.os != 'iOS' return (
? this.certificateProvider.extractAppNameFromCSR(csr).then((appName) => { csr_path && csr && query.os != 'iOS'
? this.certificateProvider
.extractAppNameFromCSR(csr)
.then((appName) => {
return this.certificateProvider.getTargetDeviceId( return this.certificateProvider.getTargetDeviceId(
query.os, query.os,
appName, appName,

View File

@@ -22,9 +22,8 @@ const Container = styled.div({
}); });
Container.displayName = 'ContextMenuProvider:Container'; Container.displayName = 'ContextMenuProvider:Container';
export const ContextMenuContext = createContext<ContextMenuManager | undefined>( export const ContextMenuContext =
undefined, createContext<ContextMenuManager | undefined>(undefined);
);
/** /**
* Flipper's root is already wrapped with this component, so plugins should not * Flipper's root is already wrapped with this component, so plugins should not
* need to use this. ContextMenu is what you probably want to use. * need to use this. ContextMenu is what you probably want to use.

View File

@@ -63,7 +63,8 @@ const PopoverElement = (props: {
children: ReactNode; children: ReactNode;
}) => { }) => {
const ref = useRef<HTMLDivElement | null>(null); const ref = useRef<HTMLDivElement | null>(null);
const [dimensions, setDimensions] = useState<{ const [dimensions, setDimensions] =
useState<{
width: number; width: number;
height: number; height: number;
} | null>(null); } | null>(null);

View File

@@ -69,15 +69,8 @@ export default class Select extends Component<{
}; };
render() { render() {
const { const {className, options, selected, label, grow, disabled, style} =
className, this.props;
options,
selected,
label,
grow,
disabled,
style,
} = this.props;
let select = ( let select = (
<SelectMenu <SelectMenu

View File

@@ -115,9 +115,9 @@ export default class StackTrace extends Component<{
return null; return null;
} }
const columns = (Object.keys(children[0]) as Array< const columns = (
keyof Child Object.keys(children[0]) as Array<keyof Child>
>).reduce<TableColumns>((acc, cv) => { ).reduce<TableColumns>((acc, cv) => {
if (cv !== 'isBold') { if (cv !== 'isBold') {
acc[cv] = { acc[cv] = {
value: cv, value: cv,
@@ -131,9 +131,9 @@ export default class StackTrace extends Component<{
visible: Boolean(columns[key]), visible: Boolean(columns[key]),
})); }));
const columnSizes = (Object.keys(COLUMNS) as Array< const columnSizes = (
keyof typeof COLUMNS Object.keys(COLUMNS) as Array<keyof typeof COLUMNS>
>).reduce<TableColumnSizes>((acc, cv: keyof typeof COLUMNS) => { ).reduce<TableColumnSizes>((acc, cv: keyof typeof COLUMNS) => {
acc[cv] = acc[cv] =
COLUMNS[cv] === 'flex' COLUMNS[cv] === 'flex'
? 'flex' ? 'flex'

View File

@@ -208,11 +208,8 @@ export default function Searchable(
const filters = new Set( const filters = new Set(
savedDefaultFilter.enum.map((filter) => filter.value), savedDefaultFilter.enum.map((filter) => filter.value),
); );
savedStateFilters[ savedStateFilters[filterIndex].value =
filterIndex savedDefaultFilter.value.filter((value) => filters.has(value));
].value = savedDefaultFilter.value.filter((value) =>
filters.has(value),
);
} }
}); });
} }

View File

@@ -91,12 +91,14 @@ export function rowMatchesSearchTerm(
); );
} }
export const filterRowsFactory = ( export const filterRowsFactory =
(
filters: Array<Filter>, filters: Array<Filter>,
searchTerm: string, searchTerm: string,
regexSearch: boolean, regexSearch: boolean,
contentSearch: boolean, contentSearch: boolean,
) => (row: TableBodyRow): boolean => ) =>
(row: TableBodyRow): boolean =>
rowMatchesFilters(filters, row) && rowMatchesFilters(filters, row) &&
rowMatchesSearchTerm(searchTerm, regexSearch, contentSearch, row); rowMatchesSearchTerm(searchTerm, regexSearch, contentSearch, row);

View File

@@ -540,8 +540,9 @@ export class ManagedTable extends React.Component<
.map((column, index) => ({ .map((column, index) => ({
label: this.props.columns[column].value, label: this.props.columns[column].value,
click: () => { click: () => {
const rowId = this.state.highlightedRows.values().next() const rowId = this.state.highlightedRows
.value; .values()
.next().value;
rowId && this.onCopyCell(rowId, index); rowId && this.onCopyCell(rowId, index);
}, },
})), })),
@@ -665,13 +666,8 @@ export class ManagedTable extends React.Component<
}; };
render() { render() {
const { const {columns, rows, rowLineHeight, hideHeader, horizontallyScrollable} =
columns, this.props;
rows,
rowLineHeight,
hideHeader,
horizontallyScrollable,
} = this.props;
const {columnOrder, columnSizes} = this.state; const {columnOrder, columnSizes} = this.state;
let computedWidth = 0; let computedWidth = 0;

View File

@@ -499,8 +499,9 @@ class ManagedTable extends React.Component<
.map((column, index) => ({ .map((column, index) => ({
label: this.props.columns[column].value, label: this.props.columns[column].value,
click: () => { click: () => {
const rowId = this.state.highlightedRows.values().next() const rowId = this.state.highlightedRows
.value; .values()
.next().value;
rowId && this.onCopyCell(rowId, index); rowId && this.onCopyCell(rowId, index);
}, },
})), })),
@@ -632,13 +633,8 @@ class ManagedTable extends React.Component<
}; };
render() { render() {
const { const {columns, rows, rowLineHeight, hideHeader, horizontallyScrollable} =
columns, this.props;
rows,
rowLineHeight,
hideHeader,
horizontallyScrollable,
} = this.props;
const {columnOrder, columnSizes} = this.state; const {columnOrder, columnSizes} = this.state;
let computedWidth = 0; let computedWidth = 0;

View File

@@ -286,11 +286,8 @@ export default class CertificateProvider {
const deviceIdPromise = appNamePromise.then((app) => const deviceIdPromise = appNamePromise.then((app) =>
this.getTargetAndroidDeviceId(app, destination, csr), this.getTargetAndroidDeviceId(app, destination, csr),
); );
return Promise.all([ return Promise.all([deviceIdPromise, appNamePromise, this.adb]).then(
deviceIdPromise, ([deviceId, appName, adbClient]) =>
appNamePromise,
this.adb,
]).then(([deviceId, appName, adbClient]) =>
androidUtil.push( androidUtil.push(
adbClient, adbClient,
deviceId, deviceId,
@@ -305,9 +302,8 @@ export default class CertificateProvider {
(err) => { (err) => {
if (os === 'iOS') { if (os === 'iOS') {
// Writing directly to FS failed. It's probably a physical device. // Writing directly to FS failed. It's probably a physical device.
const relativePathInsideApp = this.getRelativePathInAppContainer( const relativePathInsideApp =
destination, this.getRelativePathInAppContainer(destination);
);
return appNamePromise return appNamePromise
.then((appName) => { .then((appName) => {
return this.getTargetiOSDeviceId(appName, destination, csr); return this.getTargetiOSDeviceId(appName, destination, csr);

View File

@@ -1127,12 +1127,8 @@ const sandyTestPlugin = new _SandyPluginDefinition(
); );
test('Sandy plugins are exported properly', async () => { test('Sandy plugins are exported properly', async () => {
const { const {client, sendMessage, store, device} =
client, await createMockFlipperWithPlugin(sandyTestPlugin);
sendMessage,
store,
device,
} = await createMockFlipperWithPlugin(sandyTestPlugin);
// We do select another plugin, to verify that pending message queues are indeed processed before exporting // We do select another plugin, to verify that pending message queues are indeed processed before exporting
store.dispatch( store.dispatch(
@@ -1266,8 +1262,7 @@ test('Sandy plugins are imported properly', async () => {
const data = { const data = {
clients: [ clients: [
{ {
id: id: 'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial',
'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial',
query: { query: {
app: 'TestApp', app: 'TestApp',
device: 'MockAndroidDevice', device: 'MockAndroidDevice',
@@ -1288,7 +1283,8 @@ test('Sandy plugins are imported properly', async () => {
fileVersion: '0.9.99', fileVersion: '0.9.99',
flipperReleaseRevision: undefined, flipperReleaseRevision: undefined,
pluginStates2: { pluginStates2: {
'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial': { 'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial':
{
TestPlugin: { TestPlugin: {
otherState: { otherState: {
testCount: -3, testCount: -3,
@@ -1484,8 +1480,7 @@ test('Sandy plugin with custom import', async () => {
const data = { const data = {
clients: [ clients: [
{ {
id: id: 'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial',
'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial',
query: { query: {
app: 'TestApp', app: 'TestApp',
device: 'MockAndroidDevice', device: 'MockAndroidDevice',
@@ -1506,7 +1501,8 @@ test('Sandy plugin with custom import', async () => {
fileVersion: '0.9.99', fileVersion: '0.9.99',
flipperReleaseRevision: undefined, flipperReleaseRevision: undefined,
pluginStates2: { pluginStates2: {
'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial': { 'TestApp#Android#MockAndroidDevice#2e52cea6-94b0-4ea1-b9a8-c9135ede14ca-serial':
{
[plugin.id]: { [plugin.id]: {
count: 4, count: 4,
}, },

View File

@@ -109,12 +109,8 @@ test('queue - events are processed immediately if plugin is selected', async ()
}); });
test('queue - events are NOT processed immediately if plugin is NOT selected (but enabled)', async () => { test('queue - events are NOT processed immediately if plugin is NOT selected (but enabled)', async () => {
const { const {store, client, sendMessage, device} =
store, await createMockFlipperWithPlugin(TestPlugin);
client,
sendMessage,
device,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -203,12 +199,8 @@ test('queue - events are NOT processed immediately if plugin is NOT selected (bu
}); });
test('queue - events are queued for plugins that are favorite when app is not selected', async () => { test('queue - events are queued for plugins that are favorite when app is not selected', async () => {
const { const {device, store, sendMessage, createClient} =
device, await createMockFlipperWithPlugin(TestPlugin);
store,
sendMessage,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -235,13 +227,8 @@ test('queue - events are queued for plugins that are favorite when app is not se
}); });
test('queue - events are queued for plugins that are favorite when app is selected on different device', async () => { test('queue - events are queued for plugins that are favorite when app is selected on different device', async () => {
const { const {client, store, sendMessage, createDevice, createClient} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
sendMessage,
createDevice,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -282,12 +269,8 @@ test('queue - events are queued for plugins that are favorite when app is select
}); });
test('queue - events processing will be paused', async () => { test('queue - events processing will be paused', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -330,12 +313,8 @@ test('queue - events processing will be paused', async () => {
}); });
test('queue - messages that arrive during processing will be queued', async () => { test('queue - messages that arrive during processing will be queued', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -380,12 +359,8 @@ test('queue - messages that arrive during processing will be queued', async () =
}); });
test('queue - processing can be cancelled', async () => { test('queue - processing can be cancelled', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -415,12 +390,8 @@ test('queue - processing can be cancelled', async () => {
}); });
test('queue - make sure resetting plugin state clears the message queue', async () => { test('queue - make sure resetting plugin state clears the message queue', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -486,12 +457,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
static persistedStateReducer = jest.fn(); static persistedStateReducer = jest.fn();
} }
const { const {client, store, device, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
device,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
store.dispatch(registerPlugins([StubDeviceLogs])); store.dispatch(registerPlugins([StubDeviceLogs]));
@@ -646,12 +613,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
}); });
test('queue - messages that have not yet flushed be lost when disabling the plugin', async () => { test('queue - messages that have not yet flushed be lost when disabling the plugin', async () => {
const { const {client, store, sendMessage, pluginKey} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});

View File

@@ -116,12 +116,8 @@ test('queue - events are processed immediately if plugin is selected', async ()
}); });
test('queue - events are NOT processed immediately if plugin is NOT selected (but enabled)', async () => { test('queue - events are NOT processed immediately if plugin is NOT selected (but enabled)', async () => {
const { const {store, client, sendMessage, device} =
store, await createMockFlipperWithPlugin(TestPlugin);
client,
sendMessage,
device,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -260,13 +256,8 @@ test('queue - events ARE processed immediately if plugin is NOT selected / enabl
}); });
test('queue - events are queued for plugins that are favorite when app is not selected', async () => { test('queue - events are queued for plugins that are favorite when app is not selected', async () => {
const { const {client, device, store, sendMessage, createClient} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -293,13 +284,8 @@ test('queue - events are queued for plugins that are favorite when app is not se
}); });
test('queue - events are queued for plugins that are favorite when app is selected on different device', async () => { test('queue - events are queued for plugins that are favorite when app is selected on different device', async () => {
const { const {client, store, sendMessage, createDevice, createClient} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
sendMessage,
createDevice,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin'); expect(store.getState().connections.selectedPlugin).not.toBe('TestPlugin');
@@ -340,12 +326,8 @@ test('queue - events are queued for plugins that are favorite when app is select
}); });
test('queue - events processing will be paused', async () => { test('queue - events processing will be paused', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -390,12 +372,8 @@ test('queue - events processing will be paused', async () => {
}); });
test('queue - messages that arrive during processing will be queued', async () => { test('queue - messages that arrive during processing will be queued', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -446,12 +424,8 @@ test('queue - messages that arrive during processing will be queued', async () =
}); });
test('queue - processing can be cancelled', async () => { test('queue - processing can be cancelled', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -487,12 +461,8 @@ test('queue - processing can be cancelled', async () => {
}); });
test('queue - make sure resetting plugin state clears the message queue', async () => { test('queue - make sure resetting plugin state clears the message queue', async () => {
const { const {client, device, store, sendMessage} =
client, await createMockFlipperWithPlugin(TestPlugin);
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});
@@ -522,13 +492,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
static persistedStateReducer = jest.fn(); static persistedStateReducer = jest.fn();
} }
const { const {client, store, device, sendMessage, pluginKey} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
device,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
store.dispatch(registerPlugins([StubDeviceLogs])); store.dispatch(registerPlugins([StubDeviceLogs]));
@@ -687,12 +652,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
}); });
test('queue - messages that have not yet flushed be lost when disabling the plugin', async () => { test('queue - messages that have not yet flushed be lost when disabling the plugin', async () => {
const { const {client, store, sendMessage, pluginKey} =
client, await createMockFlipperWithPlugin(TestPlugin);
store,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store); selectDeviceLogs(store);
sendMessage('inc', {}); sendMessage('inc', {});

View File

@@ -201,13 +201,8 @@ export function processPluginStates(
export function processNotificationStates( export function processNotificationStates(
options: ProcessNotificationStatesOptions, options: ProcessNotificationStatesOptions,
): Array<PluginNotification> { ): Array<PluginNotification> {
const { const {clients, serial, allActiveNotifications, devicePlugins, statusUpdate} =
clients, options;
serial,
allActiveNotifications,
devicePlugins,
statusUpdate,
} = options;
statusUpdate && statusUpdate &&
statusUpdate('Filtering the notifications for the filtered Clients...'); statusUpdate('Filtering the notifications for the filtered Clients...');
const activeNotifications = allActiveNotifications.filter((notif) => { const activeNotifications = allActiveNotifications.filter((notif) => {

View File

@@ -34,9 +34,10 @@ export function getIcons(): Icons {
// Takes a string like 'star', or 'star-outline', and converts it to // Takes a string like 'star', or 'star-outline', and converts it to
// {trimmedName: 'star', variant: 'filled'} or {trimmedName: 'star', variant: 'outline'} // {trimmedName: 'star', variant: 'filled'} or {trimmedName: 'star', variant: 'outline'}
function getIconPartsFromName( function getIconPartsFromName(icon: string): {
icon: string, trimmedName: string;
): {trimmedName: string; variant: 'outline' | 'filled'} { variant: 'outline' | 'filled';
} {
const isOutlineVersion = icon.endsWith('-outline'); const isOutlineVersion = icon.endsWith('-outline');
const trimmedName = isOutlineVersion ? icon.replace('-outline', '') : icon; const trimmedName = isOutlineVersion ? icon.replace('-outline', '') : icon;
const variant = isOutlineVersion ? 'outline' : 'filled'; const variant = isOutlineVersion ? 'outline' : 'filled';

View File

@@ -157,7 +157,8 @@ export function launchJsEmulator(url: string, height: number, width: number) {
} }
export class JSClientFlipperConnection<M> export class JSClientFlipperConnection<M>
implements FlipperClientConnection<string, M> { implements FlipperClientConnection<string, M>
{
webContentsId: number; webContentsId: number;
connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set(); connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set();
connStatus: ConnectionStatus; connStatus: ConnectionStatus;

View File

@@ -13,7 +13,8 @@ import {Payload, ConnectionStatus, ISubscriber} from 'rsocket-types';
import WebSocket from 'ws'; import WebSocket from 'ws';
export class WebsocketClientFlipperConnection<M> export class WebsocketClientFlipperConnection<M>
implements FlipperClientConnection<string, M> { implements FlipperClientConnection<string, M>
{
websocket: WebSocket; websocket: WebSocket;
connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set(); connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set();
connStatus: ConnectionStatus; connStatus: ConnectionStatus;

View File

@@ -26,13 +26,12 @@ const getPackageJSON = async () => {
return JSON.parse(content); return JSON.parse(content);
}; };
export const readCurrentRevision: () => Promise< export const readCurrentRevision: () => Promise<string | undefined> =
string | undefined lodash.memoize(async () => {
> = lodash.memoize(async () => {
// This is provided as part of the bundling process for headless. // This is provided as part of the bundling process for headless.
if (global.__REVISION__) { if (global.__REVISION__) {
return global.__REVISION__; return global.__REVISION__;
} }
const json = await getPackageJSON(); const json = await getPackageJSON();
return json.revision; return json.revision;
}); });

View File

@@ -26,7 +26,8 @@ interface IFutureSubject<T> {
export class SelfInspectionFlipperClient<M> export class SelfInspectionFlipperClient<M>
extends FlipperClient extends FlipperClient
implements FlipperClientConnection<string, M> { implements FlipperClientConnection<string, M>
{
connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set(); connStatusSubscribers: Set<ISubscriber<ConnectionStatus>> = new Set();
connStatus: ConnectionStatus = {kind: 'CONNECTED'}; connStatus: ConnectionStatus = {kind: 'CONNECTED'};

View File

@@ -15,12 +15,9 @@ export async function serialize(
statusUpdate?: (msg: string) => void, statusUpdate?: (msg: string) => void,
statusMsg?: string, statusMsg?: string,
): Promise<string> { ): Promise<string> {
return makeObjectSerializable( return makeObjectSerializable(obj, idler, statusUpdate, statusMsg).then(
obj, (obj) => JSON.stringify(obj),
idler, );
statusUpdate,
statusMsg,
).then((obj) => JSON.stringify(obj));
} }
export function deserialize(str: string): any { export function deserialize(str: string): any {

View File

@@ -25,7 +25,7 @@ import {shallowEqual} from 'react-redux';
export function sideEffect< export function sideEffect<
Store extends ReduxStore<any, any>, Store extends ReduxStore<any, any>,
V, V,
State = Store extends ReduxStore<infer S, any> ? S : never State = Store extends ReduxStore<infer S, any> ? S : never,
>( >(
store: Store, store: Store,
options: { options: {

View File

@@ -32,7 +32,7 @@
"devDependencies": { "devDependencies": {
"@types/jest": "26.0.23", "@types/jest": "26.0.23",
"jest": "^26.6.3", "jest": "^26.6.3",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-jest": "^26.5.6", "ts-jest": "^26.5.6",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",

View File

@@ -17,7 +17,7 @@
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2", "eslint-plugin-react": "^7.23.2",
"jest": "^26.6.3", "jest": "^26.6.3",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"ts-jest": "^26.5.6", "ts-jest": "^26.5.6",
"tslint-config-prettier": "^1.18.0", "tslint-config-prettier": "^1.18.0",
"typescript": "^4.2.4" "typescript": "^4.2.4"

View File

@@ -301,9 +301,8 @@ export async function runHealthchecks(): Promise<
> { > {
const environmentInfo = await getEnvInfo(); const environmentInfo = await getEnvInfo();
const healthchecks: Healthchecks = getHealthchecks(); const healthchecks: Healthchecks = getHealthchecks();
const results: Array< const results: Array<CategoryResult | SkippedHealthcheckCategory> =
CategoryResult | SkippedHealthcheckCategory await Promise.all(
> = await Promise.all(
Object.entries(healthchecks).map(async ([key, category]) => { Object.entries(healthchecks).map(async ([key, category]) => {
if (category.isSkipped) { if (category.isSkipped) {
return category; return category;

View File

@@ -18,7 +18,7 @@
"@typescript-eslint/parser": "^4.22.0", "@typescript-eslint/parser": "^4.22.0",
"flipper-test-utils": "0.0.0", "flipper-test-utils": "0.0.0",
"jest": "^26.6.3", "jest": "^26.6.3",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-jest": "^26.5.6", "ts-jest": "^26.5.6",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",

View File

@@ -67,9 +67,8 @@ test('it can start a device plugin and listen to lifecycle events', () => {
}); });
test('it can render a device plugin', () => { test('it can render a device plugin', () => {
const {renderer, instance, sendLogEntry} = TestUtils.renderDevicePlugin( const {renderer, instance, sendLogEntry} =
testPlugin, TestUtils.renderDevicePlugin(testPlugin);
);
expect(renderer.baseElement).toMatchInlineSnapshot(` expect(renderer.baseElement).toMatchInlineSnapshot(`
<body> <body>

View File

@@ -86,7 +86,7 @@ type OutputChange =
export class DataSource< export class DataSource<
T = any, T = any,
KEY extends keyof T = any, KEY extends keyof T = any,
KEY_TYPE extends string | number | never = ExtractKeyType<T, KEY> KEY_TYPE extends string | number | never = ExtractKeyType<T, KEY>,
> { > {
private nextId = 0; private nextId = 0;
private _records: Entry<T>[] = []; private _records: Entry<T>[] = [];

View File

@@ -54,9 +54,9 @@ export const buildInMenuEntries = {
export function normalizeMenuEntry(entry: MenuEntry): NormalizedMenuEntry; export function normalizeMenuEntry(entry: MenuEntry): NormalizedMenuEntry;
export function normalizeMenuEntry(entry: any): NormalizedMenuEntry { export function normalizeMenuEntry(entry: any): NormalizedMenuEntry {
const builtInEntry: const builtInEntry: NormalizedMenuEntry | undefined = (
| NormalizedMenuEntry buildInMenuEntries as any
| undefined = (buildInMenuEntries as any)[entry.action]; )[entry.action];
return builtInEntry return builtInEntry
? {...builtInEntry, ...entry} ? {...builtInEntry, ...entry}
: { : {

View File

@@ -27,7 +27,7 @@ type Message = {
*/ */
export interface PluginClient< export interface PluginClient<
Events extends EventsContract = {}, Events extends EventsContract = {},
Methods extends MethodsContract = {} Methods extends MethodsContract = {},
> extends BasePluginClient { > extends BasePluginClient {
/** /**
* Identifier that uniquely identifies the connected application * Identifier that uniquely identifies the connected application
@@ -128,7 +128,7 @@ export interface RealFlipperClient {
export type PluginFactory< export type PluginFactory<
Events extends EventsContract, Events extends EventsContract,
Methods extends MethodsContract Methods extends MethodsContract,
> = (client: PluginClient<Events, Methods>) => object; > = (client: PluginClient<Events, Methods>) => object;
export type FlipperPluginComponent = React.FC<{}>; export type FlipperPluginComponent = React.FC<{}>;

View File

@@ -11,9 +11,10 @@ import {createContext, useContext} from 'react';
import {SandyPluginInstance, PluginFactory} from './Plugin'; import {SandyPluginInstance, PluginFactory} from './Plugin';
import {SandyDevicePluginInstance, DevicePluginFactory} from './DevicePlugin'; import {SandyDevicePluginInstance, DevicePluginFactory} from './DevicePlugin';
export const SandyPluginContext = createContext< export const SandyPluginContext =
SandyPluginInstance | SandyDevicePluginInstance | undefined createContext<SandyPluginInstance | SandyDevicePluginInstance | undefined>(
>(undefined); undefined,
);
export function usePluginInstance(): export function usePluginInstance():
| SandyPluginInstance | SandyPluginInstance
@@ -26,7 +27,7 @@ export function usePluginInstance():
} }
export function usePlugin< export function usePlugin<
Factory extends PluginFactory<any, any> | DevicePluginFactory Factory extends PluginFactory<any, any> | DevicePluginFactory,
>(plugin: Factory): ReturnType<Factory> { >(plugin: Factory): ReturnType<Factory> {
const pluginInstance = usePluginInstance(); const pluginInstance = usePluginInstance();
// In principle we don't *need* the plugin, but having it passed it makes sure the // In principle we don't *need* the plugin, but having it passed it makes sure the

View File

@@ -60,15 +60,13 @@ type ExtractClientType<Module extends FlipperPluginModule<any>> = Parameters<
Module['plugin'] Module['plugin']
>[0]; >[0];
type ExtractMethodsType< type ExtractMethodsType<Module extends FlipperPluginModule<any>> =
Module extends FlipperPluginModule<any> ExtractClientType<Module> extends PluginClient<any, infer Methods>
> = ExtractClientType<Module> extends PluginClient<any, infer Methods>
? Methods ? Methods
: never; : never;
type ExtractEventsType< type ExtractEventsType<Module extends FlipperPluginModule<any>> =
Module extends FlipperPluginModule<any> ExtractClientType<Module> extends PluginClient<infer Events, any>
> = ExtractClientType<Module> extends PluginClient<infer Events, any>
? Events ? Events
: never; : never;

View File

@@ -78,7 +78,7 @@ export type DataListProps<T extends Item> = DataListBaseProps<T> &
Omit<DataTableProps<T>, 'records' | 'dataSource' | 'columns' | 'onSelect'>; Omit<DataTableProps<T>, 'records' | 'dataSource' | 'columns' | 'onSelect'>;
export const DataList: React.FC<DataListProps<any>> = function DataList< export const DataList: React.FC<DataListProps<any>> = function DataList<
T extends Item T extends Item,
>({ >({
selection: baseSelection, selection: baseSelection,
onSelect, onSelect,

View File

@@ -404,11 +404,8 @@ export class Interactive extends React.Component<
} }
calculateResize(event: MouseEvent) { calculateResize(event: MouseEvent) {
const { const {resizingInitialCursor, resizingInitialRect, resizingSides} =
resizingInitialCursor, this.state;
resizingInitialRect,
resizingSides,
} = this.state;
const deltaLeft = resizingInitialCursor!.left - event.clientX; const deltaLeft = resizingInitialCursor!.left - event.clientX;
const deltaTop = resizingInitialCursor!.top - event.clientY; const deltaTop = resizingInitialCursor!.top - event.clientY;
@@ -517,9 +514,7 @@ export class Interactive extends React.Component<
} }
} }
checkIfResizable( checkIfResizable(event: MouseEvent):
event: MouseEvent,
):
| { | {
left: boolean; left: boolean;
right: boolean; right: boolean;

View File

@@ -190,14 +190,8 @@ function renderSplitLayout(
child2 = <Empty />; child2 = <Empty />;
} }
if ('resizable' in props && props.resizable) { if ('resizable' in props && props.resizable) {
const { const {width, height, minHeight, minWidth, maxHeight, maxWidth} =
width, props as any;
height,
minHeight,
minWidth,
maxHeight,
maxWidth,
} = props as any;
const sizeProps = const sizeProps =
direction === 'column' direction === 'column'
? ({ ? ({

View File

@@ -94,7 +94,8 @@ const StyledCollapse = styled(Collapse)({
'& > .ant-collapse-item': { '& > .ant-collapse-item': {
borderBottom: 'none', borderBottom: 'none',
}, },
'& > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box': { '& > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box':
{
padding: 0, padding: 0,
}, },
}); });

View File

@@ -326,18 +326,14 @@ export const DataInspectorNode: React.FC<DataInspectorProps> = memo(
[extractValueProp], [extractValueProp],
); );
const res = useMemo(() => extractValue(data, depth, path), [ const res = useMemo(
extractValue, () => extractValue(data, depth, path),
data, [extractValue, data, depth, path],
depth, );
path, const resDiff = useMemo(
]); () => extractValue(diff, depth, path),
const resDiff = useMemo(() => extractValue(diff, depth, path), [ [extractValue, diff, depth, path],
extractValue, );
diff,
depth,
path,
]);
const ancestry = useMemo( const ancestry = useMemo(
() => (res ? parentAncestry!.concat([res.value]) : []), () => (res ? parentAncestry!.concat([res.value]) : []),
[parentAncestry, res?.value], [parentAncestry, res?.value],

View File

@@ -18,9 +18,7 @@ import {MasterDetail} from '../ui/MasterDetail';
import {createDataSource} from '../state/createDataSource'; import {createDataSource} from '../state/createDataSource';
type PluginResult<Raw, Row> = { type PluginResult<Raw, Row> = {
plugin( plugin(client: PluginClient<Record<string, Raw | {}>>): {
client: PluginClient<Record<string, Raw | {}>>,
): {
rows: DataSource<Row>; rows: DataSource<Row>;
}; };
Component(): React.ReactElement; Component(): React.ReactElement;
@@ -49,7 +47,7 @@ export function createTablePlugin<Row extends object>(props: {
}): PluginResult<Row, Row>; }): PluginResult<Row, Row>;
export function createTablePlugin< export function createTablePlugin<
Raw extends object, Raw extends object,
Row extends object = Raw Row extends object = Raw,
>(props: { >(props: {
buildRow: (record: Raw) => Row; buildRow: (record: Raw) => Row;
method: string; method: string;
@@ -63,7 +61,7 @@ export function createTablePlugin<
Raw extends object, Raw extends object,
Method extends string, Method extends string,
ResetMethod extends string, ResetMethod extends string,
Row extends object = Raw Row extends object = Raw,
>(props: { >(props: {
method: Method; method: Method;
resetMethod?: ResetMethod; resetMethod?: ResetMethod;
@@ -89,7 +87,7 @@ export function createTablePlugin<
} }
const record = props.buildRow const record = props.buildRow
? props.buildRow(event) ? props.buildRow(event)
: ((event as any) as Row); : (event as any as Row);
if (props.key) { if (props.key) {
rows.upsert(record); rows.upsert(record);
} else { } else {

View File

@@ -7,9 +7,7 @@
* @format * @format
*/ */
export function parseColor( export function parseColor(val: string | number):
val: string | number,
):
| { | {
r: number; r: number;
g: number; g: number;

View File

@@ -9,4 +9,5 @@
// Source: https://github.com/sindresorhus/linkify-urls/blob/e0cf2a2d51dc8f5f95d93f97ecb1cc804cc9e6be/index.js#L5 // Source: https://github.com/sindresorhus/linkify-urls/blob/e0cf2a2d51dc8f5f95d93f97ecb1cc804cc9e6be/index.js#L5
// n.b. no /g flag, as that makes the regex stateful! Which is not needed for splitting // n.b. no /g flag, as that makes the regex stateful! Which is not needed for splitting
export const urlRegex = /((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/; export const urlRegex =
/((?<!\+)(?:https?(?::\/\/))(?:www\.)?(?:[a-zA-Z\d-_.]+(?:(?:\.|@)[a-zA-Z\d]{2,})|localhost)(?:(?:[-a-zA-Z\d:%_+.~#*$!?&//=@]*)(?:[,](?![\s]))*)*)/;

View File

@@ -170,7 +170,7 @@
"p-filter": "^2.1.0", "p-filter": "^2.1.0",
"p-map": "^4.0.0", "p-map": "^4.0.0",
"patch-package": "^6.4.7", "patch-package": "^6.4.7",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"pretty-format": "^26.1.0", "pretty-format": "^26.1.0",
"promisify-child-process": "^4.1.0", "promisify-child-process": "^4.1.0",
"react-async": "^10.0.0", "react-async": "^10.0.0",

View File

@@ -25,7 +25,7 @@
"globby": "^11.0.3", "globby": "^11.0.3",
"jest": "^26.6.3", "jest": "^26.6.3",
"mock-fs": "^4.14.0", "mock-fs": "^4.14.0",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-jest": "^26.5.6", "ts-jest": "^26.5.6",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",

View File

@@ -36,7 +36,7 @@
"flipper-test-utils": "0.0.0", "flipper-test-utils": "0.0.0",
"globby": "^11.0.3", "globby": "^11.0.3",
"jest": "^26.6.3", "jest": "^26.6.3",
"prettier": "^2.2.1", "prettier": "^2.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-jest": "^26.5.6", "ts-jest": "^26.5.6",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",

View File

@@ -98,10 +98,8 @@ export function devicePlugin(client: PluginClient<{}, {}>) {
displayCPUDetail: true, displayCPUDetail: true,
}); });
const updateCoreFrequency: ( const updateCoreFrequency: (core: number, type: string) => Promise<void> =
core: number, async (core: number, type: string) => {
type: string,
) => Promise<void> = async (core: number, type: string) => {
const output = await executeShell( const output = await executeShell(
'cat /sys/devices/system/cpu/cpu' + core + '/cpufreq/' + type, 'cat /sys/devices/system/cpu/cpu' + core + '/cpufreq/' + type,
); );

View File

@@ -332,9 +332,10 @@ const FavoritesMenu = React.memo(
favorites: string[]; favorites: string[];
onClick: (value: string) => void; onClick: (value: string) => void;
}) => { }) => {
const onMenuClick = useCallback((p: any) => onClick(p.key as string), [ const onMenuClick = useCallback(
onClick, (p: any) => onClick(p.key as string),
]); [onClick],
);
return ( return (
<Menu> <Menu>
{favorites.map((q) => ( {favorites.map((q) => (
@@ -488,12 +489,8 @@ export function Component() {
const onRowEdited = useCallback( const onRowEdited = useCallback(
(change: {[key: string]: string | null}) => { (change: {[key: string]: string | null}) => {
const { const {selectedDatabaseTable, currentStructure, viewMode, currentPage} =
selectedDatabaseTable, instance.state.get();
currentStructure,
viewMode,
currentPage,
} = instance.state.get();
const highlightedRowIdx = currentPage?.highlightedRows[0] ?? -1; const highlightedRowIdx = currentPage?.highlightedRows[0] ?? -1;
const row = const row =
highlightedRowIdx >= 0 highlightedRowIdx >= 0

View File

@@ -197,9 +197,8 @@ export default class Inspector extends Component<Props, State> {
selectedElement !== prevProps.selectedElement selectedElement !== prevProps.selectedElement
) { ) {
// selected element in non-AX tree changed, find linked element in AX tree // selected element in non-AX tree changed, find linked element in AX tree
const newlySelectedElem = this.props.persistedState.elements[ const newlySelectedElem =
selectedElement this.props.persistedState.elements[selectedElement];
];
if (newlySelectedElem) { if (newlySelectedElem) {
this.props.onSelect( this.props.onSelect(
newlySelectedElem.extraInfo newlySelectedElem.extraInfo
@@ -213,9 +212,8 @@ export default class Inspector extends Component<Props, State> {
selectedAXElement !== prevProps.selectedAXElement selectedAXElement !== prevProps.selectedAXElement
) { ) {
// selected element in AX tree changed, find linked element in non-AX tree // selected element in AX tree changed, find linked element in non-AX tree
const newlySelectedAXElem = this.props.persistedState.AXelements[ const newlySelectedAXElem =
selectedAXElement this.props.persistedState.AXelements[selectedAXElement];
];
if (newlySelectedAXElem) { if (newlySelectedAXElem) {
this.props.onSelect( this.props.onSelect(
newlySelectedAXElem.extraInfo newlySelectedAXElem.extraInfo
@@ -310,16 +308,12 @@ export default class Inspector extends Component<Props, State> {
): Promise<Array<Element>> { ): Promise<Array<Element>> {
if (ids.length > 0 && this.props.client.isConnected) { if (ids.length > 0 && this.props.client.isConnected) {
const {forAccessibilityEvent} = options; const {forAccessibilityEvent} = options;
const { const {elements}: {elements: Array<Element>} =
elements, await this.props.client.call(this.call().GET_NODES, {
}: {elements: Array<Element>} = await this.props.client.call(
this.call().GET_NODES,
{
ids, ids,
forAccessibilityEvent, forAccessibilityEvent,
selected: false, selected: false,
}, });
);
elements.forEach((e) => this.updateElement(e.id, e)); elements.forEach((e) => this.updateElement(e.id, e));
return elements; return elements;
} else { } else {

View File

@@ -86,13 +86,8 @@ test('it will merge equal rows', () => {
}); });
test('it supports deeplink and select nodes + navigating to bottom', async () => { test('it supports deeplink and select nodes + navigating to bottom', async () => {
const { const {instance, sendLogEntry, triggerDeepLink, act, triggerMenuEntry} =
instance, TestUtils.renderDevicePlugin(LogsPlugin);
sendLogEntry,
triggerDeepLink,
act,
triggerMenuEntry,
} = TestUtils.renderDevicePlugin(LogsPlugin);
sendLogEntry(entry1); sendLogEntry(entry1);
sendLogEntry(entry2); sendLogEntry(entry2);
@@ -126,11 +121,8 @@ test('it supports deeplink and select nodes + navigating to bottom', async () =>
}); });
test('export / import plugin does work', async () => { test('export / import plugin does work', async () => {
const { const {instance, exportStateAsync, sendLogEntry} =
instance, TestUtils.startDevicePlugin(LogsPlugin);
exportStateAsync,
sendLogEntry,
} = TestUtils.startDevicePlugin(LogsPlugin);
sendLogEntry(entry1); sendLogEntry(entry1);
sendLogEntry(entry2); sendLogEntry(entry2);

View File

@@ -116,9 +116,8 @@ export function devicePlugin(client: DevicePluginClient) {
persist: 'logs', persist: 'logs',
}); });
const isPaused = createState(true); const isPaused = createState(true);
const tableManagerRef = createRef< const tableManagerRef =
undefined | DataTableManager<ExtendedLogEntry> createRef<undefined | DataTableManager<ExtendedLogEntry>>();
>();
client.onDeepLink((payload: unknown) => { client.onDeepLink((payload: unknown) => {
if (typeof payload === 'string') { if (typeof payload === 'string') {

View File

@@ -30,9 +30,8 @@ type Props = {
export default (props: Props) => { export default (props: Props) => {
const {onHide, onSubmit, uri, requiredParameters} = props; const {onHide, onSubmit, uri, requiredParameters} = props;
const {isValid, values, setValuesArray} = useRequiredParameterFormValidator( const {isValid, values, setValuesArray} =
requiredParameters, useRequiredParameterFormValidator(requiredParameters);
);
return ( return (
<Modal <Modal
visible visible

View File

@@ -95,12 +95,8 @@ class SearchBar extends Component<Props, State> {
render() { render() {
const {bookmarks, providers} = this.props; const {bookmarks, providers} = this.props;
const { const {autoCompleteSheetOpen, inputFocused, searchInputValue, query} =
autoCompleteSheetOpen, this.state;
inputFocused,
searchInputValue,
query,
} = this.state;
return ( return (
<ToolbarContainer> <ToolbarContainer>
<Toolbar> <Toolbar>

View File

@@ -21,7 +21,8 @@ export class ProtobufDefinitionsRepository {
public static getInstance(): ProtobufDefinitionsRepository { public static getInstance(): ProtobufDefinitionsRepository {
if (!ProtobufDefinitionsRepository.instance) { if (!ProtobufDefinitionsRepository.instance) {
ProtobufDefinitionsRepository.instance = new ProtobufDefinitionsRepository(); ProtobufDefinitionsRepository.instance =
new ProtobufDefinitionsRepository();
} }
return ProtobufDefinitionsRepository.instance; return ProtobufDefinitionsRepository.instance;
} }

View File

@@ -668,14 +668,16 @@ class BinaryFormatter {
} }
class ProtobufFormatter { class ProtobufFormatter {
private protobufDefinitionRepository = ProtobufDefinitionsRepository.getInstance(); private protobufDefinitionRepository =
ProtobufDefinitionsRepository.getInstance();
formatRequest(request: Request) { formatRequest(request: Request) {
if ( if (
getHeaderValue(request.requestHeaders, 'content-type') === getHeaderValue(request.requestHeaders, 'content-type') ===
'application/x-protobuf' 'application/x-protobuf'
) { ) {
const protobufDefinition = this.protobufDefinitionRepository.getRequestType( const protobufDefinition =
this.protobufDefinitionRepository.getRequestType(
request.method, request.method,
request.url, request.url,
); );
@@ -708,7 +710,8 @@ class ProtobufFormatter {
'application/x-protobuf' || 'application/x-protobuf' ||
request.url.endsWith('.proto') request.url.endsWith('.proto')
) { ) {
const protobufDefinition = this.protobufDefinitionRepository.getResponseType( const protobufDefinition =
this.protobufDefinitionRepository.getResponseType(
request.method, request.method,
request.url, request.url,
); );

View File

@@ -11,13 +11,8 @@ import {TestUtils} from 'flipper-plugin';
import * as NetworkPlugin from '../index'; import * as NetworkPlugin from '../index';
test('Can handle custom headers', async () => { test('Can handle custom headers', async () => {
const { const {instance, sendEvent, act, renderer, exportState} =
instance, TestUtils.renderPlugin(NetworkPlugin);
sendEvent,
act,
renderer,
exportState,
} = TestUtils.renderPlugin(NetworkPlugin);
act(() => { act(() => {
sendEvent('newRequest', { sendEvent('newRequest', {

View File

@@ -90,9 +90,10 @@ export function ManageMockResponsePanel(props: Props) {
return returnValue; return returnValue;
}); });
}, [props.routes, selectedIdAtom]); }, [props.routes, selectedIdAtom]);
const duplicatedIds = useMemo(() => _duplicateIds(props.routes), [ const duplicatedIds = useMemo(
props.routes, () => _duplicateIds(props.routes),
]); [props.routes],
);
const items: RouteItem[] = Object.entries(props.routes).map( const items: RouteItem[] = Object.entries(props.routes).map(
([id, route]) => ({ ([id, route]) => ({

View File

@@ -65,13 +65,8 @@ test('It can store rows', () => {
}); });
test('It can have selection and render details', async () => { test('It can have selection and render details', async () => {
const { const {instance, renderer, act, sendEvent, exportState} =
instance, TestUtils.renderPlugin(MammalsPlugin);
renderer,
act,
sendEvent,
exportState,
} = TestUtils.renderPlugin(MammalsPlugin);
expect(instance.rows.get()).toEqual({}); expect(instance.rows.get()).toEqual({});
expect(instance.selectedID.get()).toBeNull(); expect(instance.selectedID.get()).toBeNull();

View File

@@ -160,7 +160,7 @@ async function afterPack(context: AfterPackContext) {
// and property names being present. // and property names being present.
type Mutable<T> = {-readonly [P in keyof T]: T[P]}; type Mutable<T> = {-readonly [P in keyof T]: T[P]};
const originalPackager = Object.assign({}, context.packager); const originalPackager = Object.assign({}, context.packager);
const packager = (context.packager as unknown) as WinPackager; const packager = context.packager as unknown as WinPackager;
const appInfo: Mutable<AppInfo> = packager.appInfo; const appInfo: Mutable<AppInfo> = packager.appInfo;
const exeFileName = `${packager.appInfo.productFilename}.exe`; const exeFileName = `${packager.appInfo.productFilename}.exe`;
appInfo.version = FIX_RELEASE_VERSION; appInfo.version = FIX_RELEASE_VERSION;

View File

@@ -174,7 +174,8 @@ export async function compileRenderer(buildFolder: string) {
export async function compileMain() { export async function compileMain() {
const out = path.join(staticDir, 'main.bundle.js'); const out = path.join(staticDir, 'main.bundle.js');
process.env.FLIPPER_ELECTRON_VERSION = require('electron/package.json').version; process.env.FLIPPER_ELECTRON_VERSION =
require('electron/package.json').version;
console.log('⚙️ Compiling main bundle...'); console.log('⚙️ Compiling main bundle...');
try { try {
const config = Object.assign({}, await Metro.loadConfig(), { const config = Object.assign({}, await Metro.loadConfig(), {

View File

@@ -10230,10 +10230,10 @@ prettier@^1.14.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.2.1: prettier@^2.3.0:
version "2.2.1" version "2.3.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==
pretty-format@^25.5.0: pretty-format@^25.5.0:
version "25.5.0" version "25.5.0"