diff --git a/.eslintrc b/.eslintrc index c80f81a796..c5b3cc6c6b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,9 +4,6 @@ "standard", "standard-react" ], - "plugins" : [ - "flow-vars" - ], "env" : { "browser" : true }, @@ -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] } } diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index 8fe5ec1bcd..0000000000 --- a/.flowconfig +++ /dev/null @@ -1,51 +0,0 @@ -[version] -0.22.0 - -[ignore] -.*/bin/.* -.*/build/.* -.*/config/.* -.*/coverage/.* -.*/node_modules/.* -.*/src/styles/.* - -[include] -./node_modules/ - -[libs] -./node_modules/flow-interfaces/interfaces/ -./interfaces/ - -[options] -module.system=haste -esproposal.class_static_fields=enable -esproposal.class_instance_fields=enable -esproposal.decorators=ignore - -module.name_mapper='.*\.\(scss\|css\)$' -> 'CSSModule' -module.name_mapper='.*\.\(jpg\|jpeg\|gif\|svg\|png\)$' -> 'Image' -module.name_mapper='^components\/\(.*\)$' -> '/src/components/\1' -module.name_mapper='^components$' -> '/src/components' -module.name_mapper='^containers\/\(.*\)$' -> '/src/containers/\1' -module.name_mapper='^containers$' -> '/src/containers' -module.name_mapper='^layouts\/\(.*\)$' -> '/src/layouts/\1' -module.name_mapper='^layouts$' -> '/src/layouts' -module.name_mapper='^redux\/\(.*\)$' -> '/src/redux/\1' -module.name_mapper='^routes\/\(.*\)$' -> '/src/routes/\1' -module.name_mapper='^routes$' -> '/src/routes' -module.name_mapper='^styles\/\(.*\)$' -> '/src/styles/\1' -module.name_mapper='^utils\/\(.*\)$' -> '/src/utils/\1' -module.name_mapper='^utils$' -> '/src/utils' -module.name_mapper='^views\/\(.*\)$' -> '/src/views/\1' -module.name_mapper='^views$' -> '/src/views' - -munge_underscores=true -strip_root=true - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FixMe - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-6]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-6]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*www[a-z,_]*\\)?)\\)? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy diff --git a/bin/flow-check.js b/bin/flow-check.js deleted file mode 100644 index 81ea46b258..0000000000 --- a/bin/flow-check.js +++ /dev/null @@ -1,8 +0,0 @@ -import cp from 'child_process'; -import flowBin from 'flow-bin'; - -try { - cp.execFileSync(flowBin, ['check'], {stdio: 'inherit'}); -} catch (e) { - process.exit(1); -} diff --git a/interfaces/image.d.js b/interfaces/image.d.js deleted file mode 100644 index 5111948c9f..0000000000 --- a/interfaces/image.d.js +++ /dev/null @@ -1,3 +0,0 @@ -declare module Image { - declare var exports: any; -} diff --git a/package.json b/package.json index 11014dc32e..625655d2ee 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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", diff --git a/src/redux/modules/counter.js b/src/redux/modules/counter.js index 54e0970e49..a99563b707 100644 --- a/src/redux/modules/counter.js +++ b/src/redux/modules/counter.js @@ -1,4 +1,3 @@ -/* @flow */ // ------------------------------------ // Constants // ------------------------------------ @@ -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 }); @@ -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(); @@ -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; diff --git a/src/views/HomeView/HomeView.js b/src/views/HomeView/HomeView.js index ac196e6f61..82ec7d63da 100644 --- a/src/views/HomeView/HomeView.js +++ b/src/views/HomeView/HomeView.js @@ -1,4 +1,3 @@ -/* @flow */ import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; @@ -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 { +export class HomeView extends React.Component { static propTypes = { counter: PropTypes.number.isRequired, doubleAsync: PropTypes.func.isRequired,