facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.08k stars 1.86k forks source link

Support Global Error Suppressions #8601

Closed evbo closed 1 year ago

evbo commented 3 years ago

Just like lint options, allow optional global configuration of which Errors should be suppressed. Because of the vast ecosystem of javascript compiling tools, Flow should accept some of their tooling is redundant (like like it did for linting) and, rather than force all features, should allow them to be disabled upon .flowconfig request (perhaps under a global [errors] section)

Use Cases For instance, [cannot-resolve-module] is completely redundant as webpack will tell me if an import fails. For third party modules, I know it's been said simply list them under [declarations], but that also means potentially thousands of node_modules getting scanned. Since the caching in Flow isn't perfect, I always rm -rf /tmp/flow and so I need to parse these thousands of files each time - quite a slow down. Or I can manually place ignore comments above each import, which I'm odorously doing. So you see how just globally ignoring this error would at least alleviate the pain, especially since webpack will still be there to catch the error if it truly is one.

Motivating Words (hopefully) Flow has a unique advantage over TypeScript in that it almost fully supports a gradual opt-in migration. By de-embedding all typing into comment types, I can keep my original js completely intact and portable - and no need to even setup a (Babel) compiler for stripping types either. But the configuration to get it working is it's weak point, so by lowering that threshold some with more control I think gradualist migrators to type-safe javascript will favor Flow's approach just as I have!

SamChou19815 commented 1 year ago

We already closed other similar issues, since it isn't likely to be supported.