Eslint-plugin-import: no-duplicates: add an allow-namespace-imports option

Created on 12 Nov 2019  路  3Comments  路  Source: benmosher/eslint-plugin-import

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/

help wanted

All 3 comments

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.

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

Hi, I'm currently working on it.

Was this page helpful?
0 / 5 - 0 ratings