import-js/eslint-plugin-import

false positive no-unused-modules with Flow

Aperta

#1539 aperta il 13 nov 2019

 (2 commenti) (2 reazioni) (0 assegnatari)JavaScript (1549 fork)batch import
bugflowhelp wanted

Metriche repository

Star
 (5940 stelle)
Metriche merge PR
 (Merge medio 138g 22h) (3 PR mergiate in 30 g)

Descrizione

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

Guida contributor