Every Flow project contains a .flowconfig
file. You can configure Flow by modifying .flowconfig
. New projects or projects that are starting to use Flow can generate a default .flowconfig
by running flow init
.
.flowconfig
format The .flowconfig
uses a custom format that vaguely resembles INI files. We are not proud of our custom format and plan to support a better format in the future. GitHub issue #153 tracks this.
The .flowconfig
consists of 6 sections:
Comment support was added in v0.23.0. Lines beginning with zero or more spaces followed by an #
or ;
or π©
are ignored. For example:
# This is a comment # This is a comment ; This is a comment ; This is a comment π© This is a comment π© This is a comment
.flowconfig
The location of the .flowconfig
is significant. Flow treats the directory that contains the .flowconfig
as the project root. By default Flow includes all the source code under the project root. The paths in the [include] section are relative to the project root. Some other configuration also lets you reference the project root via the macro <PROJECT_ROOT>
.
Most people put the .flowconfig
in the root of their project (i.e. next to the package.json
). Some people put all their code in a src/
directory and therefore put the .flowconfig
at src/.flowconfig
.
Say you have the following directory structure, with your .flowconfig
in mydir
:
otherdir βββ src βββ othercode.js mydir βββ .flowconfig βββ build β βββ first.js β βββ shim.js βββ lib β βββ flow βββ node_modules β βββ es6-shim βββ src βββ first.js βββ shim.js
Here is an example of how you could use the .flowconfig
directives.
[include] ../otherdir/src [ignore] .*/build/.* [libs] ./lib
Now flow
will include a directory outside the .flowconfig
path in its check, ignore the build
directory and use the declarations in lib
.
Β© 2013βpresent Facebook Inc.
Licensed under the BSD License.
https://flow.org/en/docs/config