-
Notifications
You must be signed in to change notification settings - Fork 111
Add Flow annotations! #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| [ignore] | ||
| dist/ | ||
| lib/ | ||
| .*/node_modules/fbjs/.* | ||
| .*/__tests__/.* | ||
| .*/__mocks__/.* | ||
| .*/node_modules/flow-typed/src/.* | ||
|
|
||
| [include] | ||
| src/ | ||
|
|
||
| [libs] | ||
| interfaces/ | ||
| node_modules/flow-typed/definitions | ||
|
|
||
| [options] | ||
| module.name_mapper='history\(.*\)' -> 'history' | ||
| esproposal.class_static_fields=enable | ||
| esproposal.class_instance_fields=enable | ||
| suppress_comment= \\(.\\|\n\\)*\\$FlowIssue] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| declare module 'history' { | ||
| declare type HistoryOptions = Object; | ||
|
|
||
| declare type Action = 'PUSH' | 'REPLACE' | 'POP'; | ||
| declare type Hash = string; | ||
| declare type Href = string; | ||
| declare type Path = string; | ||
| declare type Pathname = string; | ||
| declare type Query = Object; | ||
| declare type Search = string; | ||
|
|
||
| declare type LocationKey = string; | ||
| declare type LocationState = ?Object; | ||
|
|
||
| declare type Location = { | ||
| pathname: Pathname; | ||
| search: Search; | ||
| query: Query; | ||
| state: LocationState; | ||
| action: Action; | ||
| key: LocationKey; | ||
| }; | ||
|
|
||
| declare type LocationDescriptorObject = { | ||
| pathname: Pathname; | ||
| search?: Search; | ||
| query?: Query; | ||
| state?: LocationState; | ||
| }; | ||
|
|
||
| declare type LocationDescriptor = LocationDescriptorObject | Path; | ||
|
|
||
| declare type LocationListener = (location: Location) => void; | ||
|
|
||
| declare type TransitionHook = (location: Location, callback: ?Function) => any; | ||
|
|
||
| declare type History = { | ||
| listenBefore: (hook: TransitionHook) => Function, | ||
| listen: (listener: LocationListener) => Function, | ||
| transitionTo: (location: Location) => void, | ||
| push: (location: LocationDescriptor) => void, | ||
| replace: (location: LocationDescriptor) => void, | ||
| go: (n: number) => void, | ||
| goBack: () => void, | ||
| goForward: () => void, | ||
| createKey: () => LocationKey, | ||
| createPath: (location: LocationDescriptor) => Path, | ||
| createHref: (location: LocationDescriptor) => Href, | ||
| createLocation: (location: LocationDescriptor, action: ?Action, key: ?LocationKey) => Location | ||
| }; | ||
|
|
||
| declare type BeforeUnloadHook = () => ?string; | ||
| declare type CreateHistory = (options: ?HistoryOptions) => History; | ||
| declare type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| "watch-lib": "watch 'npm run build-lib' src/ -d", | ||
| "clean": "npm run clean-lib && npm run clean-dist", | ||
| "build": "npm run build-lib && npm run build-dist", | ||
| "lint": "eslint --color --ext .js,.jsx src test", | ||
| "lint": "concurrently 'eslint --color --ext .js,.jsx src test' 'flow check'", | ||
| "test": "mocha test/.setup.js test/**/*.spec.js", | ||
| "test-cov": "BABEL_ENV=coverage nyc mocha test/.setup.js 'test/**/*.spec.js'", | ||
| "check": "npm run lint && npm run test", | ||
|
|
@@ -61,8 +61,12 @@ | |
| "enzyme": "^2.4.1", | ||
| "eslint": "^3.0.1", | ||
| "eslint-config-defaults": "^10.0.0-alpha.1", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/FormidableLabs/eslint-config-formidable is now available :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 I'll PR that in! |
||
| "eslint-plugin-babel": "^3.3.0", | ||
| "eslint-plugin-filenames": "0.2.0", | ||
| "eslint-plugin-flowtype": "^2.6.3", | ||
| "eslint-plugin-react": "^5.2.2", | ||
| "flow-bin": "^0.30.0", | ||
| "flow-typed": "^2.0.0-beta.6", | ||
| "jsdom": "^9.4.1", | ||
| "lodash": "^4.13.1", | ||
| "mocha": "^2.5.3", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| // @flow | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does flow do anything for files that don't have any explicit types defined?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It at least infers their types, although it might be that consumers of this file that have the |
||
| export const LOCATION_CHANGED = 'ROUTER_LOCATION_CHANGED'; | ||
| export const PUSH = 'ROUTER_PUSH'; | ||
| export const REPLACE = 'ROUTER_REPLACE'; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| // @flow | ||
| import createStoreWithRouter, { | ||
| locationDidChange, | ||
| initializeCurrentLocation | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have to specify all these ignores if you're only including
src?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, yeah :/ This is how Flow knows which code is yours and which code is library stuff.