prettier 2

Summary:
Quick notes:

- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.

Close https://github.com/facebook/flipper/pull/915

Reviewed By: jknoxville

Differential Revision: D20594929

fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
This commit is contained in:
Pascal Hartig
2020-03-24 09:34:39 -07:00
committed by Facebook GitHub Bot
parent d9d3be33b4
commit fc9ed65762
204 changed files with 877 additions and 864 deletions

View File

@@ -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,24 +78,22 @@ 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);
}

View File

@@ -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,
}))}
@@ -401,8 +401,9 @@ class PageInfo extends Component<
<Text>
{this.props.count === this.props.totalRows
? `${this.props.count} `
: `${this.props.currentRow + 1}-${this.props.currentRow +
this.props.count} `}
: `${this.props.currentRow + 1}-${
this.props.currentRow + this.props.count
} `}
of {this.props.totalRows} rows
</Text>
<div style={{flex: 1}} />
@@ -685,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,
@@ -708,7 +709,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
});
}
})
.catch(e => {
.catch((e) => {
this.setState({error: e});
});
}
@@ -863,7 +864,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
table: table,
start: newState.pageRowNumber,
})
.then(data => {
.then((data) => {
this.dispatchAction({
type: 'UpdatePage',
databaseId: databaseId,
@@ -875,7 +876,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
total: data.total,
});
})
.catch(e => {
.catch((e) => {
this.setState({error: e});
});
}
@@ -890,7 +891,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
databaseId: databaseId,
table: table,
})
.then(data => {
.then((data) => {
this.dispatchAction({
type: 'UpdateStructure',
databaseId: databaseId,
@@ -901,7 +902,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
indexesValues: data.indexesValues,
});
})
.catch(e => {
.catch((e) => {
this.setState({error: e});
});
}
@@ -916,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,
@@ -939,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,
@@ -986,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',
@@ -1163,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,
}))}
@@ -1174,7 +1175,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
zebra={true}
rows={rows}
horizontallyScrollable={true}
onRowHighlighted={highlightedRows => {
onRowHighlighted={(highlightedRows) => {
this.setState({
queryResult: {
table: {
@@ -1266,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;
@@ -1292,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;
@@ -1342,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({