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

Check duplicates for normal imports and flow type imports separately - #334

Merged
benmosher merged 1 commit into
import-js:masterfrom
sgtpepper43:no-duplicates-ignore-flow-type-imports
May 13, 2016
Merged

benmosher merged 1 commit into
import-js:masterfrom
sgtpepper43:no-duplicates-ignore-flow-type-imports

Conversation

@sgtpepper43

Copy link
Copy Markdown
Contributor

Fix #225

If import is a flow type import, add to separate map for duplicate checking.

@sgtpepper43

Copy link
Copy Markdown
Contributor Author

The travis ci build failed because nvm install 5 timed out. Probably just needs to be restarted.

@benmosher

Copy link
Copy Markdown
Member

Thanks! 😄

@benmosher
benmosher merged commit 2ba7fd5 into import-js:master May 13, 2016
@dmnd

dmnd commented May 13, 2016

Copy link
Copy Markdown
Contributor

Nice, thanks!

@mizchi

mizchi commented Feb 18, 2017

Copy link
Copy Markdown

I encountered alike problem on import/named.

import type { Connector } from 'react-redux'

https://github.com/flowtype/flow-typed/blob/master/definitions/npm/react-redux_v5.x.x/flow_v0.30.x-/react-redux_v5.x.x.js#L33-L36

Connector is just a type on definition file but there is no instance.

@fabiomcosta

Copy link
Copy Markdown

:/
Too bad this wasn't introduced with an option to disable this behavior.
You can import types and other things with the same import with:

import defaultNamed, { named, typed namedType } from './module';

This is fine as the default, but it would be nice to provide an option to keep the previous behavior.

AntonioVentilii added a commit to dfinity/eslint-config-oisy-wallet that referenced this pull request Feb 23, 2026
# Motivation

We can use the eslint rule `no-duplicate-imports` instead of
[no-duplicate](https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md):

> ESLint core has a similar rule
([no-duplicate-imports](https://eslint.org/docs/rules/no-duplicate-imports)),
but this version is different in two key ways:
> 
> 1. the paths in the source code don't have to exactly match, they just
have to point to the same module on the filesystem. (i.e. ./foo and
./foo.js)
> 2. this version distinguishes Flow type imports from standard imports.
(import-js/eslint-plugin-import#334)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

no-duplicates should ignore flow type imports

5 participants