Sitelet https://github.com/import-js/eslint-plugin-import/pull/1983
Skip to content

[Fix] no-named-default: ignore Flow import type and typeof - #1983

Merged
ljharb merged 1 commit into
import-js:masterfrom
christianvuerings:no-named-default-flow
Feb 1, 2021
Merged

ljharb merged 1 commit into
import-js:masterfrom
christianvuerings:no-named-default-flow

Conversation

@christianvuerings

Copy link
Copy Markdown
Contributor

Description

Syncs the behavior of no-named-default with named, which also ignores Flow imports & exports:

Note that type imports and exports, as used by [Flow], are always ignored.

Without this fix, no-named-default conflicts with the flowtype/type-import-style rule with a default setting of "identifier".

Issue

"Identifier syntax":

// @flow
import { type default as Foo } from "./bar";

Gives following error:

2:15  error    Use default import syntax to import './bar'.       import/no-named-default

Whilst the "declaration syntax":

// @flow
import type Foo from './bar';

Generates no error.

Related PRs / Issues

@coveralls

coveralls commented Feb 1, 2021 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.9%) to 71.388% when pulling 4c92c47 on christianvuerings:no-named-default-flow into a45661b on benmosher:master.

@ljharb ljharb added the flow label Feb 1, 2021

@ljharb ljharb left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, thanks!

(btw, nice work on getting the changelog, tests, and commit message conventions nearly perfect on your first PR!)

@ljharb
ljharb force-pushed the no-named-default-flow branch from 3f171f7 to 4c92c47 Compare February 1, 2021 16:46
@ljharb ljharb changed the title [fix] no-named-default: ignore Flow import type and typeof [Fix] no-named-default: ignore Flow import type and typeof Feb 1, 2021
@ljharb
ljharb merged commit 4c92c47 into import-js:master Feb 1, 2021
@christianvuerings

Copy link
Copy Markdown
Contributor Author

@ljharb Thanks for the quick merge!

Do you know when we could release the next version of eslint-plugin-import? We would love to use this fix in our codebase and avoid pulling in a specific commit.

@ljharb

ljharb commented Feb 1, 2021

Copy link
Copy Markdown
Member

@christianvuerings there's no planned timeline. generally it's a few months between releases, so we're coming due for one.

@christianvuerings
christianvuerings deleted the no-named-default-flow branch February 2, 2021 19:39
@christianvuerings

Copy link
Copy Markdown
Contributor Author

@christianvuerings there's no planned timeline. generally it's a few months between releases, so we're coming due for one.

@ljharb should I follow the steps in RELEASE.md to get a release cut? I can do everything until step 4.

@ljharb

ljharb commented Apr 19, 2021

Copy link
Copy Markdown
Member

@christianvuerings no, master’s broken right now. See #1986.

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

Labels

Development

Successfully merging this pull request may close these issues.

3 participants