Could you point me to an example of how to configure Flow so that I could just use the name of a file for imports instead of long relative paths ?. This implies that the name of my files in my entire working directory are unique.
example:
Directories
pages/components/foo.js
common/types/abc.js
Current import statements
import foo from "../../pages/components/foo"
import abc from "../common/types/abc"
Desired import statements
import foo from "foo"
import abc from "abc"
This is very possible. But first hopefully you're setup your bundling tool to also accept parsing absolute path names because remember that flow does not handle logic it simply does code analysis but would throw errors if you haven't setup the pathing in
.flowconfigand flow has no idea how to do a file lookup.The option you're looking for is module.name_mapper which will repoint your written import into something else based on an ocaml regex.
If you are using create react app or have a setup similar for example you can see the adding flow section to see an example of how they've recommended handling it.