import-js/eslint-plugin-import

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

开放

#1,869 创建于 2020年8月5日

 (6 条评论) (4 个反应) (0 位负责人)JavaScript (1,549 个派生)batch import
bughelp wantedtypescript

仓库指标

星标
 (5,938 个星标)
PR 合并指标
 (平均合并 138天 22小时) (30 天内合并 3 个 PR)

描述

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

贡献者指南