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,42 +157,41 @@ class NotificationsTable extends Component<Props & SearchableProps, State> {
);
};
getFilter = (): ((n: PluginNotification) => boolean) => (
n: PluginNotification,
) => {
const searchTerm = this.props.searchTerm.toLowerCase();
getFilter =
(): ((n: PluginNotification) => boolean) => (n: PluginNotification) => {
const searchTerm = this.props.searchTerm.toLowerCase();
// filter plugins
const blocklistedPlugins = new Set(
this.props.blocklistedPlugins.map((p) => p.toLowerCase()),
);
if (blocklistedPlugins.has(n.pluginId.toLowerCase())) {
return false;
}
// filter categories
const {category} = n.notification;
if (category) {
const blocklistedCategories = new Set(
this.props.blocklistedCategories.map((p) => p.toLowerCase()),
// filter plugins
const blocklistedPlugins = new Set(
this.props.blocklistedPlugins.map((p) => p.toLowerCase()),
);
if (blocklistedCategories.has(category.toLowerCase())) {
if (blocklistedPlugins.has(n.pluginId.toLowerCase())) {
return false;
}
}
if (searchTerm.length === 0) {
return true;
} else if (n.notification.title.toLowerCase().indexOf(searchTerm) > -1) {
return true;
} else if (
typeof n.notification.message === 'string' &&
n.notification.message.toLowerCase().indexOf(searchTerm) > -1
) {
return true;
}
return false;
};
// filter categories
const {category} = n.notification;
if (category) {
const blocklistedCategories = new Set(
this.props.blocklistedCategories.map((p) => p.toLowerCase()),
);
if (blocklistedCategories.has(category.toLowerCase())) {
return false;
}
}
if (searchTerm.length === 0) {
return true;
} else if (n.notification.title.toLowerCase().indexOf(searchTerm) > -1) {
return true;
} else if (
typeof n.notification.message === 'string' &&
n.notification.message.toLowerCase().indexOf(searchTerm) > -1
) {
return true;
}
return false;
};
getPlugin = (id: string) =>
this.props.clientPlugins.get(id) || this.props.devicePlugins.get(id);

View File

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

View File

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

View File

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

View File

@@ -213,14 +213,10 @@ test('new clients replace old ones', async () => {
},
},
);
const {
client,
store,
device,
createClient,
} = await createMockFlipperWithPlugin(plugin, {
asBackgroundPlugin: true,
});
const {client, store, device, createClient} =
await createMockFlipperWithPlugin(plugin, {
asBackgroundPlugin: true,
});
const instance = client.sandyPluginStates.get(plugin.id)!;
instance.instanceApi.counter.set(1);

View File

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

View File

@@ -122,13 +122,11 @@ export default class ShareSheetExportUrl extends Component<Props, State> {
this.setState({statusUpdate: msg});
}
};
const {
serializedString,
fetchMetaDataErrors,
} = await reportPlatformFailures(
exportStore(this.store, false, this.idler, statusUpdate),
`${EXPORT_FLIPPER_TRACE_EVENT}:UI_LINK`,
);
const {serializedString, fetchMetaDataErrors} =
await reportPlatformFailures(
exportStore(this.store, false, this.idler, statusUpdate),
`${EXPORT_FLIPPER_TRACE_EVENT}:UI_LINK`,
);
const uploadMarker = `${EXPORT_FLIPPER_TRACE_EVENT}:upload`;
performance.mark(uploadMarker);
statusUpdate('Uploading Flipper Export...');

View File

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

View File

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

View File

@@ -185,17 +185,16 @@ function InstallButton(props: {
| {kind: 'Remove'; error?: string}
| {kind: 'Update'; error?: string};
const catchError = (
actionKind: 'Install' | 'Remove' | 'Update',
fn: () => Promise<void>,
) => async () => {
try {
await fn();
} catch (err) {
console.error(err);
setAction({kind: actionKind, error: err.toString()});
}
};
const catchError =
(actionKind: 'Install' | 'Remove' | 'Update', fn: () => Promise<void>) =>
async () => {
try {
await fn();
} catch (err) {
console.error(err);
setAction({kind: actionKind, error: err.toString()});
}
};
const mkInstallCallback = (action: 'Install' | 'Update') =>
catchError(action, async () => {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -470,13 +470,8 @@ export default function createTableNativePlugin(id: string, title: string) {
if (!this.props.persistedState.tableMetadata) {
return 'Loading...';
}
const {
topToolbar,
bottomToolbar,
columns,
columnSizes,
columnOrder,
} = this.props.persistedState.tableMetadata;
const {topToolbar, bottomToolbar, columns, columnSizes, columnOrder} =
this.props.persistedState.tableMetadata;
const {rows} = this.props.persistedState;
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(
_SandyDevicePluginInstance,
);
const instanceApi: PluginApi = device.sandyPluginStates.get(TestPlugin.id)!
.instanceApi;
const instanceApi: PluginApi = device.sandyPluginStates.get(
TestPlugin.id,
)!.instanceApi;
expect(instanceApi.activateStub).toBeCalledTimes(0);
selectTestPlugin(store);

View File

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

View File

@@ -124,8 +124,8 @@ export class Group {
let errorMessage: string | undefined = undefined;
if (selectedApp) {
const {app} = deconstructClientId(selectedApp);
const enabledPlugins: Array<string> | null = store.getState().connections
.enabledPlugins[app];
const enabledPlugins: Array<string> | null =
store.getState().connections.enabledPlugins[app];
const unsupportedPlugins = [];
for (const requiredPlugin of this.requiredPlugins) {
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.
* It is possible to simplify this in the future.
*/
const [
toplevelSelection,
setStoredToplevelSelection,
] = useState<ToplevelNavItem>('appinspect');
const [toplevelSelection, setStoredToplevelSelection] =
useState<ToplevelNavItem>('appinspect');
// Handle toplevel nav clicks from LeftRail
const setToplevelSelection = useCallback(

View File

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

View File

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

View File

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

View File

@@ -493,33 +493,36 @@ const PluginMenu = styled(Menu)({
'.ant-menu-sub.ant-menu-inline': {
background: theme.backgroundDefault,
},
'.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-submenu-title ': {
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': {
borderRadius: theme.borderRadius,
height: '32px',
lineHeight: '24px',
padding: `4px 8px !important`,
'&:hover': {
color: theme.textColorPrimary,
background: theme.backgroundTransparentHover,
'.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-submenu-title ':
{
width: '100%', // reset to remove weird bonus pixel from ANT
},
'&.ant-menu-item-selected::after': {
border: 'none',
'.ant-menu-submenu > .ant-menu-submenu-title, .ant-menu-sub.ant-menu-inline > .ant-menu-item':
{
borderRadius: theme.borderRadius,
height: '32px',
lineHeight: '24px',
padding: `4px 8px !important`,
'&:hover': {
color: theme.textColorPrimary,
background: theme.backgroundTransparentHover,
},
'&.ant-menu-item-selected::after': {
border: 'none',
},
'&.ant-menu-item-selected': {
color: theme.white,
background: theme.primaryColor,
border: 'none',
},
'&.ant-menu-item-selected .ant-typography': {
color: theme.white,
},
},
'&.ant-menu-item-selected': {
color: theme.white,
background: theme.primaryColor,
border: 'none',
'.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow':
{
right: 8,
},
'&.ant-menu-item-selected .ant-typography': {
color: theme.white,
},
},
'.ant-menu-submenu-inline > .ant-menu-submenu-title .ant-menu-submenu-arrow': {
right: 8,
},
'.ant-badge-count': {
color: theme.textColorSecondary,
// border: `1px solid ${theme.dividerColor}`,

View File

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

View File

@@ -22,9 +22,8 @@ const Container = styled.div({
});
Container.displayName = 'ContextMenuProvider:Container';
export const ContextMenuContext = createContext<ContextMenuManager | undefined>(
undefined,
);
export const ContextMenuContext =
createContext<ContextMenuManager | undefined>(undefined);
/**
* 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.

View File

@@ -63,10 +63,11 @@ const PopoverElement = (props: {
children: ReactNode;
}) => {
const ref = useRef<HTMLDivElement | null>(null);
const [dimensions, setDimensions] = useState<{
width: number;
height: number;
} | null>(null);
const [dimensions, setDimensions] =
useState<{
width: number;
height: number;
} | null>(null);
useEffect(() => {
if (!ref.current) {
return;

View File

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

View File

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

View File

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

View File

@@ -91,14 +91,16 @@ export function rowMatchesSearchTerm(
);
}
export const filterRowsFactory = (
filters: Array<Filter>,
searchTerm: string,
regexSearch: boolean,
contentSearch: boolean,
) => (row: TableBodyRow): boolean =>
rowMatchesFilters(filters, row) &&
rowMatchesSearchTerm(searchTerm, regexSearch, contentSearch, row);
export const filterRowsFactory =
(
filters: Array<Filter>,
searchTerm: string,
regexSearch: boolean,
contentSearch: boolean,
) =>
(row: TableBodyRow): boolean =>
rowMatchesFilters(filters, row) &&
rowMatchesSearchTerm(searchTerm, regexSearch, contentSearch, row);
class SearchableManagedTable extends PureComponent<Props, State> {
static defaultProps = {

View File

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

View File

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

View File

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

View File

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

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 () => {
const {
store,
client,
sendMessage,
device,
} = await createMockFlipperWithPlugin(TestPlugin);
const {store, client, sendMessage, device} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
device,
store,
sendMessage,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
const {device, store, sendMessage, createClient} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
store,
sendMessage,
createDevice,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, sendMessage, createDevice, createClient} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
sendMessage('inc', {});
@@ -380,12 +359,8 @@ test('queue - messages that arrive during processing will be queued', async () =
});
test('queue - processing can be cancelled', async () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
sendMessage('inc', {});
@@ -486,12 +457,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
static persistedStateReducer = jest.fn();
}
const {
client,
store,
device,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, device, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
store,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, sendMessage, pluginKey} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
store,
client,
sendMessage,
device,
} = await createMockFlipperWithPlugin(TestPlugin);
const {store, client, sendMessage, device} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage, createClient} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
store,
sendMessage,
createDevice,
createClient,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, sendMessage, createDevice, createClient} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
sendMessage('inc', {});
@@ -446,12 +424,8 @@ test('queue - messages that arrive during processing will be queued', async () =
});
test('queue - processing can be cancelled', async () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
device,
store,
sendMessage,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, device, store, sendMessage} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
sendMessage('inc', {});
@@ -522,13 +492,8 @@ test('client - incoming messages are buffered and flushed together', async () =>
static persistedStateReducer = jest.fn();
}
const {
client,
store,
device,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, device, sendMessage, pluginKey} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
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 () => {
const {
client,
store,
sendMessage,
pluginKey,
} = await createMockFlipperWithPlugin(TestPlugin);
const {client, store, sendMessage, pluginKey} =
await createMockFlipperWithPlugin(TestPlugin);
selectDeviceLogs(store);
sendMessage('inc', {});

View File

@@ -201,13 +201,8 @@ export function processPluginStates(
export function processNotificationStates(
options: ProcessNotificationStatesOptions,
): Array<PluginNotification> {
const {
clients,
serial,
allActiveNotifications,
devicePlugins,
statusUpdate,
} = options;
const {clients, serial, allActiveNotifications, devicePlugins, statusUpdate} =
options;
statusUpdate &&
statusUpdate('Filtering the notifications for the filtered Clients...');
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
// {trimmedName: 'star', variant: 'filled'} or {trimmedName: 'star', variant: 'outline'}
function getIconPartsFromName(
icon: string,
): {trimmedName: string; variant: 'outline' | 'filled'} {
function getIconPartsFromName(icon: string): {
trimmedName: string;
variant: 'outline' | 'filled';
} {
const isOutlineVersion = icon.endsWith('-outline');
const trimmedName = isOutlineVersion ? icon.replace('-outline', '') : icon;
const variant = isOutlineVersion ? 'outline' : 'filled';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -301,38 +301,37 @@ export async function runHealthchecks(): Promise<
> {
const environmentInfo = await getEnvInfo();
const healthchecks: Healthchecks = getHealthchecks();
const results: Array<
CategoryResult | SkippedHealthcheckCategory
> = await Promise.all(
Object.entries(healthchecks).map(async ([key, category]) => {
if (category.isSkipped) {
return category;
}
const categoryResult: CategoryResult = [
key,
{
label: category.label,
results: await Promise.all(
category.healthchecks.map(
async ({key, label, run, isRequired}) => ({
key,
label,
isRequired: isRequired ?? true,
result: await run(environmentInfo).catch((e) => {
console.error(e);
// TODO Improve result type to be: OK | Problem(message, fix...)
return {
hasProblem: true,
};
const results: Array<CategoryResult | SkippedHealthcheckCategory> =
await Promise.all(
Object.entries(healthchecks).map(async ([key, category]) => {
if (category.isSkipped) {
return category;
}
const categoryResult: CategoryResult = [
key,
{
label: category.label,
results: await Promise.all(
category.healthchecks.map(
async ({key, label, run, isRequired}) => ({
key,
label,
isRequired: isRequired ?? true,
result: await run(environmentInfo).catch((e) => {
console.error(e);
// TODO Improve result type to be: OK | Problem(message, fix...)
return {
hasProblem: true,
};
}),
}),
}),
),
),
),
},
];
return categoryResult;
}),
);
},
];
return categoryResult;
}),
);
return results;
}

View File

@@ -18,7 +18,7 @@
"@typescript-eslint/parser": "^4.22.0",
"flipper-test-utils": "0.0.0",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"prettier": "^2.3.0",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.6",
"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', () => {
const {renderer, instance, sendLogEntry} = TestUtils.renderDevicePlugin(
testPlugin,
);
const {renderer, instance, sendLogEntry} =
TestUtils.renderDevicePlugin(testPlugin);
expect(renderer.baseElement).toMatchInlineSnapshot(`
<body>

View File

@@ -86,7 +86,7 @@ type OutputChange =
export class DataSource<
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 _records: Entry<T>[] = [];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,4 +9,5 @@
// 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
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-map": "^4.0.0",
"patch-package": "^6.4.7",
"prettier": "^2.2.1",
"prettier": "^2.3.0",
"pretty-format": "^26.1.0",
"promisify-child-process": "^4.1.0",
"react-async": "^10.0.0",

View File

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

View File

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

View File

@@ -98,25 +98,23 @@ export function devicePlugin(client: PluginClient<{}, {}>) {
displayCPUDetail: true,
});
const updateCoreFrequency: (
core: number,
type: string,
) => Promise<void> = async (core: number, type: string) => {
const output = await executeShell(
'cat /sys/devices/system/cpu/cpu' + core + '/cpufreq/' + type,
);
cpuState.update((draft) => {
const newFreq = isNormalInteger(output) ? parseInt(output, 10) : -1;
// update table only if frequency changed
if (draft.cpuFreq[core][type] != newFreq) {
draft.cpuFreq[core][type] = newFreq;
if (type == 'scaling_cur_freq' && draft.cpuFreq[core][type] < 0) {
// cannot find current freq means offline
draft.cpuFreq[core][type] = -2;
const updateCoreFrequency: (core: number, type: string) => Promise<void> =
async (core: number, type: string) => {
const output = await executeShell(
'cat /sys/devices/system/cpu/cpu' + core + '/cpufreq/' + type,
);
cpuState.update((draft) => {
const newFreq = isNormalInteger(output) ? parseInt(output, 10) : -1;
// update table only if frequency changed
if (draft.cpuFreq[core][type] != newFreq) {
draft.cpuFreq[core][type] = newFreq;
if (type == 'scaling_cur_freq' && draft.cpuFreq[core][type] < 0) {
// cannot find current freq means offline
draft.cpuFreq[core][type] = -2;
}
}
}
});
};
});
};
const updateAvailableFrequencies: (core: number) => Promise<void> = async (
core: number,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -668,17 +668,19 @@ class BinaryFormatter {
}
class ProtobufFormatter {
private protobufDefinitionRepository = ProtobufDefinitionsRepository.getInstance();
private protobufDefinitionRepository =
ProtobufDefinitionsRepository.getInstance();
formatRequest(request: Request) {
if (
getHeaderValue(request.requestHeaders, 'content-type') ===
'application/x-protobuf'
) {
const protobufDefinition = this.protobufDefinitionRepository.getRequestType(
request.method,
request.url,
);
const protobufDefinition =
this.protobufDefinitionRepository.getRequestType(
request.method,
request.url,
);
if (protobufDefinition == undefined) {
return (
<Text>
@@ -708,10 +710,11 @@ class ProtobufFormatter {
'application/x-protobuf' ||
request.url.endsWith('.proto')
) {
const protobufDefinition = this.protobufDefinitionRepository.getResponseType(
request.method,
request.url,
);
const protobufDefinition =
this.protobufDefinitionRepository.getResponseType(
request.method,
request.url,
);
if (protobufDefinition == undefined) {
return (
<Text>

View File

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

View File

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

View File

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

View File

@@ -160,7 +160,7 @@ async function afterPack(context: AfterPackContext) {
// and property names being present.
type Mutable<T> = {-readonly [P in keyof T]: T[P]};
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 exeFileName = `${packager.appInfo.productFilename}.exe`;
appInfo.version = FIX_RELEASE_VERSION;

View File

@@ -174,7 +174,8 @@ export async function compileRenderer(buildFolder: string) {
export async function compileMain() {
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...');
try {
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"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
prettier@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18"
integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==
pretty-format@^25.5.0:
version "25.5.0"