简体   繁体   中英

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. We are okay with all those modules being any and we dont want to use flow-typed anymore.

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'".

We tried various [declarations] and [untyped] options with no success.

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 to be any
  • no type checking within node_modules

This should be possible using [untyped] section in a .flowconfig

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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