流类型忽略所有第 3 方库

Flow Type Ignore all 3rd party libraries

我们基本上正在从流类型中迁移出来,不想再and/or 依赖任何第 3 方 types/resolutions。我们可以接受所有这些模块 any,我们不想再使用流类型了。

我们当前的配置是:

[include]
<PROJECT_ROOT>/app/src/client
[ignore]
  .*\.json
  .*\.spec\.js
  .*\.test\.js
[options]
module.system.node.allow_root_relative=true
module.system.node.root_relative_dirname=<PROJECT_ROOT>/app/src/client
module.system.node.resolve_dirname=<PROJECT_ROOT>/node_modules
[version]
  0.134.0

这给我们带来了 node_modules 本身和 'src' 代码中的大量错误,无法解析第 3 方模块 - 例如:“无法解析模块 'ramda'”。

我们尝试了各种[声明]和[非类型化]选项但没有成功。

目录结构为:

/packages
  .flowconfig
  /app
    /src
      /client

所以总结起来我们想要:

这应该可以使用 .flowconfig

中的 [untyped] 部分

The [untyped] section in a .flowconfig file tells Flow to not typecheck files matching the specified regular expressions and instead throw away types and treat modules as any.

[untyped]
.*/node_modules/.*

Docs