Fix Flipper lints #1

Summary: More lints.

Reviewed By: lblasa

Differential Revision: D30769201

fbshipit-source-id: 38089363ffb894171d386eaa80055c5d8d59500f
This commit is contained in:
Pascal Hartig
2021-09-07 07:30:19 -07:00
committed by Facebook GitHub Bot
parent e25103291a
commit e2122e395b
4 changed files with 19 additions and 15 deletions

View File

@@ -143,7 +143,10 @@ function InstallButton(props: {
try { try {
await fn(); await fn();
} catch (err) { } catch (err) {
console.error(err); console.error(
`Installation process of kind ${actionKind} failed with:`,
err,
);
setAction({kind: actionKind, error: err.toString()}); setAction({kind: actionKind, error: err.toString()});
} }
}; };
@@ -293,18 +296,18 @@ function useNPMSearch(
useEffect(() => { useEffect(() => {
(async () => { (async () => {
let cancelled = false; let canceled = false;
const updatablePlugins = await reportPlatformFailures( const updatablePlugins = await reportPlatformFailures(
getUpdatablePlugins(query), getUpdatablePlugins(query),
`${TAG}:queryIndex`, `${TAG}:queryIndex`,
); );
if (cancelled) { if (canceled) {
return; return;
} }
setSearchResults(updatablePlugins); setSearchResults(updatablePlugins);
// Clean up: if query changes while we're searching, abandon results. // Clean up: if query changes while we're searching, abandon results.
return () => { return () => {
cancelled = true; canceled = true;
}; };
})(); })();
}, [query, installedPlugins]); }, [query, installedPlugins]);
@@ -320,10 +323,9 @@ export default connect<PropsFromState, DispatchFromProps, OwnProps, AppState>(
installedPlugins, installedPlugins,
}), }),
(dispatch: Dispatch<Action<any>>) => ({ (dispatch: Dispatch<Action<any>>) => ({
refreshInstalledPlugins: () => { refreshInstalledPlugins: async () => {
getInstalledPlugins().then((plugins) => const plugins = await getInstalledPlugins();
dispatch(registerInstalledPlugins(plugins)), dispatch(registerInstalledPlugins(plugins));
);
}, },
}), }),
)(PluginInstaller); )(PluginInstaller);

View File

@@ -56,7 +56,7 @@ export default function PluginPackageInstaller({
await onInstall(); await onInstall();
} catch (e) { } catch (e) {
setError(e); setError(e);
console.error(e); console.error('PluginPackageInstaller install error:', e);
} finally { } finally {
setInProgress(false); setInProgress(false);
} }

View File

@@ -15,7 +15,7 @@ const IndentedSection = styled(FlexColumn)({
paddingLeft: 50, paddingLeft: 50,
paddingBottom: 10, paddingBottom: 10,
}); });
const GreyedOutOverlay = styled.div({ const GrayedOutOverlay = styled.div({
background: theme.backgroundDefault, background: theme.backgroundDefault,
borderRadius: 4, borderRadius: 4,
opacity: 0.6, opacity: 0.6,
@@ -41,11 +41,11 @@ export default function ToggledSection(props: {
onClick={() => props.onChange && props.onChange(!props.toggled)} onClick={() => props.onChange && props.onChange(!props.toggled)}
toggled={props.toggled} toggled={props.toggled}
/> />
{props.frozen && <GreyedOutOverlay />} {props.frozen && <GrayedOutOverlay />}
</FlexRow> </FlexRow>
<IndentedSection> <IndentedSection>
{props.children} {props.children}
{props.toggled || props.frozen ? null : <GreyedOutOverlay />} {props.toggled || props.frozen ? null : <GrayedOutOverlay />}
</IndentedSection> </IndentedSection>
</FlexColumn> </FlexColumn>
); );

View File

@@ -19,6 +19,8 @@ import {
} from '../../ui'; } from '../../ui';
import React, {useState} from 'react'; import React, {useState} from 'react';
import {promises as fs} from 'fs'; import {promises as fs} from 'fs';
// Used for dialogs.
// eslint-disable-next-line flipper/no-electron-remote-imports
import {remote} from 'electron'; import {remote} from 'electron';
import path from 'path'; import path from 'path';
@@ -49,7 +51,7 @@ const CenteredGlyph = styled(Glyph)({
marginLeft: 10, marginLeft: 10,
}); });
const GreyedOutOverlay = styled.div({ const GrayedOutOverlay = styled.div({
backgroundColor: '#EFEEEF', backgroundColor: '#EFEEEF',
borderRadius: 4, borderRadius: 4,
opacity: 0.6, opacity: 0.6,
@@ -129,7 +131,7 @@ export function FilePathConfigField(props: {
{isValid ? null : ( {isValid ? null : (
<CenteredGlyph name="caution-triangle" color={colors.yellow} /> <CenteredGlyph name="caution-triangle" color={colors.yellow} />
)} )}
{props.frozen && <GreyedOutOverlay />} {props.frozen && <GrayedOutOverlay />}
</ConfigFieldContainer> </ConfigFieldContainer>
); );
} }
@@ -138,7 +140,7 @@ export function ConfigText(props: {content: string; frozen?: boolean}) {
return ( return (
<ConfigFieldContainer> <ConfigFieldContainer>
<InfoText>{props.content}</InfoText> <InfoText>{props.content}</InfoText>
{props.frozen && <GreyedOutOverlay />} {props.frozen && <GrayedOutOverlay />}
</ConfigFieldContainer> </ConfigFieldContainer>
); );
} }