Search code examples
javascriptflowtypeflow-typed

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 - e.g.: "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

Solution

  • 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