facebook / facebook/flow

Flow "strict" mode is not applied to the module's index.js (v0.71.0)

Abierto
#6,232 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
22.3k
Forks
1.9k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I usually use this type of project structure:
```
├── index.js
├── my-module
│   ├── index.js
│ ├── my-first-submodule.js
│   └── my-second-submodule.js
```
Where the `my-first-submodule.js` and `my-second-submodule.js` files export several symbols, and usually, they don't have a `default` export. Then, for convenience, I reexport those symbols in `my-module/index.js` like so:
```
export { func1, func2, class1 } from './my-first-submodule';
export { func3, class2, constant1, constant2 } from './my-second-submodule';
```
Since every file is properly type-annotated and has a `// @flow` pragma at the beginning, everything checks fine and there are no errors. But if I change all `// @flow` pragmas to `// @flow strict`, and try to import the module folder (which implicitly imports the `index.js` file inside it), I get errors about all dependencies of a strict module also have to be strict:
```
Dependencies of a @flow strict module must also be @flow strict! (nonstrict-import)

1│ // @flow strict
2│
3│ import { func1 } from './my-module';
```
Changing `import { func1 } from './my-module';` to `import { func1 } from './my-module/index';` does work, though.

I got a [demo repo](https://github.com/mandx/flow-test/tree/09e99380df8f008023746bd1d352f62d9ba7f0e5) demonstrating the issue.

Am I doing something wrong? I did tweaked the `.flowconfig` file (is also included in the demo repo)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.