Upgrade Prettier from 1.17 to 2.0.2.
Summary: This gets us on the latest Prettier 2.x: https://prettier.io/blog/2020/03/21/2.0.0.html Notably, this adds support for TypeScript 3.8, which introduces new syntax, such as `import type`. Reviewed By: zertosh Differential Revision: D20636268 fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
da89a92875
commit
8658fca4dd
@@ -378,7 +378,7 @@ function addFileWatcherForiOSCrashLogs(
|
||||
return;
|
||||
}
|
||||
const filepath = path.join(dir, filename);
|
||||
promisify(fs.exists)(filepath).then((exists) => {
|
||||
promisify(fs.exists)(filepath).then(exists => {
|
||||
if (!exists) {
|
||||
return;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
||||
static getActiveNotifications = (
|
||||
persistedState: PersistedState,
|
||||
): Array<Notification> => {
|
||||
const filteredCrashes = persistedState.crashes.filter((crash) => {
|
||||
const filteredCrashes = persistedState.crashes.filter(crash => {
|
||||
const ignore = !crash.name && !crash.reason;
|
||||
const unknownCrashCause = crash.reason === UNKNOWN_CRASH_REASON;
|
||||
if (ignore || unknownCrashCause) {
|
||||
@@ -679,7 +679,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
||||
let deeplinkedCrash = null;
|
||||
if (this.props.deepLinkPayload) {
|
||||
const id = this.props.deepLinkPayload;
|
||||
const index = this.props.persistedState.crashes.findIndex((elem) => {
|
||||
const index = this.props.persistedState.crashes.findIndex(elem => {
|
||||
return elem.notificationID === id;
|
||||
});
|
||||
if (index >= 0) {
|
||||
@@ -714,18 +714,18 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
||||
);
|
||||
|
||||
const orderedIDs = crashes.map(
|
||||
(persistedCrash) => persistedCrash.notificationID,
|
||||
persistedCrash => persistedCrash.notificationID,
|
||||
);
|
||||
const selectedCrashID = crash.notificationID;
|
||||
const onCrashChange = (id) => {
|
||||
const onCrashChange = id => {
|
||||
const newSelectedCrash = crashes.find(
|
||||
(element) => element.notificationID === id,
|
||||
element => element.notificationID === id,
|
||||
);
|
||||
this.setState({crash: newSelectedCrash});
|
||||
};
|
||||
|
||||
const callstackString = crash.callstack || '';
|
||||
const children = callstackString.split('\n').map((str) => {
|
||||
const children = callstackString.split('\n').map(str => {
|
||||
return {message: str};
|
||||
});
|
||||
const crashSelector: CrashSelectorProps = {
|
||||
@@ -767,7 +767,7 @@ export default class CrashReporterPlugin extends FlipperDevicePlugin<
|
||||
},
|
||||
]}>
|
||||
<Line />
|
||||
{children.map((child) => {
|
||||
{children.map(child => {
|
||||
return (
|
||||
<StackTraceComponent
|
||||
key={child.message}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import type {PluginClient, Value} from 'flipper';
|
||||
|
||||
type ClientCall<Params, Response> = (Params) => Promise<Response>;
|
||||
type ClientCall<Params, Response> = Params => Promise<Response>;
|
||||
|
||||
type DatabaseListRequest = {};
|
||||
|
||||
@@ -78,22 +78,24 @@ export class DatabaseClient {
|
||||
this.client = pluginClient;
|
||||
}
|
||||
|
||||
getDatabases: ClientCall<DatabaseListRequest, DatabaseListResponse> = (
|
||||
params,
|
||||
) => this.client.call('databaseList', {});
|
||||
getDatabases: ClientCall<
|
||||
DatabaseListRequest,
|
||||
DatabaseListResponse,
|
||||
> = params => this.client.call('databaseList', {});
|
||||
|
||||
getTableData: ClientCall<QueryTableRequest, QueryTableResponse> = (params) =>
|
||||
getTableData: ClientCall<QueryTableRequest, QueryTableResponse> = params =>
|
||||
this.client.call('getTableData', params);
|
||||
|
||||
getTableStructure: ClientCall<
|
||||
GetTableStructureRequest,
|
||||
GetTableStructureResponse,
|
||||
> = (params) => this.client.call('getTableStructure', params);
|
||||
> = params => this.client.call('getTableStructure', params);
|
||||
|
||||
getExecution: ClientCall<ExecuteSqlRequest, ExecuteSqlResponse> = (params) =>
|
||||
getExecution: ClientCall<ExecuteSqlRequest, ExecuteSqlResponse> = params =>
|
||||
this.client.call('execute', params);
|
||||
|
||||
getTableInfo: ClientCall<GetTableInfoRequest, GetTableInfoResponse> = (
|
||||
params,
|
||||
) => this.client.call('getTableInfo', params);
|
||||
getTableInfo: ClientCall<
|
||||
GetTableInfoRequest,
|
||||
GetTableInfoResponse,
|
||||
> = params => this.client.call('getTableInfo', params);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ function renderTable(page: ?Page, component: DatabasesPlugin) {
|
||||
<ManagedTable
|
||||
tableKey={`databases-${page.databaseId}-${page.table}`}
|
||||
floating={false}
|
||||
columnOrder={page.columns.map((name) => ({
|
||||
columnOrder={page.columns.map(name => ({
|
||||
key: name,
|
||||
visible: true,
|
||||
}))}
|
||||
@@ -281,7 +281,7 @@ function renderDatabaseColumns(structure: ?Structure) {
|
||||
<FlexRow grow={true}>
|
||||
<ManagedTable
|
||||
floating={false}
|
||||
columnOrder={structure.columns.map((name) => ({
|
||||
columnOrder={structure.columns.map(name => ({
|
||||
key: name,
|
||||
visible: true,
|
||||
}))}
|
||||
@@ -305,7 +305,7 @@ function renderDatabaseIndexes(structure: ?Structure) {
|
||||
<FlexRow grow={true}>
|
||||
<ManagedTable
|
||||
floating={false}
|
||||
columnOrder={structure.indexesColumns.map((name) => ({
|
||||
columnOrder={structure.indexesColumns.map(name => ({
|
||||
key: name,
|
||||
visible: true,
|
||||
}))}
|
||||
@@ -686,7 +686,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
databaseId: state.selectedDatabase,
|
||||
value: this.state.query.value,
|
||||
})
|
||||
.then((data) => {
|
||||
.then(data => {
|
||||
this.setState({
|
||||
error: null,
|
||||
executionTime: Date.now() - timeBefore,
|
||||
@@ -709,7 +709,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
.catch(e => {
|
||||
this.setState({error: e});
|
||||
});
|
||||
}
|
||||
@@ -864,7 +864,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
table: table,
|
||||
start: newState.pageRowNumber,
|
||||
})
|
||||
.then((data) => {
|
||||
.then(data => {
|
||||
this.dispatchAction({
|
||||
type: 'UpdatePage',
|
||||
databaseId: databaseId,
|
||||
@@ -876,7 +876,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
total: data.total,
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
.catch(e => {
|
||||
this.setState({error: e});
|
||||
});
|
||||
}
|
||||
@@ -891,7 +891,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
databaseId: databaseId,
|
||||
table: table,
|
||||
})
|
||||
.then((data) => {
|
||||
.then(data => {
|
||||
this.dispatchAction({
|
||||
type: 'UpdateStructure',
|
||||
databaseId: databaseId,
|
||||
@@ -902,7 +902,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
indexesValues: data.indexesValues,
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
.catch(e => {
|
||||
this.setState({error: e});
|
||||
});
|
||||
}
|
||||
@@ -917,19 +917,19 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
databaseId: databaseId,
|
||||
table: table,
|
||||
})
|
||||
.then((data) => {
|
||||
.then(data => {
|
||||
this.dispatchAction({
|
||||
type: 'UpdateTableInfo',
|
||||
tableInfo: data.definition,
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
.catch(e => {
|
||||
this.setState({error: e});
|
||||
});
|
||||
}
|
||||
|
||||
if (!previousState.outdatedDatabaseList && newState.outdatedDatabaseList) {
|
||||
this.databaseClient.getDatabases({}).then((databases) => {
|
||||
this.databaseClient.getDatabases({}).then(databases => {
|
||||
this.dispatchAction({
|
||||
type: 'UpdateDatabases',
|
||||
databases,
|
||||
@@ -940,7 +940,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
|
||||
init() {
|
||||
this.databaseClient = new DatabaseClient(this.client);
|
||||
this.databaseClient.getDatabases({}).then((databases) => {
|
||||
this.databaseClient.getDatabases({}).then(databases => {
|
||||
this.dispatchAction({
|
||||
type: 'UpdateDatabases',
|
||||
databases,
|
||||
@@ -987,7 +987,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
};
|
||||
|
||||
onDatabaseSelected = (selected: string) => {
|
||||
const dbId = this.state.databases.find((x) => x.name === selected)?.id || 0;
|
||||
const dbId = this.state.databases.find(x => x.name === selected)?.id || 0;
|
||||
this.dispatchAction({
|
||||
database: dbId,
|
||||
type: 'UpdateSelectedDatabase',
|
||||
@@ -1164,7 +1164,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
<ManagedTable
|
||||
floating={false}
|
||||
multiline={true}
|
||||
columnOrder={columns.map((name) => ({
|
||||
columnOrder={columns.map(name => ({
|
||||
key: name,
|
||||
visible: true,
|
||||
}))}
|
||||
@@ -1175,7 +1175,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
zebra={true}
|
||||
rows={rows}
|
||||
horizontallyScrollable={true}
|
||||
onRowHighlighted={(highlightedRows) => {
|
||||
onRowHighlighted={highlightedRows => {
|
||||
this.setState({
|
||||
queryResult: {
|
||||
table: {
|
||||
@@ -1267,7 +1267,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
<BoldSpan style={{marginRight: 16}}>Database</BoldSpan>
|
||||
<Select
|
||||
options={this.state.databases
|
||||
.map((x) => x.name)
|
||||
.map(x => x.name)
|
||||
.reduce((obj, item) => {
|
||||
obj[item] = item;
|
||||
return obj;
|
||||
@@ -1293,7 +1293,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
<BoldSpan style={{marginRight: 16}}>Database</BoldSpan>
|
||||
<Select
|
||||
options={this.state.databases
|
||||
.map((x) => x.name)
|
||||
.map(x => x.name)
|
||||
.reduce((obj, item) => {
|
||||
obj[item] = item;
|
||||
return obj;
|
||||
@@ -1343,7 +1343,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
/>
|
||||
{this.state.favorites !== null ? (
|
||||
<Button
|
||||
dropdown={this.state.favorites.map((option) => {
|
||||
dropdown={this.state.favorites.map(option => {
|
||||
return {
|
||||
click: () => {
|
||||
this.setState({
|
||||
|
||||
@@ -64,7 +64,7 @@ export default class DetailsPanel extends Component<Props> {
|
||||
floating={false}
|
||||
heading={'Changesets'}>
|
||||
<MarkerTimeline
|
||||
points={changeSets.map((p) => ({
|
||||
points={changeSets.map(p => ({
|
||||
label:
|
||||
p.type === 'CHANGESET_GENERATED' ? 'Generated' : 'Rendered',
|
||||
time: Math.round((p.timestamp || 0) - firstChangeSet),
|
||||
@@ -72,9 +72,9 @@ export default class DetailsPanel extends Component<Props> {
|
||||
p.type === 'CHANGESET_GENERATED' ? colors.lemon : colors.teal,
|
||||
key: p.identifier,
|
||||
}))}
|
||||
onClick={(ids) =>
|
||||
onClick={ids =>
|
||||
this.props.onFocusChangeSet(
|
||||
changeSets.find((c) => c.identifier === ids[0]),
|
||||
changeSets.find(c => c.identifier === ids[0]),
|
||||
)
|
||||
}
|
||||
selected={this.props.focusedChangeSet?.identifier}
|
||||
|
||||
@@ -29,7 +29,7 @@ const Container = styled(FlexRow)({
|
||||
flexGrow: 1,
|
||||
});
|
||||
|
||||
const SurfaceContainer = styled(FlexColumn)((props) => ({
|
||||
const SurfaceContainer = styled(FlexColumn)(props => ({
|
||||
position: 'relative',
|
||||
'::after': {
|
||||
display: props.scrolled ? 'block' : 'none',
|
||||
@@ -50,7 +50,7 @@ const TimeContainer = styled(FlexColumn)({
|
||||
flexShrink: 1,
|
||||
});
|
||||
|
||||
const Row = styled(FlexRow)((props) => ({
|
||||
const Row = styled(FlexRow)(props => ({
|
||||
alignItems: 'center',
|
||||
paddingBottom: 3,
|
||||
marginTop: 3,
|
||||
@@ -174,7 +174,7 @@ export default class extends Component<Props, State> {
|
||||
let nextGenerationId = null;
|
||||
|
||||
const index = this.props.generations.findIndex(
|
||||
(g) => g.id === this.props.focusedGenerationId,
|
||||
g => g.id === this.props.focusedGenerationId,
|
||||
);
|
||||
|
||||
const direction = e.key === 'ArrowRight' ? 1 : -1;
|
||||
@@ -206,14 +206,14 @@ export default class extends Component<Props, State> {
|
||||
return (
|
||||
<Container>
|
||||
<SurfaceContainer scrolled={this.state.scrolled}>
|
||||
{[...surfaces].map((surface) => (
|
||||
{[...surfaces].map(surface => (
|
||||
<Row key={surface}>
|
||||
<Label title={surface}>{surface}</Label>
|
||||
</Row>
|
||||
))}
|
||||
</SurfaceContainer>
|
||||
<TimeContainer onScroll={this.onScroll}>
|
||||
{[...surfaces].map((surface) => (
|
||||
{[...surfaces].map(surface => (
|
||||
<Row key={surface} showTimeline>
|
||||
{this.props.generations.map((record: TreeGeneration) =>
|
||||
record.surface_key === surface ? (
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class extends React.Component<Props> {
|
||||
if (this.props.skipStackTraceFormat) {
|
||||
return (
|
||||
<StackTrace backgroundColor={colors.white}>
|
||||
{this.props.data.map((stack_trace_line) => {
|
||||
{this.props.data.map(stack_trace_line => {
|
||||
return {
|
||||
caller: stack_trace_line,
|
||||
};
|
||||
@@ -43,10 +43,10 @@ export default class extends React.Component<Props> {
|
||||
<StackTrace backgroundColor={colors.white}>
|
||||
{/* We need to filter out from the stack trace any reference to the plugin such that the information is more coincised and focused */}
|
||||
{this.props.data
|
||||
.filter((stack_trace_line) => {
|
||||
.filter(stack_trace_line => {
|
||||
return !stack_trace_line.includes('FlipperKitSectionsPlugin');
|
||||
})
|
||||
.map((stack_trace_line) => {
|
||||
.map(stack_trace_line => {
|
||||
const trace = REGEX.exec(stack_trace_line)?.groups;
|
||||
return {
|
||||
bold: !isSystemLibrary(trace?.library),
|
||||
|
||||
@@ -13,7 +13,7 @@ import {Glyph, PureComponent, styled, Toolbar, Spacer, colors} from 'flipper';
|
||||
import {Tree} from 'react-d3-tree';
|
||||
import {Fragment} from 'react';
|
||||
|
||||
const Legend = styled.div((props) => ({
|
||||
const Legend = styled.div(props => ({
|
||||
color: colors.dark50,
|
||||
marginLeft: 20,
|
||||
'&::before': {
|
||||
@@ -98,7 +98,7 @@ class NodeLabel extends PureComponent<Props, State> {
|
||||
collapsed: false,
|
||||
};
|
||||
|
||||
showNodeData = (e) => {
|
||||
showNodeData = e => {
|
||||
e.stopPropagation();
|
||||
this.props.onLabelClicked(this.props?.nodeData);
|
||||
};
|
||||
@@ -136,7 +136,7 @@ class NodeLabel extends PureComponent<Props, State> {
|
||||
|
||||
export default class extends PureComponent<Props, State> {
|
||||
treeFromFlatArray = (data: TreeData) => {
|
||||
const tree = data.map((n) => {
|
||||
const tree = data.map(n => {
|
||||
let fill = colors.blueGreyTint70;
|
||||
if (n.didTriggerStateUpdate) {
|
||||
fill = colors.lemon;
|
||||
@@ -184,12 +184,12 @@ export default class extends PureComponent<Props, State> {
|
||||
}
|
||||
}, new Map());
|
||||
|
||||
tree.forEach((n) => {
|
||||
tree.forEach(n => {
|
||||
n.children = parentMap.get(n.attributes.identifier) || [];
|
||||
});
|
||||
|
||||
// find the root node
|
||||
return tree.find((node) => !node.attributes.parent);
|
||||
return tree.find(node => !node.attributes.parent);
|
||||
};
|
||||
|
||||
treeFromHierarchy = (data: SectionComponentHierarchy): Object => {
|
||||
@@ -244,7 +244,7 @@ export default class extends PureComponent<Props, State> {
|
||||
return (
|
||||
<Fragment>
|
||||
<Container
|
||||
innerRef={(ref) => {
|
||||
innerRef={ref => {
|
||||
this.treeContainer = ref;
|
||||
}}>
|
||||
<style>
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
DetailSidebar,
|
||||
} from 'flipper';
|
||||
|
||||
const Waiting = styled(FlexBox)((props) => ({
|
||||
const Waiting = styled(FlexBox)(props => ({
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
flexGrow: 1,
|
||||
@@ -45,14 +45,14 @@ const Waiting = styled(FlexBox)((props) => ({
|
||||
textAlign: 'center',
|
||||
}));
|
||||
|
||||
const InfoText = styled.div((props) => ({
|
||||
const InfoText = styled.div(props => ({
|
||||
marginTop: 10,
|
||||
marginBottom: 10,
|
||||
fontWeight: '500',
|
||||
color: colors.light30,
|
||||
}));
|
||||
|
||||
const InfoBox = styled.div((props) => ({
|
||||
const InfoBox = styled.div(props => ({
|
||||
maxWidth: 400,
|
||||
margin: 'auto',
|
||||
textAlign: 'center',
|
||||
|
||||
Reference in New Issue
Block a user