Eslint-plugin-import: import/named doesn't ignore Flow identifier syntax type import

Created on 6 Jun 2018  路  1Comment  路  Source: benmosher/eslint-plugin-import

"Identifier syntax":

// @flow
import { type Dispatch } from 'redux';

Gives following error:

2:15  error    Dispatch not found in 'redux'        import/named

Whilst the "declaration syntax":

// @flow
import type { Dispatch } from 'redux';

Generates no error.

This is especially annoying for users that use the flowtype/type-import-style rule with the default setting ("identifier") and run ESLint with --fix, since that rule will automatically change the syntax, which then triggers import/named.

The point of the identifier syntax is to combine type and value imports in the same statement, e.g.

// @flow
import { configureStore, type Dispatch } from 'redux';

The docs for this rule state:

Note that type imports, as used by Flow, are always ignored.

So I think this is a bug. Can we ignore the identifier syntax for this rule also?

enhancement flow help wanted

Most helpful comment

Fixed in PR #1117

>All comments

Fixed in PR #1117

Was this page helpful?
0 / 5 - 0 ratings