Hi all!
When using flow opaque types (new in https://github.com/facebook/flow/releases/tag/v0.51.0) via flow comments The import/named rule doesn't detect the exported types.
Ex:
// @flow
/*::
export opaque type Foo = string;
*/
export const makeFoo = (): Foo => 'new foo';
// @flow
import { type Foo } from './Foo'; // Foo not found in './Foo' (import/named)
A weird workaround is to remove makeFoo from Foo.js and that will fix the linter rule. Don't know why that is. It's also not a good workaround since that makes the opaque type useless.
Is this an issue only with flow comments?
Possibly related to https://github.com/gajus/eslint-plugin-flowtype/issues/260 ?
Nope, I'm able to take off the flow comments and this error is still triggering a false-positive.
@johnhaley81 I should notice that eslint couldn't track the flow stubs generated by flow-typed
I have run locally the following test on current master (in the valid rules):
test({
code: 'import type { MyOpaqueType } from "./flowtypes"',
parser: 'babel-eslint',
}),
It is passing. Can we have a release?
Closed by #1057, in that case.
Most helpful comment
Nope, I'm able to take off the flow comments and this error is still triggering a false-positive.