How to configure Flow to ignore certain files
Flow needs to know which files to read and watch for changes. This set of files is determined by taking all included files and excluding all the ignored files.
[ignore] section in a
.flowconfig file tells Flow to ignore files
matching the specified regular expressions when type checking your code. By
default, nothing is ignored.
Things to keep in mind:
- These are OCaml regular expressions.
- These regular expressions match against absolute paths. They probably should
- Ignores are processed AFTER includes. If you both include and ignore a file it will be ignored.
[ignore] section might look like:
[ignore] .*/__tests__/.* .*/src/\(foo\|bar\)/.* .*\.ignore\.js
[ignore] section will ignore:
- Any file or directory under a directory named
- Any file or directory under
- Any file that ends with the extension
Starting with Flow v0.23.0, you may use the
<PROJECT_ROOT> placeholder in
your regular expressions. At runtime, Flow will treat the placeholder as if it
were the absolute path to the project’s root directory. This is useful for
writing regular expressions that are relative rather than absolute.
For example, you can write:
Which would ignore any file or directory under the directory named
within the project root. However, unlike the previous example’s
.*/__tests__/.*, it would NOT ignore files or directories under other
Was this guide helpful? Let us know by sending a message to @flowtype.