From 6a13248b091592be66d9e553c75ad41b2de3d377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Thu, 4 Jul 2019 18:31:11 +0100 Subject: [PATCH] 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. --- package.json | 2 +- src/analysis/pagerankNodeDecomposition.js | 14 ++++++------- src/cli/pagerank.js | 4 +--- src/core/graph.js | 4 +--- src/explorer/adapters/explorerAdapter.js | 2 +- src/explorer/pagerankTable/Aggregation.js | 4 +--- src/explorer/pagerankTable/Connection.js | 24 ++++++++++------------- src/explorer/pagerankTable/TableRow.js | 8 ++++---- src/graphql/mirror.js | 20 +++++++++---------- src/graphql/mirror.test.js | 5 ++--- src/homepage/HomePage.js | 23 +++++++++++----------- src/tools/execDependencyGraph.js | 10 ++++++---- yarn.lock | 8 ++++---- 13 files changed, 58 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 85f13b6..fc9a4e4 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/analysis/pagerankNodeDecomposition.js b/src/analysis/pagerankNodeDecomposition.js index a60b782..11fab91 100644 --- a/src/analysis/pagerankNodeDecomposition.js +++ b/src/analysis/pagerankNodeDecomposition.js @@ -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) => { diff --git a/src/cli/pagerank.js b/src/cli/pagerank.js index c64dfc2..bb2dafb 100644 --- a/src/cli/pagerank.js +++ b/src/cli/pagerank.js @@ -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; } diff --git a/src/core/graph.js b/src/core/graph.js index 3acd6bd..6f80359 100644 --- a/src/core/graph.js +++ b/src/core/graph.js @@ -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}}`; } /** diff --git a/src/explorer/adapters/explorerAdapter.js b/src/explorer/adapters/explorerAdapter.js index 68f45b0..cbd6dfb 100644 --- a/src/explorer/adapters/explorerAdapter.js +++ b/src/explorer/adapters/explorerAdapter.js @@ -14,5 +14,5 @@ export interface StaticExplorerAdapter { export interface DynamicExplorerAdapter { graph(): Graph; nodeDescription(NodeAddressT): ReactNode; - static (): StaticExplorerAdapter; + static(): StaticExplorerAdapter; } diff --git a/src/explorer/pagerankTable/Aggregation.js b/src/explorer/pagerankTable/Aggregation.js index 159cde0..b9e46ef 100644 --- a/src/explorer/pagerankTable/Aggregation.js +++ b/src/explorer/pagerankTable/Aggregation.js @@ -17,9 +17,7 @@ type AggregationRowListProps = {| +sharedProps: SharedProps, |}; -export class AggregationRowList extends React.PureComponent< - AggregationRowListProps -> { +export class AggregationRowList extends React.PureComponent { render() { const {depth, node, sharedProps} = this.props; const {pnd, adapters} = sharedProps; diff --git a/src/explorer/pagerankTable/Connection.js b/src/explorer/pagerankTable/Connection.js index 0112322..4c8b2ae 100644 --- a/src/explorer/pagerankTable/Connection.js +++ b/src/explorer/pagerankTable/Connection.js @@ -19,25 +19,21 @@ type ConnectionRowListProps = {| +connections: $ReadOnlyArray, |}; -export class ConnectionRowList extends React.PureComponent< - ConnectionRowListProps -> { +export class ConnectionRowList extends React.PureComponent { render() { const {depth, node, sharedProps, connections} = this.props; const {maxEntriesPerList} = sharedProps; return ( - {connections - .slice(0, maxEntriesPerList) - .map((sc) => ( - - ))} + {connections.slice(0, maxEntriesPerList).map((sc) => ( + + ))} ); } diff --git a/src/explorer/pagerankTable/TableRow.js b/src/explorer/pagerankTable/TableRow.js index 1a34cbe..ff22b5b 100644 --- a/src/explorer/pagerankTable/TableRow.js +++ b/src/explorer/pagerankTable/TableRow.js @@ -107,10 +107,10 @@ export function PaddingRow(props: {|+backgroundColor: string|}) { const styles = StyleSheet.create({ /* To apply 'hoverHighlight', provide a backgroundImage containing two - * 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", diff --git a/src/graphql/mirror.js b/src/graphql/mirror.js index 4c2609b..a63e02c 100644 --- a/src/graphql/mirror.js +++ b/src/graphql/mirror.js @@ -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, 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, 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. diff --git a/src/graphql/mirror.test.js b/src/graphql/mirror.test.js index a41c76a..9f4cb7b 100644 --- a/src/graphql/mirror.test.js +++ b/src/graphql/mirror.test.js @@ -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 = () => diff --git a/src/homepage/HomePage.js b/src/homepage/HomePage.js index dd68f3c..204aecf 100644 --- a/src/homepage/HomePage.js +++ b/src/homepage/HomePage.js @@ -37,11 +37,13 @@ export default class HomePage extends React.Component<{|+assets: Assets|}> { chronically underfunded. For example, NumPy{" "} received no funding at all until 2017 - , and{" "} + + , and{" "} a world where OpenSSL was funded might have been a world without Heartbleed - . + + .

@@ -107,16 +109,13 @@ export default class HomePage extends React.Component<{|+assets: Assets|}> {

How cred works

Cred is computed by first creating a contribution{" "} - graph - , 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 - PageRank - {" "} - on that graph to produce a cred attribution. The attribution is highly - configurable; project maintainers can add new heuristics and adjust - weights. + graph, 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{" "} + PageRank on that graph to produce a + cred attribution. The attribution is highly configurable; project + maintainers can add new heuristics and adjust weights.

diff --git a/src/tools/execDependencyGraph.js b/src/tools/execDependencyGraph.js index 934dba8..d502340 100644 --- a/src/tools/execDependencyGraph.js +++ b/src/tools/execDependencyGraph.js @@ -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) => { diff --git a/yarn.lock b/yarn.lock index 6127bd2..c06b5fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"