facebook / facebook/flow

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

Offen
#6,232 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
22.3k
Forks
1.9k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.