Upgrade prettier

This commit updates our prettier version from `1.13` to `1.18`. Looks
like software does get better over time! I like all of the changes.

Test plan: `yarn test` passes. I've manually inspected the diffs.
This commit is contained in:
Dandelion Mané 2019-07-04 18:31:11 +01:00
parent 29c9229c28
commit 6a13248b09
13 changed files with 58 additions and 70 deletions

View File

@ -55,7 +55,7 @@
"flow-bin": "^0.86.0",
"jest": "^23.6.0",
"jest-fetch-mock": "^1.6.5",
"prettier": "^1.13.4",
"prettier": "^1.18.2",
"raf": "3.4.0",
"react-dev-utils": "^5.0.0",
"static-site-generator-webpack-plugin": "^3.4.1",

View File

@ -35,14 +35,12 @@ export function decompose(
return MapUtil.mapValues(connections, (target, connections) => {
const score = NullUtil.get(pr.get(target));
const scoredConnections = sortBy(
connections.map(
(connection): ScoredConnection => {
const source = adjacencySource(target, connection.adjacency);
const sourceScore = NullUtil.get(pr.get(source));
const connectionScore = connection.weight * sourceScore;
return {connection, source, connectionScore};
}
),
connections.map((connection): ScoredConnection => {
const source = adjacencySource(target, connection.adjacency);
const sourceScore = NullUtil.get(pr.get(source));
const connectionScore = connection.weight * sourceScore;
return {connection, source, connectionScore};
}),
(x) => -x.connectionScore,
(x) => x.connection.adjacency.type,
(x) => {

View File

@ -119,9 +119,7 @@ export function makePagerankCommand(
}
case "PLUGIN_FAILURE": {
std.err(
`fatal: plugin "${result.pluginName}" errored: ${
result.error.message
}`
`fatal: plugin "${result.pluginName}" errored: ${result.error.message}`
);
return 1;
}

View File

@ -1082,9 +1082,7 @@ export function edgeToString(edge: Edge): string {
const address = EdgeAddress.toString(edge.address);
const src = NodeAddress.toString(edge.src);
const dst = NodeAddress.toString(edge.dst);
return `{address: ${address}, src: ${src}, dst: ${dst}, timestampMs: ${
edge.timestampMs
}}`;
return `{address: ${address}, src: ${src}, dst: ${dst}, timestampMs: ${edge.timestampMs}}`;
}
/**

View File

@ -14,5 +14,5 @@ export interface StaticExplorerAdapter {
export interface DynamicExplorerAdapter {
graph(): Graph;
nodeDescription(NodeAddressT): ReactNode;
static (): StaticExplorerAdapter;
static(): StaticExplorerAdapter;
}

View File

@ -17,9 +17,7 @@ type AggregationRowListProps = {|
+sharedProps: SharedProps,
|};
export class AggregationRowList extends React.PureComponent<
AggregationRowListProps
> {
export class AggregationRowList extends React.PureComponent<AggregationRowListProps> {
render() {
const {depth, node, sharedProps} = this.props;
const {pnd, adapters} = sharedProps;

View File

@ -19,25 +19,21 @@ type ConnectionRowListProps = {|
+connections: $ReadOnlyArray<ScoredConnection>,
|};
export class ConnectionRowList extends React.PureComponent<
ConnectionRowListProps
> {
export class ConnectionRowList extends React.PureComponent<ConnectionRowListProps> {
render() {
const {depth, node, sharedProps, connections} = this.props;
const {maxEntriesPerList} = sharedProps;
return (
<React.Fragment>
{connections
.slice(0, maxEntriesPerList)
.map((sc) => (
<ConnectionRow
key={JSON.stringify(sc.connection.adjacency)}
depth={depth}
target={node}
scoredConnection={sc}
sharedProps={sharedProps}
/>
))}
{connections.slice(0, maxEntriesPerList).map((sc) => (
<ConnectionRow
key={JSON.stringify(sc.connection.adjacency)}
depth={depth}
target={node}
scoredConnection={sc}
sharedProps={sharedProps}
/>
))}
</React.Fragment>
);
}

View File

@ -107,10 +107,10 @@ export function PaddingRow(props: {|+backgroundColor: string|}) {
const styles = StyleSheet.create({
/* To apply 'hoverHighlight', provide a backgroundImage containing two <image>
* data types (eg linear gradients). The first backgroundImage will be
* the default background. The second backgroundImage will be applied on top
* of the first background when the user hovers or tabs over the element.
*/
* data types (eg linear gradients). The first backgroundImage will be
* the default background. The second backgroundImage will be applied on top
* of the first background when the user hovers or tabs over the element.
*/
hoverHighlight: {
backgroundSize: "100% 100%, 0 0",

View File

@ -728,9 +728,10 @@ export class Mirror {
* Returns a promise that resolves to `true` if any changes were made.
*/
async _updateStep(
postQuery: ({+body: Queries.Body, +variables: {+[string]: any}}) => Promise<
any
>,
postQuery: ({
+body: Queries.Body,
+variables: {+[string]: any},
}) => Promise<any>,
options: {|
+nodesLimit: number,
+nodesOfTypeLimit: number,
@ -791,9 +792,10 @@ export class Mirror {
* See: `extract`.
*/
async update(
postQuery: ({+body: Queries.Body, +variables: {+[string]: any}}) => Promise<
any
>,
postQuery: ({
+body: Queries.Body,
+variables: {+[string]: any},
}) => Promise<any>,
options: {|
+nodesLimit: number,
+nodesOfTypeLimit: number,
@ -1333,8 +1335,7 @@ export class Mirror {
const nestValue:
| PrimitiveResult
| NodeFieldResult
| NestedFieldResult =
entry[nestFieldname];
| NestedFieldResult = entry[nestFieldname];
const topLevelNested: NestedFieldResult = (nestValue: any);
if (topLevelNested === undefined) {
const s = JSON.stringify;
@ -1409,8 +1410,7 @@ export class Mirror {
const nestValue:
| PrimitiveResult
| NodeFieldResult
| NestedFieldResult =
entry[nestFieldname];
| NestedFieldResult = entry[nestFieldname];
const topLevelNested: NestedFieldResult = (nestValue: any);
// No need for an extra safety check that this is present: we
// handled that while covering primitive fields.

View File

@ -1529,9 +1529,8 @@ describe("graphql/mirror", () => {
hasNextPage: options.hasNextPage,
endCursor: options.endCursor,
},
nodes: options.comments.map(
(n) =>
n === null ? null : {__typename: "IssueComment", id: `comment:${n}`}
nodes: options.comments.map((n) =>
n === null ? null : {__typename: "IssueComment", id: `comment:${n}`}
),
});
const createEmptyResponse = () =>

View File

@ -37,11 +37,13 @@ export default class HomePage extends React.Component<{|+assets: Assets|}> {
chronically underfunded. For example, NumPy{" "}
<Link href={urls.numpyFunding}>
received no funding at all until 2017
</Link>, and{" "}
</Link>
, and{" "}
<Link href={urls.opensslFunding}>
a world where OpenSSL was funded might have been a world without
Heartbleed
</Link>.
</Link>
.
</p>
<p>
@ -107,16 +109,13 @@ export default class HomePage extends React.Component<{|+assets: Assets|}> {
<h2>How cred works</h2>
<p>
Cred is computed by first creating a contribution{" "}
<Link href={urls.graph}>graph</Link>
, which contains every contribution to the project and the relations
among them. For example, GitHub issues, Git commits, and individual
files and functions can be included in the graph. Then, SourceCred
runs a modified version of <Link href={urls.pagerank}>
PageRank
</Link>{" "}
on that graph to produce a cred attribution. The attribution is highly
configurable; project maintainers can add new heuristics and adjust
weights.
<Link href={urls.graph}>graph</Link>, which contains every
contribution to the project and the relations among them. For example,
GitHub issues, Git commits, and individual files and functions can be
included in the graph. Then, SourceCred runs a modified version of{" "}
<Link href={urls.pagerank}>PageRank</Link> on that graph to produce a
cred attribution. The attribution is highly configurable; project
maintainers can add new heuristics and adjust weights.
</p>
<p>

View File

@ -192,10 +192,12 @@ module.exports = async function execDependencyGraph(
}
printSection("Overview");
const failedTasks = tasks.map((t) => t.id).filter((id) => {
const result = completedTasks.get(id);
return !result || !result.success;
});
const failedTasks = tasks
.map((t) => t.id)
.filter((id) => {
const result = completedTasks.get(id);
return !result || !result.success;
});
if (failedTasks.length > 0) {
console.log("Failed tasks:");
failedTasks.forEach((line) => {

View File

@ -6914,10 +6914,10 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier@^1.13.4:
version "1.13.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.4.tgz#31bbae6990f13b1093187c731766a14036fa72e6"
integrity sha512-emsEZ2bAigL1lq6ssgkpPm1MIBqgeTvcp90NxOP5XDqprub/V/WS2Hfgih3mS7/1dqTUvhG+sxx1Dv8crnVexA==
prettier@^1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
pretty-format@^23.6.0:
version "23.6.0"