Skip to content

Commit

Permalink
Update flow, remove dead code (#760)
Browse files Browse the repository at this point in the history
* Update flow, remove dead code

* fix fix-semi

* Update to latest canary
  • Loading branch information
KyleAMathews committed Mar 27, 2017
1 parent ab76608 commit 7ea9ebb
Show file tree
Hide file tree
Showing 35 changed files with 322 additions and 1,217 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
}],
'react',
'flow',
],
"plugins": [
"transform-runtime",
Expand Down
22 changes: 3 additions & 19 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
[version]
0.32.0
0.42.0

[ignore]
.*/test/.*
.*/node_modules/typography/.*
.*/node_modules/fbjs/.*
.*/node_modules/react-side-effect/.*

[include]

[libs]
./interfaces/
decls/
node_modules/iflow-debug/index.js.flow
node_modules/iflow-lodash/index.js.flow
node_modules/iflow-react-router/index.js.flow

[options]
esproposal.class_instance_fields=enable
esproposal.class_static_fields=enable

strip_root=true

suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
.*/www/.*
.*/examples/.*
24 changes: 12 additions & 12 deletions examples/gatsbygram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"gatsby": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-link": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-parser-json": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-parser-sharp": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-plugin-glamor": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-plugin-google-analytics": "^1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-plugin-manifest": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-plugin-offline": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-plugin-sharp": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-source-filesystem": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-typegen-filesystem": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby-typegen-sharp": "1.0.0-alpha12-alpha.6e55cfe7",
"gatsby": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-link": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-parser-json": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-parser-sharp": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-plugin-glamor": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-plugin-google-analytics": "^1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-plugin-manifest": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-plugin-offline": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-plugin-sharp": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-source-filesystem": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-typegen-filesystem": "1.0.0-alpha12-alpha.d7d6ef64",
"gatsby-typegen-sharp": "1.0.0-alpha12-alpha.d7d6ef64",
"instagram-screen-scrape": "^2.0.0",
"lodash": "^4.16.4",
"mkdirp": "^0.5.1",
Expand Down
72 changes: 36 additions & 36 deletions examples/gatsbygram/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2844,55 +2844,55 @@ function-bind@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"

gatsby-link@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-1.0.0-alpha12-alpha.6e55cfe7.tgz#24338d4c566dc707660e045c4f740e40675dff29"
gatsby-link@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-1.0.0-alpha12-alpha.d7d6ef64.tgz#d32c70f223038652bc156962b082c34560e6b3cd"

gatsby-parser-json@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-parser-json/-/gatsby-parser-json-1.0.0-alpha12-alpha.6e55cfe7.tgz#0c7ca08dc6057ab78707ad8f7dba61ed727553df"
gatsby-parser-json@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-parser-json/-/gatsby-parser-json-1.0.0-alpha12-alpha.d7d6ef64.tgz#361d0072f393daea609d2669c50c1b12bccb2844"
dependencies:
bluebird "^3.4.6"
unist-util-select "^1.5.0"

gatsby-parser-sharp@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-parser-sharp/-/gatsby-parser-sharp-1.0.0-alpha12-alpha.6e55cfe7.tgz#02079d166816ad4960447214867a822dbefc9418"
gatsby-parser-sharp@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-parser-sharp/-/gatsby-parser-sharp-1.0.0-alpha12-alpha.d7d6ef64.tgz#6dd4f20eeb2b8d9e2bd92e9a371f7878f8565186"
dependencies:
bluebird "^3.4.6"
unist-util-select "^1.5.0"

gatsby-plugin-glamor@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-plugin-glamor/-/gatsby-plugin-glamor-1.0.0-alpha12-alpha.6e55cfe7.tgz#6190c680ba752d08c33aa964348be9038fab8c52"
gatsby-plugin-glamor@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-plugin-glamor/-/gatsby-plugin-glamor-1.0.0-alpha12-alpha.d7d6ef64.tgz#79a4eabb9b26b14fd854df25a6b2ff9dafdce68c"
dependencies:
babel-plugin-glamor "^3.0.0-1"
glamor next
glamor-inline "^1.0.5"
glamor-react "^3.0.0-1"
glamor-server next

gatsby-plugin-google-analytics@^1.0.0-alpha12-alpha.6e55cfe7:
gatsby-plugin-google-analytics@^1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.faff3fa9"
resolved "https://registry.yarnpkg.com/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-1.0.0-alpha12-alpha.faff3fa9.tgz#4f78c79607bfbea146b3c6d026dcb3a2073a2588"
dependencies:
react-ga "^2.1.2"

gatsby-plugin-manifest@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-plugin-manifest/-/gatsby-plugin-manifest-1.0.0-alpha12-alpha.6e55cfe7.tgz#8ff4f1694956443d5306ba3e1cd360dbe52e0d6c"
gatsby-plugin-manifest@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-plugin-manifest/-/gatsby-plugin-manifest-1.0.0-alpha12-alpha.d7d6ef64.tgz#1b68293739679911a3bd300185fd097564c6e53a"
dependencies:
bluebird "^3.4.7"

gatsby-plugin-offline@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-plugin-offline/-/gatsby-plugin-offline-1.0.0-alpha12-alpha.6e55cfe7.tgz#785da9f1b1141ea07f8eaa3df9827ce60b95fec6"
gatsby-plugin-offline@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-plugin-offline/-/gatsby-plugin-offline-1.0.0-alpha12-alpha.d7d6ef64.tgz#4e6f576decc44951bd7ae1499e0f284631f747b8"
dependencies:
sw-precache "^5.0.0"

gatsby-plugin-sharp@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-1.0.0-alpha12-alpha.6e55cfe7.tgz#e0ff59355b00c40ba29a802f4fdc93e55e1a1c45"
gatsby-plugin-sharp@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-1.0.0-alpha12-alpha.d7d6ef64.tgz#92ff3cd57abc619da8e81e190a2b028b556defaa"
dependencies:
async "^2.1.4"
bluebird "^3.4.7"
Expand All @@ -2905,9 +2905,9 @@ gatsby-plugin-sharp@1.0.0-alpha12-alpha.6e55cfe7:
queue "^4.0.1"
sharp "^0.17.1"

gatsby-source-filesystem@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-1.0.0-alpha12-alpha.6e55cfe7.tgz#65ed98f728eac57bf57f5109b3386daa9014d359"
gatsby-source-filesystem@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-1.0.0-alpha12-alpha.d7d6ef64.tgz#743abddf169b909c19f75c8e425db74970a3a09a"
dependencies:
async "^2.1.2"
babel-cli "^6.18.0"
Expand All @@ -2926,24 +2926,24 @@ gatsby-source-filesystem@1.0.0-alpha12-alpha.6e55cfe7:
slash "^1.0.0"
unist-builder "^1.0.2"

gatsby-typegen-filesystem@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-typegen-filesystem/-/gatsby-typegen-filesystem-1.0.0-alpha12-alpha.6e55cfe7.tgz#942446204bdc9852ba44e0ae413141d9ebd17aa2"
gatsby-typegen-filesystem@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-typegen-filesystem/-/gatsby-typegen-filesystem-1.0.0-alpha12-alpha.d7d6ef64.tgz#1d9e613e12ba287ae287fe8b95f22bc769ddb616"
dependencies:
unist-util-select "^1.5.0"

gatsby-typegen-sharp@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby-typegen-sharp/-/gatsby-typegen-sharp-1.0.0-alpha12-alpha.6e55cfe7.tgz#d044503fa6a85154c30b851f0c7ba911a889914d"
gatsby-typegen-sharp@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby-typegen-sharp/-/gatsby-typegen-sharp-1.0.0-alpha12-alpha.d7d6ef64.tgz#2a07e131cf763b0ae040cc0db986f83c8d0dfec7"
dependencies:
graphql "^0.8.2"
image-size "^0.5.1"
lodash "^4.17.2"
sharp "^0.17.0"

gatsby@1.0.0-alpha12-alpha.6e55cfe7:
version "1.0.0-alpha12-alpha.6e55cfe7"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.0.0-alpha12-alpha.6e55cfe7.tgz#e6ef16e4ad9161cafe3835c4d1a58baba561c0b2"
gatsby@1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.d7d6ef64"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.0.0-alpha12-alpha.d7d6ef64.tgz#34a9369bfdaded76caa0992ff5123bdce9835694"
dependencies:
async "^2.1.2"
babel-core "^6.18.2"
Expand Down Expand Up @@ -2980,7 +2980,7 @@ gatsby@1.0.0-alpha12-alpha.6e55cfe7:
glob "^7.1.0"
graphql "^0.8.2"
graphql-relay "^0.4.3"
graphql-skip-limit "^1.0.0-alpha12-alpha.6e55cfe7"
graphql-skip-limit "^1.0.0-alpha12-alpha.d7d6ef64"
graphql-union-input-type "^0.2.1"
gray-matter "^2.1.0"
hapi "^8.5.1"
Expand Down Expand Up @@ -3299,7 +3299,7 @@ graphql-relay@^0.4.3, graphql-relay@^0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/graphql-relay/-/graphql-relay-0.4.4.tgz#876a654445b6af4539f81cb9befd5cd7ead129dd"

graphql-skip-limit@^1.0.0-alpha12-alpha.6e55cfe7:
graphql-skip-limit@^1.0.0-alpha12-alpha.d7d6ef64:
version "1.0.0-alpha12-alpha.faff3fa9"
resolved "https://registry.yarnpkg.com/graphql-skip-limit/-/graphql-skip-limit-1.0.0-alpha12-alpha.faff3fa9.tgz#bcc4436d70c1e61807496e4084367bcb2c5c84ea"

Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"babel-cli": "^6.24.0",
"babel-eslint": "^7.1.0",
"babel-eslint": "^7.2.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-async-to-generator": "^6.22.0",
Expand All @@ -13,17 +13,17 @@
"babel-preset-stage-0": "^6.22.0",
"babel-register": "^6.24.0",
"babel-runtime": "^6.23.0",
"eslint": "^3.17.1",
"eslint": "^3.18.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-google": "^0.7.1",
"eslint-config-prettier": "^1.5.0",
"eslint-plugin-flow-vars": "^0.5.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-flowtype": "^2.30.4",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-react": "^6.10.0",
"flow-bin": "^0.41.0",
"eslint-plugin-react": "^6.10.3",
"flow-bin": "^0.42.0",
"iflow-debug": "^1.0.15",
"iflow-lodash": "^1.1.24",
"iflow-react-router": "^1.2.1",
Expand Down Expand Up @@ -54,7 +54,7 @@
"build": "lerna run build",
"lint": "eslint --ext .js,.jsx --ignore-path .gitignore .",
"lint:flow": "babel-node scripts/flow-check.js",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix packages/**/src/*.js packages/gatsby/lib/**/*.js www/*.js www/**/*.js examples/gatsbygram/*.js examples/gatsbygram/**/*.js",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix packages/**/src/**/*.js packages/**/src/*.js packages/gatsby/lib/**/*.js www/*.js www/**/*.js examples/gatsbygram/*.js examples/gatsbygram/**/*.js",
"format-packages": "prettier --trailing-comma es5 --write packages/**/src/*.js",
"format-gatsby": "prettier --trailing-comma es5 --write packages/gatsby/lib/**/*.js",
"format-www": "find www -iname *.js | grep -v node_modules | grep -v public | grep -v .intermediate-representation | xargs prettier --write --trailing-comma es5",
Expand All @@ -65,5 +65,8 @@
"test": "jest",
"test_bkup": "npm run lint && npm run test-node && npm run test-integration",
"watch": "lerna run watch"
},
"devDependencies": {
"babel-preset-flow": "^6.23.0"
}
}
15 changes: 0 additions & 15 deletions packages/gatsby/.babelrc

This file was deleted.

3 changes: 2 additions & 1 deletion packages/gatsby/lib/bootstrap/create-path.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow
import parsePath from "parse-filepath"
import path from "path"

module.exports = (basePath, filePath) => {
module.exports = (basePath: string, filePath: string): string => {
const relativePath = path.relative(basePath, filePath)
const parsedPath = parsePath(relativePath)
const { dirname } = parsedPath
Expand Down
15 changes: 4 additions & 11 deletions packages/gatsby/lib/bootstrap/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* @flow weak */
/* @flow */
import Promise from "bluebird"
import queryRunner from "../utils/query-runner"
import path from "path"
Expand Down Expand Up @@ -31,7 +31,7 @@ process.on(`unhandledRejection`, error => {
// algorithm is glob /pages directory for js/jsx/cjsx files *not*
// underscored. Then create url w/ our path algorithm *unless* user
// takes control of that page component in gatsby-node.
const autoPathCreator = async program => {
const autoPathCreator = async (program: any) => {
const pagesDirectory = path.join(program.directory, `pages`)
const exts = program.extensions.map(e => `*${e}`).join("|")
const files = await glob(`${pagesDirectory}/**/?(${exts})`)
Expand Down Expand Up @@ -75,7 +75,7 @@ const autoPathCreator = async program => {
return autoPages
}

module.exports = async program => {
module.exports = async (program: any) => {
console.log(`lib/bootstrap/index.js time since started:`, process.uptime())
// Set the program to the globals programDB
programDB(program)
Expand Down Expand Up @@ -258,20 +258,13 @@ module.exports = async program => {

// Create Schema.
console.time(`create schema`)
const schema = await require(`../schema/new`)()
const schema = await require(`../schema`)()
// const schema = await require(`../schema`)()
const graphqlRunner = (query, context) =>
graphql(schema, query, context, context, context)
console.timeEnd(`create schema`)

// TODO create new folder structure for files to reflect major systems.
// TODO validate page objects when adding them.
// TODO pass names of layout/page components into commons plugin for proper
// code splitting.
// TODO split layout components into their own files as well.
// TODO add plugin system plus ways to use Redux + Glamor server rendering.
// TODO layouts can specify parent layouts
// TODO js pages + markdown can specify layouts directly.
//
// directory structure
// /pages --> source plugins by default turn these files into pages.
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/lib/schema/ast-utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
const _ = require("lodash")
const flatten = require("flat")

Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/lib/schema/build-connection-fields.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
const _ = require("lodash")
const {
GraphQLInt,
Expand Down
7 changes: 2 additions & 5 deletions packages/gatsby/lib/schema/build-node-connections.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
const _ = require("lodash")
const {
GraphQLInt,
Expand All @@ -13,7 +14,7 @@ const {
} = require(`./infer-graphql-input-fields`)
const buildConnectionFields = require("./build-connection-fields")

module.exports = types => {
module.exports = (types: any) => {
const connections = {}

_.each(types, (type /*, fieldName*/) => {
Expand All @@ -32,10 +33,6 @@ module.exports = types => {
type: typeConnection,
description: `Connection to all ${type.name} nodes`,
args: {
// TODO infer (same?) args for input as for on the node.
// probably could use the same filtering function as for a node
// would just take the first one as the result and for a connection
// return all of them.
...connectionArgs,
...inferredInputFields,
},
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby/lib/schema/build-node-types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
const _ = require("lodash")
const {
GraphQLObjectType,
Expand All @@ -19,7 +20,7 @@ const {
const nodeInterface = require("./node-interface")
const { siteDB } = require("../utils/globals")

module.exports = async ast =>
module.exports = async (ast: any) =>
new Promise(resolve => {
const allNodes = select(ast, `*`)
const processedTypes = {}
Expand Down

0 comments on commit 7ea9ebb

Please sign in to comment.