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

no-duplicate-imports rule triggered by `import type` statements #599

Closed
Gozala opened this Issue Aug 19, 2016 · 3 comments

Comments

2 participants
@Gozala
Copy link

Gozala commented Aug 19, 2016

Forking #592 to it's separate issue:

Standard uses 'no-duplicate-imports' rule which is triggered if there are two or more import statements from the same module.

It seems that this rule is also triggered for import type Flow statements, e.g. this results in an error:

import { foo } from 'someModule';
import type { Bar } from 'someModule';

There is no other way to combine these two statements into one import statement as flow want's to distinguish type and value imports.

I would really like this issue to be resolved to be able to use standard style with flow typed project.

@Gozala

This comment has been minimized.

Copy link
Author

Gozala commented Aug 19, 2016

Here is a corresponding issue for babel-eslint:
babel/babel-eslint#293

I also have proposed using import/no-duplicates setting instead of stock no-duplicates as former seems to handle this case properly.

This was referenced Aug 19, 2016

Gozala pushed a commit to Gozala/browser.html that referenced this issue Aug 19, 2016

gozala
Setup standard to enforce style on new code
Fixes browserhtml#1240

This change configures eslint on top of [eslint-config-standard](https://github.com/feross/eslint-config-standard) which is then configured to workaround following issues preventing us using from stock standard package:

1. space-infix-ops reports polymorphic functions:
   babel/babel-eslint#366
2. no-duplicate-imports rule triggered by `import type`:
   standard/standard#599

All of the currently tracked fils are also listed under `.eslintignore` so that current code will not be listed until we get to reformat it.

@feross feross added the bug label Aug 19, 2016

@feross

This comment has been minimized.

Copy link
Member

feross commented Aug 19, 2016

You're using two non-standard things: babel and flow type annotations. This is life on the bleeding edge, nothing quite works... 😒

That said, since I'm considering adding eslint-plugin-import in standard v9 (since it potentially catches lots of errors), this should get fixed for free if we use import/no-duplicates instead of no-duplicates.

@feross feross modified the milestone: standard v9 Aug 19, 2016

@feross feross modified the milestones: standard v9, standard v10 Feb 9, 2017

@feross feross modified the milestones: standard v9, standard v10 Feb 9, 2017

sebn added a commit to cozy-labs/cozy-desktop that referenced this issue Feb 12, 2017

build: Replace standard with eslint-config-standard
We could possibly get back to standard once this issue is fixed:
standard/standard#599

Also switched from JSON to YML config format.

@feross feross modified the milestones: standard v9, standard v10 Feb 28, 2017

@feross

This comment has been minimized.

Copy link
Member

feross commented Mar 2, 2017

No ecosystem impact. This will be part of the standard v10 beta.

@feross feross closed this Mar 2, 2017

feross added a commit to standard/eslint-config-standard that referenced this issue Mar 2, 2017

Add `eslint-plugin-import` for `import/no-duplicates` rule
Fixes: standard/standard#599
Fixes: standard/standard#712

`import/no-duplicates` replaces the core rule `no-duplicate-imports`.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.