Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducer with types #20

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"plugins": [
"import",
"jsdoc",
"require-jsdoc"
"require-jsdoc",
"flowtype"
],
"extends" : ["airbnb"],
"rules": {
Expand Down Expand Up @@ -37,7 +38,9 @@
"module": false,
"process": false,
"require": false,
"window": false
"window": false,
"React": false,
"Class": false
},
"settings": {
"import/ignore": [
Expand Down
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
[libs]

[options]
esproposal.decorators=ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ docs/
node_modules/
npm-debug.log
.DS_Store

# IDE
.idea/
193 changes: 193 additions & 0 deletions flow-typed/npm/flow-typed_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
// flow-typed signature: 8898603ed592b58f9cb89fd30a371a09
// flow-typed version: <<STUB>>/flow-typed_v^2.1.2/flow_v0.46.0

/**
* This is an autogenerated libdef stub for:
*
* 'flow-typed'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'flow-typed' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'flow-typed/dist/cli' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/create-stub' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/install' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/runTests' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/search' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/update-cache' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/update' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/validateDefs' {
declare module.exports: any;
}

declare module 'flow-typed/dist/commands/version' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/cacheRepoUtils' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/codeSign' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/fileUtils' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/flowProjectUtils' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/flowVersion' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/git' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/github' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/isInFlowTypedRepo' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/libDefs' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/node' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/npm/npmLibDefs' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/npm/npmProjectUtils' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/semver' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/stubUtils' {
declare module.exports: any;
}

declare module 'flow-typed/dist/lib/validationErrors' {
declare module.exports: any;
}

// Filename aliases
declare module 'flow-typed/dist/cli.js' {
declare module.exports: $Exports<'flow-typed/dist/cli'>;
}
declare module 'flow-typed/dist/commands/create-stub.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/create-stub'>;
}
declare module 'flow-typed/dist/commands/install.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/install'>;
}
declare module 'flow-typed/dist/commands/runTests.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/runTests'>;
}
declare module 'flow-typed/dist/commands/search.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/search'>;
}
declare module 'flow-typed/dist/commands/update-cache.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/update-cache'>;
}
declare module 'flow-typed/dist/commands/update.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/update'>;
}
declare module 'flow-typed/dist/commands/validateDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/validateDefs'>;
}
declare module 'flow-typed/dist/commands/version.js' {
declare module.exports: $Exports<'flow-typed/dist/commands/version'>;
}
declare module 'flow-typed/dist/lib/cacheRepoUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/cacheRepoUtils'>;
}
declare module 'flow-typed/dist/lib/codeSign.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/codeSign'>;
}
declare module 'flow-typed/dist/lib/fileUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/fileUtils'>;
}
declare module 'flow-typed/dist/lib/flowProjectUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/flowProjectUtils'>;
}
declare module 'flow-typed/dist/lib/flowVersion.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/flowVersion'>;
}
declare module 'flow-typed/dist/lib/git.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/git'>;
}
declare module 'flow-typed/dist/lib/github.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/github'>;
}
declare module 'flow-typed/dist/lib/isInFlowTypedRepo.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/isInFlowTypedRepo'>;
}
declare module 'flow-typed/dist/lib/libDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/libDefs'>;
}
declare module 'flow-typed/dist/lib/node.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/node'>;
}
declare module 'flow-typed/dist/lib/npm/npmLibDefs.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmLibDefs'>;
}
declare module 'flow-typed/dist/lib/npm/npmProjectUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmProjectUtils'>;
}
declare module 'flow-typed/dist/lib/semver.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/semver'>;
}
declare module 'flow-typed/dist/lib/stubUtils.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/stubUtils'>;
}
declare module 'flow-typed/dist/lib/validationErrors.js' {
declare module.exports: $Exports<'flow-typed/dist/lib/validationErrors'>;
}
82 changes: 82 additions & 0 deletions flow-typed/npm/seamless-immutable_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// flow-typed signature: 70f8099c896120a6e0625971ac1532e7
// flow-typed version: <<STUB>>/seamless-immutable_v^7.1.2/flow_v0.46.0

/**
* This is an autogenerated libdef stub for:
*
* 'seamless-immutable'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'seamless-immutable' {
declare module.exports: any;
}

// sources: https://github.com/rtfeldman/seamless-immutable/issues/121
// ->
// https://github.com/ajhyndman/fantasia/blob/master/flow/libs/seamless-immutable.d.js
//
//
declare module 'seamless-immutable' {
declare type ImmutableType<T: Object | Array<*>> = T & {
// Array methods
flatMap(fn: Function): Array<any>;
asObject(fn: Function): Object;
asMutable(): Array<any>;
// Object methods
merge(collection: Array<any> | Object, deep?: Object): Object;
set(key: string, value: any): Object;
setIn(keyPath: Array<string>, value: any): Object;
update(key: string, fn: Function): Object;
updateIn(keyPath: Array<string>, fn: Function): Object;
without(fn: Function): Object;
without(keys: Array<string>): Object;
without(...keys: Array<string>): Object;
asMutable(): Array<any> | Object;
};

declare function from<T: Object | Array<*>> (spec: T): ImmutableType<T>;
declare function isImmutable(x: *): boolean;

declare export default function Immutable<T>(input: T): ImmutableType<T>;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'seamless-immutable/seamless-immutable.development' {
declare module.exports: any;
}

declare module 'seamless-immutable/seamless-immutable.development.min' {
declare module.exports: any;
}

declare module 'seamless-immutable/seamless-immutable.production.min' {
declare module.exports: any;
}

declare module 'seamless-immutable/src/seamless-immutable' {
declare module.exports: any;
}

// Filename aliases
declare module 'seamless-immutable/seamless-immutable.development.js' {
declare module.exports: $Exports<'seamless-immutable/seamless-immutable.development'>;
}
declare module 'seamless-immutable/seamless-immutable.development.min.js' {
declare module.exports: $Exports<'seamless-immutable/seamless-immutable.development.min'>;
}
declare module 'seamless-immutable/seamless-immutable.production.min.js' {
declare module.exports: $Exports<'seamless-immutable/seamless-immutable.production.min'>;
}
declare module 'seamless-immutable/src/seamless-immutable.js' {
declare module.exports: $Exports<'seamless-immutable/src/seamless-immutable'>;
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"test": "./scripts/mocha.js",
"test:watch": "./scripts/mocha-watch.js",
"coverage": "./scripts/coverage.js",
"flow": "flow"
"flow": "flow",
"flow:typed": "flow-typed install"
},
"repository": {
"type": "git",
Expand All @@ -34,7 +35,7 @@
"devDependencies": {
"babel-cli": "^6.11.4",
"babel-core": "^6.13.2",
"babel-eslint": "^6.1.2",
"babel-eslint": "^7.2.3",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-async-functions": "^6.8.0",
"babel-plugin-syntax-jsx": "^6.3.13",
Expand Down Expand Up @@ -84,6 +85,8 @@
"tmp": "0.0.28"
},
"dependencies": {
"eslint-plugin-flowtype": "^2.33.0",
"flow-typed": "^2.1.2",
"seamless-immutable": "^7.1.2"
},
"peerDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/Button.react.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Component, PropTypes as RPT } from 'react';
// @flow
import React, { Component } from 'react';

export default class Button extends Component {

static propTypes = {
children: RPT.object.isRequired,
disabled: RPT.bool.isRequired,
onClick: RPT.func.isRequired,
props: {
children: Object,
disabled: boolean,
onClick: Function
}

render() {
Expand Down
16 changes: 8 additions & 8 deletions src/Field.react.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow
import connectField from './connectField';
import React, { Component, PropTypes as RPT } from 'react';
import React, { Component } from 'react';

export default class Field extends Component {

static propTypes = {
component: RPT.object,
name: RPT.string.isRequired
props: {
component?: Class<React.Component<*, *, *>>,
name: string
}

render() {
Expand All @@ -17,9 +17,9 @@ export default class Field extends Component {
}

export class BasicInput extends Component { // eslint-disable-line
static propTypes = {
error: RPT.string,
label: RPT.string
props: {
label?: string,
error?: string
}

render() {
Expand Down
Loading