import-js/eslint-plugin-import

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

Open

#1 869 ouverte le 5 août 2020

Voir sur GitHub
 (6 commentaires) (4 réactions) (0 assignés)JavaScript (1 540 forks)batch import
bughelp wantedtypescript

Métriques du dépôt

Stars
 (4 946 stars)
Métriques de merge PR
 (Merge moyen 5j 21h) (9 PRs mergées en 30 j)

Description

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

Guide contributeur