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", "flow-bin": "^0.86.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"jest-fetch-mock": "^1.6.5", "jest-fetch-mock": "^1.6.5",
"prettier": "^1.13.4", "prettier": "^1.18.2",
"raf": "3.4.0", "raf": "3.4.0",
"react-dev-utils": "^5.0.0", "react-dev-utils": "^5.0.0",
"static-site-generator-webpack-plugin": "^3.4.1", "static-site-generator-webpack-plugin": "^3.4.1",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -107,10 +107,10 @@ export function PaddingRow(props: {|+backgroundColor: string|}) {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
/* To apply 'hoverHighlight', provide a backgroundImage containing two <image> /* To apply 'hoverHighlight', provide a backgroundImage containing two <image>
* data types (eg linear gradients). The first backgroundImage will be * data types (eg linear gradients). The first backgroundImage will be
* the default background. The second backgroundImage will be applied on top * the default background. The second backgroundImage will be applied on top
* of the first background when the user hovers or tabs over the element. * of the first background when the user hovers or tabs over the element.
*/ */
hoverHighlight: { hoverHighlight: {
backgroundSize: "100% 100%, 0 0", 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. * Returns a promise that resolves to `true` if any changes were made.
*/ */
async _updateStep( async _updateStep(
postQuery: ({+body: Queries.Body, +variables: {+[string]: any}}) => Promise< postQuery: ({
any +body: Queries.Body,
>, +variables: {+[string]: any},
}) => Promise<any>,
options: {| options: {|
+nodesLimit: number, +nodesLimit: number,
+nodesOfTypeLimit: number, +nodesOfTypeLimit: number,
@ -791,9 +792,10 @@ export class Mirror {
* See: `extract`. * See: `extract`.
*/ */
async update( async update(
postQuery: ({+body: Queries.Body, +variables: {+[string]: any}}) => Promise< postQuery: ({
any +body: Queries.Body,
>, +variables: {+[string]: any},
}) => Promise<any>,
options: {| options: {|
+nodesLimit: number, +nodesLimit: number,
+nodesOfTypeLimit: number, +nodesOfTypeLimit: number,
@ -1333,8 +1335,7 @@ export class Mirror {
const nestValue: const nestValue:
| PrimitiveResult | PrimitiveResult
| NodeFieldResult | NodeFieldResult
| NestedFieldResult = | NestedFieldResult = entry[nestFieldname];
entry[nestFieldname];
const topLevelNested: NestedFieldResult = (nestValue: any); const topLevelNested: NestedFieldResult = (nestValue: any);
if (topLevelNested === undefined) { if (topLevelNested === undefined) {
const s = JSON.stringify; const s = JSON.stringify;
@ -1409,8 +1410,7 @@ export class Mirror {
const nestValue: const nestValue:
| PrimitiveResult | PrimitiveResult
| NodeFieldResult | NodeFieldResult
| NestedFieldResult = | NestedFieldResult = entry[nestFieldname];
entry[nestFieldname];
const topLevelNested: NestedFieldResult = (nestValue: any); const topLevelNested: NestedFieldResult = (nestValue: any);
// No need for an extra safety check that this is present: we // No need for an extra safety check that this is present: we
// handled that while covering primitive fields. // handled that while covering primitive fields.

View File

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

View File

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

View File

@ -192,10 +192,12 @@ module.exports = async function execDependencyGraph(
} }
printSection("Overview"); printSection("Overview");
const failedTasks = tasks.map((t) => t.id).filter((id) => { const failedTasks = tasks
const result = completedTasks.get(id); .map((t) => t.id)
return !result || !result.success; .filter((id) => {
}); const result = completedTasks.get(id);
return !result || !result.success;
});
if (failedTasks.length > 0) { if (failedTasks.length > 0) {
console.log("Failed tasks:"); console.log("Failed tasks:");
failedTasks.forEach((line) => { 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" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier@^1.13.4: prettier@^1.18.2:
version "1.13.4" version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.4.tgz#31bbae6990f13b1093187c731766a14036fa72e6" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-emsEZ2bAigL1lq6ssgkpPm1MIBqgeTvcp90NxOP5XDqprub/V/WS2Hfgih3mS7/1dqTUvhG+sxx1Dv8crnVexA== integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
pretty-format@^23.6.0: pretty-format@^23.6.0:
version "23.6.0" version "23.6.0"