Skip to content

Commit

Permalink
drop flow
Browse files Browse the repository at this point in the history
  • Loading branch information
jokeyrhyme committed Feb 22, 2016
1 parent 9eb718d commit c6ac3ef
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 97 deletions.
7 changes: 1 addition & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"standard",
"standard-react"
],
"plugins" : [
"flow-vars"
],
"env" : {
"browser" : true
},
Expand All @@ -24,8 +21,6 @@
"semi-spacing": [2, { "before": false, "after": true }],

"space-infix-ops": 0,
"max-len": [2, 120, 2],
"flow-vars/define-flow-type": 1,
"flow-vars/use-flow-type": 1
"max-len": [2, 120, 2]
}
}
51 changes: 0 additions & 51 deletions .flowconfig

This file was deleted.

8 changes: 0 additions & 8 deletions bin/flow-check.js

This file was deleted.

3 changes: 0 additions & 3 deletions interfaces/image.d.js

This file was deleted.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"posttest": "npm-run-all lint:fix",
"test:dev": "npm run test -- --watch",
"deploy": "better-npm-run deploy",
"flow:check": "babel-node bin/flow-check",
"codecov": "cat coverage/*/lcov.info | codecov"
},
"betterScripts": {
Expand Down Expand Up @@ -115,14 +114,11 @@
"eslint-config-standard-react": "^2.2.0",
"eslint-loader": "^1.1.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-flow-vars": "^0.1.3",
"eslint-plugin-promise": "^1.0.8",
"eslint-plugin-react": "^4.0.0",
"eslint-plugin-standard": "^1.3.1",
"extract-text-webpack-plugin": "^1.0.0",
"file-loader": "^0.8.4",
"flow-bin": "^0.22.0",
"flow-interfaces": "^0.2.0",
"fs-extra": "^0.26.3",
"html-webpack-plugin": "^2.7.1",
"imports-loader": "^0.6.5",
Expand Down
16 changes: 6 additions & 10 deletions src/redux/modules/counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* @flow */
// ------------------------------------
// Constants
// ------------------------------------
Expand All @@ -7,10 +6,7 @@ export const COUNTER_INCREMENT = 'COUNTER_INCREMENT';
// ------------------------------------
// Actions
// ------------------------------------
// NOTE: "Action" is a Flow interface defined in https://github.com/TechnologyAdvice/flow-interfaces
// If you're unfamiliar with Flow, you are completely welcome to avoid annotating your code, but
// if you'd like to learn more you can check out: flowtype.org.
export const increment = (value: number = 1): Action => ({
export const increment = (value: number = 1) => ({
type: COUNTER_INCREMENT,
payload: value
});
Expand All @@ -21,9 +17,9 @@ export const increment = (value: number = 1): Action => ({
// NOTE: This is solely for demonstration purposes. In a real application,
// you'd probably want to dispatch an action of COUNTER_DOUBLE and let the
// reducer take care of this logic.
export const doubleAsync = (): Function => {
return (dispatch: Function, getState: Function): Promise => {
return new Promise((resolve: Function): void => {
export const doubleAsync = () => {
return (dispatch, getState) => {
return new Promise((resolve) => {
setTimeout(() => {
dispatch(increment(getState().counter));
resolve();
Expand All @@ -41,14 +37,14 @@ export const actions = {
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[COUNTER_INCREMENT]: (state: number, action: {payload: number}): number => state + action.payload
[COUNTER_INCREMENT]: (state, action) => state + action.payload
};

// ------------------------------------
// Reducer
// ------------------------------------
const initialState = 0;
export function counterReducer (state: number = initialState, action: Action): number {
export function counterReducer (state = initialState, action) {
const handler = ACTION_HANDLERS[action.type];

return handler ? handler(state, action) : state;
Expand Down
16 changes: 1 addition & 15 deletions src/views/HomeView/HomeView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* @flow */
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import classnames from 'classnames';
Expand All @@ -7,23 +6,10 @@ import { increment, doubleAsync } from '../../redux/modules/counter';
import DuckImage from './Duck.jpg';
import classes from './HomeView.css';

// We can use Flow (http://flowtype.org/) to type our component's props
// and state. For convenience we've included both regular propTypes and
// Flow types, but if you want to try just using Flow you'll want to
// disable the eslint rule `react/prop-types`.
// NOTE: You can run `npm run flow:check` to check for any errors in your
// code, or `npm i -g flow-bin` to have access to the binary globally.
// Sorry Windows users :(.
type Props = {
counter: number,
doubleAsync: Function,
increment: Function
};

// We avoid using the `@connect` decorator on the class definition so
// that we can export the undecorated component for testing.
// See: http://rackt.github.io/redux/docs/recipes/WritingTests.html
export class HomeView extends React.Component<void, Props, void> {
export class HomeView extends React.Component {
static propTypes = {
counter: PropTypes.number.isRequired,
doubleAsync: PropTypes.func.isRequired,
Expand Down

0 comments on commit c6ac3ef

Please sign in to comment.