import-js/eslint-plugin-import

Suggestion [`no-named-default`]: add option to allow type imports with multiple imports

Offen

#1.869 geöffnet am 05.08.2020

 (6 Kommentare) (4 Reaktionen) (0 zugewiesene Personen)JavaScript (1.549 Forks)batch import
bughelp wantedtypescript

Repository-Metriken

Stars
 (5.940 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 138T 22h) (3 gemergte PRs in 30 T)

Beschreibung

Typescript's import type cannot be used to import the default export and named exports without using default as:

import type Foo, {Bar} from 'foo'
// A type-only import can specify a default import or named bindings, but not both.

However, these both work but trigger no-duplicates and no-named-default respectively:

import type Foo from 'foo'
import type {Bar} from 'foo'
import type {default as Foo, Bar} from 'foo'

Could there be a new option to no-named-default that allows type imports with multiple imports? For example:

import type {default as Foo} from 'foo' // lint warning
import type {default as Foo, Bar} from 'foo' // fine

Contributor Guide