Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

christianvuerings
Copy link
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
Copy link

coveralls commented Feb 1, 2021

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
Copy link
Member

@ljharb ljharb left a comment

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 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
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
Copy link
Member

ljharb commented Feb 1, 2021

@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
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
Copy link
Member

ljharb commented Apr 19, 2021

@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