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

false positive no-unused-modules with Flow #1539

Open
Hypnosphi opened this issue Nov 13, 2019 · 2 comments
Open

false positive no-unused-modules with Flow #1539

Hypnosphi opened this issue Nov 13, 2019 · 2 comments

Comments

@Hypnosphi
Copy link
Contributor

Hypnosphi commented Nov 13, 2019

When type import goes before default import from the same file, the default export is marked as unused:

// foo.js

// @flow strict
export type Foo = string
export default ''
// index.js

// @flow strict
import type {Foo} from './foo'
import foo from './foo'

3:1 error exported declaration 'default' not used within other modules import/no-unused-modules

It works OK if I change the imports order:

// index.js

// @flow strict
import foo from './foo'
import type {Foo} from './foo'

Repro: https://github.com/Hypnosphi/no-unused-modules-repro

@rfermann
Copy link
Contributor

The issue is rather importing from the same source 2 times than importing a flow type. I already have a workaround in place to fix the current behaviour, will make a PR after #1542 is merged.

@Vages
Copy link

Vages commented Jul 21, 2020

Now that #1542 is merged, do you have any plans to publish your workaround, @rfermann?

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

No branches or pull requests

4 participants