Skip to content

Commit

Permalink
Format + remove debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed May 11, 2017
1 parent c65c2d9 commit 48e2735
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 85 deletions.
28 changes: 14 additions & 14 deletions examples/client-only-paths/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class AnimationExample extends React.Component {

const NavLink = props => (
<li style={styles.navItem}>
<Link {...props} style={{ color: "inherit" }} />
<Link {...props} style={{ color: `inherit` }} />
</li>
)

Expand All @@ -74,7 +74,7 @@ const HSL = ({ match: { params } }) => (
const styles = {}

styles.fill = {
position: "absolute",
position: `absolute`,
left: 0,
right: 0,
top: 0,
Expand All @@ -83,32 +83,32 @@ styles.fill = {

styles.content = {
...styles.fill,
top: "40px",
textAlign: "center",
top: `40px`,
textAlign: `center`,
}

styles.nav = {
padding: 0,
margin: 0,
position: "absolute",
position: `absolute`,
top: 0,
height: "40px",
width: "100%",
display: "flex",
height: `40px`,
width: `100%`,
display: `flex`,
}

styles.navItem = {
textAlign: "center",
textAlign: `center`,
flex: 1,
listStyleType: "none",
padding: "10px",
listStyleType: `none`,
padding: `10px`,
}

styles.hsl = {
...styles.fill,
color: "white",
paddingTop: "20px",
fontSize: "30px",
color: `white`,
paddingTop: `20px`,
fontSize: `30px`,
}

export default AnimationExample
4 changes: 0 additions & 4 deletions examples/gatsbygram/src/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ class GatsbyGramModal extends React.Component {
}

render() {
console.log(this.props)
console.log(`context`, this.context)
return (
<Modal
isOpen={this.props.isOpen}
Expand Down Expand Up @@ -132,8 +130,6 @@ class GatsbyGramModal extends React.Component {
}}
onClick={e => this.previous(e)}
/>
{console.log(`rendering modal`)}
{console.log(this.props.children)}
{this.props.children({
location: { pathname: this.props.location.pathname },
})}
Expand Down
1 change: 0 additions & 1 deletion examples/gatsbygram/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class Index extends React.Component {
}

render() {
console.log(this.props)
let { allPostsJson, user } = this.props.data

const posts = allPostsJson.edges.map(e => e.node)
Expand Down
1 change: 0 additions & 1 deletion examples/gatsbygram/src/templates/post-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class PostTemplate extends React.Component {
}),
}
render() {
console.log(`template-post-page`, this.props)
return (
// PostDetail is used for this detail page and
// also in the modal.
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby-link/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class GatsbyLink extends React.Component {
window.location.protocol !== `https:`)
) {
requestUserIdle(() => {
console.log(`the user is idle`)
___loadScriptsForPath(this.props.to)
})
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from 'crypto'
import parseMetadata from './parse'
import crypto from "crypto"
import parseMetadata from "./parse"

const digest = str => crypto.createHash(`md5`).update(str).digest(`hex`)

Expand Down
12 changes: 6 additions & 6 deletions packages/gatsby-transformer-react-docgen/src/parse.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'path'
import path from "path"

import * as types from 'babel-types'
import { parse, defaultHandlers } from 'react-docgen'
import { ERROR_MISSING_DEFINITION } from 'react-docgen/dist/parse'
import * as types from "babel-types"
import { parse, defaultHandlers } from "react-docgen"
import { ERROR_MISSING_DEFINITION } from "react-docgen/dist/parse"
import findAllComponentDefinitions
from 'react-docgen/dist/resolver/findAllComponentDefinitions'
from "react-docgen/dist/resolver/findAllComponentDefinitions"

import { parseDoclets, applyPropDoclets } from './Doclets'
import { parseDoclets, applyPropDoclets } from "./Doclets"

function getAssignedIdenifier(path) {
let property = path.parentPath
Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby/src/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ data
let browserAPIRunner = ``

try {
browserAPIRunner = fs.readFileSync(`${siteDir}/api-runner-browser.js`, `utf-8`)
browserAPIRunner = fs.readFileSync(
`${siteDir}/api-runner-browser.js`,
`utf-8`
)
} catch (err) {
console.error(`Failed to read ${siteDir}/api-runner-browser.js`)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/cache-dir/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import apiRunner from "./api-runner-browser"
import syncRequires from "./sync-requires"
import pages from "./pages.json"

console.log("pages", pages)
console.log(`pages`, pages)

const history = createHistory()
history.listen((location, action) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/build-node-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { nodeInterface } = require(`./node-interface`)
const { getNodes, getNode, getNodeAndSavePathDependency } = require(`../redux`)
const { addPageDependency } = require(`../redux/actions/add-page-dependency`)

import type { ProcessedNodeType } from './infer-graphql-type'
import type { ProcessedNodeType } from "./infer-graphql-type"

type TypeMap = { [typeName: string]: ProcessedNodeType }

Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/infer-graphql-input-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
import type {
GraphQLInputFieldConfig,
GraphQLInputFieldConfigMap,
} from 'graphql/type/definition'
} from "graphql/type/definition"

function typeFields(type): GraphQLInputFieldConfigMap {
switch (type) {
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/src/schema/infer-graphql-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const {
isEmptyObjectOrArray,
} = require(`./data-tree-utils`)

import type { GraphQLOutputType } from 'graphql'
import type { GraphQLOutputType } from "graphql"
import type {
GraphQLFieldConfig,
GraphQLFieldConfigMap,
} from 'graphql/type/definition'
} from "graphql/type/definition"

export type ProcessedNodeType = {
name: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/node-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
GraphQLID,
GraphQLList,
GraphQLInterfaceType,
} from 'graphql'
} from "graphql"

export const nodeInterface = new GraphQLInterfaceType({
name: `Node`,
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby/src/schema/site-schema.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import { GraphQLObjectType, GraphQLString } from 'graphql'
import moment from 'moment'
import { GraphQLObjectType, GraphQLString } from "graphql"
import moment from "moment"

import { inferObjectStructureFromNodes } from './infer-graphql-type'
import { inferObjectStructureFromNodes } from "./infer-graphql-type"
const { store } = require(`../redux`)

module.exports = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {
connectionFromArray,
connectionFromPromisedArray,
} from '../arrayconnection'
} from "../arrayconnection"

describe(`connectionFromArray()`, () => {
const letters = [`A`, `B`, `C`, `D`, `E`]
Expand Down Expand Up @@ -105,10 +105,7 @@ describe(`connectionFromArray()`, () => {

describe(`pagination`, () => {
it(`respects limit and skip`, () => {
const c = connectionFromArray(
letters,
{ limit: 2, skip: 2 }
)
const c = connectionFromArray(letters, { limit: 2, skip: 2 })
return expect(c).toEqual({
edges: [
{
Expand All @@ -129,10 +126,7 @@ describe(`connectionFromArray()`, () => {
})

it(`respects limit and skip with large skip`, () => {
const c = connectionFromArray(
letters,
{ limit: 10, skip: 2 }
)
const c = connectionFromArray(letters, { limit: 10, skip: 2 })
return expect(c).toEqual({
edges: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@ import {
GraphQLSchema,
GraphQLString,
graphql,
} from 'graphql'
} from "graphql"

import {
connectionFromArray,
} from '../arrayconnection.js'
import { connectionFromArray } from "../arrayconnection.js"

import {
connectionArgs,
connectionDefinitions,
} from '../connection.js'
import { connectionArgs, connectionDefinitions } from "../connection.js"

const allUsers = [
{ name: `Dan`, friends: [1, 2, 3, 4] },
Expand Down
17 changes: 7 additions & 10 deletions packages/graphql-skip-limit/src/connection/arrayconnection.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/* @flow */

import type {
Connection,
ConnectionArguments,
} from './connectiontypes'
import type { Connection, ConnectionArguments } from "./connectiontypes"

/**
* A simple function that accepts an array and connection arguments, and returns
* a connection object for use in GraphQL. It uses array offsets as pagination,
* so pagination will only work if the array is static.
*/
export function connectionFromArray<T> (
export function connectionFromArray<T>(
data: Array<T>,
args: ConnectionArguments
): Connection<T> {
Expand All @@ -30,7 +27,7 @@ export function connectionFromArray<T> (
throw new Error(`Argument "limit" must be a non-negative integer`)
}

endSlice = (startSlice + limit)
endSlice = startSlice + limit
}

const slice = data.slice(startSlice, endSlice)
Expand All @@ -51,12 +48,12 @@ export function connectionFromArray<T> (
}
})


return {
edges,
pageInfo: {
hasNextPage:
typeof limit === `number` ? (limit + startSlice) - 1 < data.length : false,
hasNextPage: typeof limit === `number`
? limit + startSlice - 1 < data.length
: false,
},
}
}
Expand All @@ -65,7 +62,7 @@ export function connectionFromArray<T> (
* A version of `connectionFromArray` that takes a promised array, and returns a
* promised connection.
*/
export function connectionFromPromisedArray<T> (
export function connectionFromPromisedArray<T>(
dataPromise: Promise<Array<T>>,
args: ConnectionArguments
): Promise<Connection<T>> {
Expand Down
14 changes: 7 additions & 7 deletions packages/graphql-skip-limit/src/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
GraphQLNonNull,
GraphQLList,
GraphQLObjectType,
} from 'graphql'
} from "graphql"

import type {
GraphQLFieldConfigArgumentMap,
GraphQLFieldConfigMap,
GraphQLFieldResolver,
Thunk,
} from 'graphql'
} from "graphql"

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
Expand All @@ -34,12 +34,12 @@ type ConnectionConfig = {
resolveNode?: ?GraphQLFieldResolver<*, *>,
edgeFields?: ?Thunk<GraphQLFieldConfigMap<*, *>>,
connectionFields?: ?Thunk<GraphQLFieldConfigMap<*, *>>,
};
}

type GraphQLConnectionDefinitions = {
edgeType: GraphQLObjectType,
connectionType: GraphQLObjectType
};
connectionType: GraphQLObjectType,
}

/**
* The common page info type used by all connections.
Expand All @@ -55,15 +55,15 @@ const pageInfoType = new GraphQLObjectType({
}),
})

function resolveMaybeThunk<T> (thingOrThunk: Thunk<T>): T {
function resolveMaybeThunk<T>(thingOrThunk: Thunk<T>): T {
return typeof thingOrThunk === `function` ? thingOrThunk() : thingOrThunk
}

/**
* Returns a GraphQLObjectType for a connection with the given name,
* and whose nodes are of the specified type.
*/
export function connectionDefinitions (
export function connectionDefinitions(
config: ConnectionConfig
): GraphQLConnectionDefinitions {
const { nodeType } = config
Expand Down
Loading

0 comments on commit 48e2735

Please sign in to comment.