Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import/named doesn't detect Flow Opaque types in flow comments #921

Closed
johnhaley81 opened this issue Aug 24, 2017 · 5 comments · Fixed by #1106
Closed

import/named doesn't detect Flow Opaque types in flow comments #921

johnhaley81 opened this issue Aug 24, 2017 · 5 comments · Fixed by #1106

Comments

@johnhaley81
Copy link

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:

Foo.js

// @flow

/*::
export opaque type Foo = string;
*/

export const makeFoo = (): Foo => 'new foo';

UseFoo.js

// @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.

@SpainTrain
Copy link

Is this an issue only with flow comments?

Possibly related to gajus/eslint-plugin-flowtype#260 ?

@johnhaley81
Copy link
Author

Nope, I'm able to take off the flow comments and this error is still triggering a false-positive.

@ghost
Copy link

ghost commented Oct 17, 2017

@johnhaley81 I should notice that eslint couldn't track the flow stubs generated by flow-typed

@syymza
Copy link
Contributor

syymza commented May 1, 2018

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?

@ljharb
Copy link
Member

ljharb commented May 1, 2018

Closed by #1057, in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants