The Wayback Machine - https://web.archive.org/web/20161028115213/https://github.com/facebook/flow
Skip to content
Adds static typing to JavaScript to improve developer productivity and code quality. http://flowtype.org/
OCaml JavaScript C Shell Ruby CSS Other
Latest commit 9e5f7db Oct 28, 2016 @mroch mroch committed with Facebook Github Bot fix traces when destructuring
Summary: when a trace is available, we should call `flow_opt` with the trace, so we don't lose it.

Reviewed By: gabelevi

Differential Revision: D4090147

fbshipit-source-id: 69d5c8b4ebadb0a38eaa668771c7e6c53c849c55
Permalink
Failed to load latest commit information.
examples [flow docs] Main page, "Getting Started", & "Five Simple Examples" re… Mar 5, 2016
flow-typed ./tool test --watch Jul 22, 2016
hack [hack] Dont show Marshal tools error message when server hangs up Oct 27, 2016
js Remove hh_realpath error from /try Sep 8, 2016
lib Complete node's EventEmitter API definition Oct 27, 2016
newtests Added missing toString methods. Oct 25, 2016
npm-flow-lib `flow-lib`: JS interfaces for Flow APIs Aug 9, 2016
resources deploy flow-parser to npm via Travis Oct 13, 2016
scripts Gracefully handle no git or hg on Windows Jul 25, 2016
src fix traces when destructuring Oct 28, 2016
tests Complete node's EventEmitter API definition Oct 27, 2016
tsrc ./tool script to profile flow check Oct 11, 2016
website Fix error message is not correct in Getting Started with Flow doc Oct 24, 2016
.flowconfig Add npm-flow-lib to .flowconfig's ignore Sep 2, 2016
.gitattributes Ignore line endings in some esprima tests Oct 19, 2016
.gitignore [parser] add script to test flow against esprima3 tests Oct 18, 2016
.merlin Adds merlin file configuration Aug 23, 2015
.travis.yml switch to uploading releases as flow-bot Oct 18, 2016
00_config.ocp Update build system and some fixes on the test-suite on Windows Dec 17, 2015
CONTRIBUTING.md Add contributing rules Apr 24, 2015
Changelog.md Version + changelog Sep 28, 2016
LICENSE Updated all copyright license headers Feb 8, 2016
Makefile Build lz4 Oct 4, 2016
PATENTS Sync changes to upstream Apr 16, 2015
README.md add npm to install instructions in README.md Sep 19, 2016
README.win32 Update build system and some fixes on the test-suite on Windows Dec 17, 2015
_tags Fix parser makefile for 4.03.0 May 10, 2016
appveyor.yml always use flow's ocpwin cache Sep 19, 2016
flow-types.el unbreak emacs support Sep 23, 2015
make.bat Continuous integration for Windows with AppVeyor Jun 24, 2016
ocp_build_flow.ocp.fb Remove deleted dependencies from ocp_build files Sep 20, 2016
ocp_build_hack.ocp.fb Build lz4 Oct 4, 2016
package.json Fix ./tool test runner's source-map-support require Sep 29, 2016
runtests.sh fix runtests.sh when skipping tests Oct 12, 2016
tool ./tool babel Sep 1, 2016

README.md

Flow Build Status Windows Build Status

Flow is a static typechecker for JavaScript. To find out more about Flow, check out flowtype.org.

For a background on the project, please read our launch blog post.

Requirements

Flow works with:

  • Mac OS X
  • Linux (64-bit)
  • Windows (64-bit)

There are binary distributions for each of these platforms and you can also build it from source on any of them as well.

Installing Flow

Flow is simple to install: all you need is the flow binary on your PATH and you're good to go.

Installing Flow Per Project

The recommended way to install Flow is via the flow-bin npm package. Adding flow-bin to your project's package.json:

  • provides a smoother upgrade experience, since the correct version of Flow is automatically used based on the revision you check out
  • installs Flow as part of your existing npm install workflow
  • lets you use different versions of Flow on different projects
npm install --save-dev flow-bin
node_modules/.bin/flow

Installing Flow Globally

Although not recommended, you can also install Flow globally (for example, perhaps you don't use npm or package.json).

The best way to install globally is via flow-bin:

npm install -g flow-bin
flow # make sure `npm bin -g` is on your path

On Mac OS X, you can install Flow via the Homebrew package manager:

brew update
brew install flow

You can also build and install Flow via the OCaml OPAM package manager. Since Flow has some non-OCaml dependencies, you need to use the depext package like so:

opam install depext
opam depext --install flowtype

If you don't have a new enough version of OCaml to compile Flow, you can also use OPAM to bootstrap a modern version. Install OPAM via the binary packages for your operating system and run:

opam init --comp=4.03.0
opam install flowtype
eval `opam config env`
flow --help

Getting started

Getting started with flow is super easy.

  • Initialize Flow by running the following command in the root of your project
flow init
  • Add the following to the top of all the files you want to typecheck
/* @flow */
  • Run and see the magic happen
flow check

More thorough documentation and many examples can be found at http://flowtype.org.

Building Flow

Flow is written in OCaml (OCaml 4.01.0 or higher is required) and (on Linux) requires libelf. You can install OCaml on Mac OS X and Linux by following the instructions at ocaml.org.

For example, on Ubuntu 14.04 and similar systems:

sudo apt-get install ocaml libelf-dev

On OSX, using the brew package manager:

brew install ocaml ocamlbuild libelf opam

Once you have these dependencies, building Flow just requires running

make

This produces a bin folder containing the flow binary.

Note: at this time, the OCaml dependency prevents us from adding Flow to npm. Try flow-bin if you need a npm binary wrapper.

Running the tests

To run the tests, first compile flow using make. Then run bash ./runtests.sh bin/flow

There is a make test target that compiles and runs tests.

To run a subset of the tests you can pass a second argument to the runtests.sh file.

For example: bash runtests.sh bin/flow class | grep -v 'SKIP'

Join the Flow community

License

Flow is BSD-licensed. We also provide an additional patent grant.

You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.