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-duplicates: add an allow-namespace-imports option #1538

Closed
sveyret opened this issue Nov 12, 2019 · 3 comments
Closed

no-duplicates: add an allow-namespace-imports option #1538

sveyret opened this issue Nov 12, 2019 · 3 comments

Comments

@sveyret
Copy link
Contributor

sveyret commented Nov 12, 2019

I would like to migrate from tslint no-duplicate-imports rule, but import/no-duplicates is missing one important option: allow-namespace-imports. This option is required, especially with React because we often need to do such things:

import * as React from 'react';
import { FunctionComponent } from 'react;

In this case, it is a syntax error to put both imports on the same line, but according to the doc, the rule will prevent us from doing that. The allow-namespace-imports allow the import to be done twice on the same module if one of the two imports is a namespace import.

See https://palantir.github.io/tslint/rules/no-duplicate-imports/

@ljharb
Copy link
Member

ljharb commented Dec 5, 2019

That doesn't seem like it should need to be an option; if it's a syntax error to combine them, then it should just allow this case.

@ljharb
Copy link
Member

ljharb commented Dec 5, 2019

a PR with test cases and optionally a fix would be most helpful!

@sveyret
Copy link
Contributor Author

sveyret commented Jan 15, 2020

Hi, I'm currently working on it.

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

No branches or pull requests

2 participants