Skip to content

Commit

Permalink
Integrate Flow type checker
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
koistya committed Nov 30, 2016
1 parent 68a8a88 commit 9d74583
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ignore]
.*/build/.*
.*/coverage/.*
.*/scripts/.*
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ cache:
- node_modules
script:
- npm run lint
- npm run check
- npm run build
- npm run test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ You can use it either just as a playground or a base for your next API project.
│ ├── /schema.js # GraphQL schema
│ └── /server.js # Node.js server (entry point)
├── /test/ # Unit, integration and load tests
└── package.json # The list of project dependencies
├── package.json # The list of project dependencies
└── yarn.lock # Fixed versions of all the dependencies
```


Expand Down Expand Up @@ -53,6 +54,7 @@ npm run build:watch # Compiles the app and starts watching for chang

```bash
npm run lint # Find problematic patterns in code
npm run check # Check source code for type errors
npm run test # Run unit tests once
npm run test:watch # Run unit tests in watch mode
```
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"babel-plugin-syntax-trailing-function-commas": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.19.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"babel-plugin-transform-object-rest-spread": "^6.19.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-register": "^6.18.0",
Expand All @@ -31,16 +32,18 @@
"eslint": "^3.11.0",
"eslint-config-airbnb-base": "^10.0.1",
"eslint-plugin-import": "^2.2.0",
"flow-bin": "^0.36.0",
"mocha": "^3.2.0",
"nodemon": "^1.11.0",
"rimraf": "^2.5.4"
},
"babel": {
"plugins": [
"syntax-trailing-function-commas",
"transform-es2015-modules-commonjs",
"syntax-async-functions",
"syntax-trailing-function-commas",
"transform-class-properties",
"transform-es2015-modules-commonjs",
"transform-flow-strip-types",
"transform-object-rest-spread"
]
},
Expand All @@ -49,6 +52,7 @@
},
"scripts": {
"lint": "eslint src test scripts --ignore-pattern scripts/start.js",
"check": "flow check",
"test": "mocha test/unit --compilers js:babel-core/register",
"test:watch": "mocha test/unit --compilers js:babel-core/register --reporter min --watch",
"build": "node scripts/build",
Expand Down
2 changes: 2 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

import express from 'express';
import cors from 'cors';
import cookieParser from 'cookie-parser';
Expand Down
2 changes: 2 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

//
// Node.js server settings
// -----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

import { GraphQLSchema, GraphQLObjectType } from 'graphql';
import Viewer from './types/Viewer';

Expand Down
2 changes: 2 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

import app from './app';
import config from './config';

Expand Down
2 changes: 2 additions & 0 deletions src/types/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

import { GraphQLObjectType, GraphQLNonNull, GraphQLID, GraphQLString } from 'graphql';

export default new GraphQLObjectType({
Expand Down
2 changes: 2 additions & 0 deletions src/types/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* LICENSE.txt file in the root directory of this source tree.
*/

/* @flow */

import { GraphQLObjectType } from 'graphql';
import User from './User';

Expand Down
15 changes: 15 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ babel-plugin-syntax-class-properties@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de"

babel-plugin-syntax-flow@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d"

babel-plugin-syntax-object-rest-spread@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
Expand All @@ -271,6 +275,13 @@ babel-plugin-transform-es2015-modules-commonjs@^6.18.0:
babel-template "^6.16.0"
babel-types "^6.18.0"

babel-plugin-transform-flow-strip-types@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.18.0.tgz#4d3e642158661e9b40db457c004a30817fa32592"
dependencies:
babel-plugin-syntax-flow "^6.18.0"
babel-runtime "^6.0.0"

babel-plugin-transform-object-rest-spread@^6.19.0:
version "6.19.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.19.0.tgz#f6ac428ee3cb4c6aa00943ed1422ce813603b34c"
Expand Down Expand Up @@ -1144,6 +1155,10 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"

flow-bin@^0.36.0:
version "0.36.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.36.0.tgz#557907bd9c2ab0670cfad9e7e906a74b0631e39a"

for-in@^0.1.5:
version "0.1.6"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
Expand Down

0 comments on commit 9d74583

Please sign in to comment.