.flowconfig [ignore]

.flowconfig [ignore]

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]

The [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:

  1. These are OCaml regular expressions.
  2. These regular expressions match against absolute paths. They probably should start with .*
  3. Ignores are processed AFTER includes. If you both include and ignore a file it will be ignored.

An example [ignore] section might look like:

[ignore]
.*/__tests__/.*
.*/src/\(foo\|bar\)/.*
.*\.ignore\.js

This [ignore] section will ignore:

  1. Any file or directory under a directory named __tests__
  2. Any file or directory under .*/src/foo or under .*/src/bar
  3. Any file that ends with the extension .ignore.js

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:

[ignore]
<PROJECT_ROOT>/__tests__/.*

Which would ignore any file or directory under the directory named __tests__/ within the project root. However, unlike the previous example’s .*/__tests__/.*, it would NOT ignore files or directories under other directories named __tests__/, like src/__tests__/.

© 2013–present Facebook Inc.
Licensed under the BSD License.
https://flow.org/en/docs/config/ignore

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部