Eslint-plugin-import: false positive no-unused-modules with Flow

Created on 13 Nov 2019  路  2Comments  路  Source: benmosher/eslint-plugin-import

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

bug flow help wanted

All 2 comments

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.

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

Was this page helpful?
0 / 5 - 0 ratings