简体   繁体   English

流类型忽略所有 3rd 方库

[英]Flow Type Ignore all 3rd party libraries

We are basically migrating away from flow type and dont want to maintain and/or rely on any 3rd party types/resolutions anymore.我们基本上正在从流类型迁移,并且不想再维护和/或依赖任何 3rd 方类型/决议。 We are okay with all those modules being any and we dont want to use flow-typed anymore.我们都还可以与所有这些模块是any我们不想使用了流量类型。

Our current config is:我们目前的配置是:

[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

Which gives us a ton of errors within node_modules itself and inside the 'src' code no 3rd party module can be resolved - eg: "Cannot resolve module 'ramda'".这给我们在 node_modules 本身和在 'src' 代码内部没有 3rd 方模块可以解决的大量错误 - 例如:“无法解析模块 'ramda'”。

We tried various [declarations] and [untyped] options with no success.我们尝试了各种 [declarations] 和 [untyped] 选项,但都没有成功。

The directory structure is:目录结构为:

/packages
  .flowconfig
  /app
    /src
      /client

So to sum up we want:总而言之,我们想要:

  • node_modules to be resolved (no error in app code when importing) node_modules 待解析(导入时应用代码无错误)
  • node modules to be any节点模块是any
  • no type checking within node_modules node_modules 中没有类型检查

This should be possible using [untyped] section in a .flowconfig这应该可以使用.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 . .flowconfig文件中的[untyped]部分告诉 Flow 不要对匹配指定正则表达式的文件进行类型检查,而是丢弃类型并将模块视为any

[untyped]
.*/node_modules/.*

Docs文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM