facebook / facebook/flow

.flowconfig default filename if none provided in name_mapper

Open
#4,839 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

We're using webpack aliases, and modified our .flowconfig to match.

The name_mapper doesn't seem to have the ability to default to a specific file, like index.js if no filename is provided. E.G.

`module.name_mapper='^Modules\/\(.*\)$' -> '/src/modules/\1'`

If I have an index.js in /src/modules, ideally I would just be able to have my import like so:

`import { MenuBlock, OrderSummaryView } from 'Modules';`

This results in a flow error. I'd like to have the name_mapper infer that it should look for a default file I specify in name_mapper when none is provided so I don't have to use `'Modules/index'` in my import, but also retain the ability to specify specific files.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.