Skip to content

import/named doesn't ignore Flow identifier syntax type import #1115

Closed
@zeorin

Description

"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?

Activity

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions