Skip to content

Prefer type imports in import/no-duplicates #3185

Open
@Mrazator

Description

@Mrazator

It's possible to auto-fix detected duplicated import types as inline types with import/no-duplicates ("prefer-inline": true), but it's not possible to keep type imports as they are.

Therefore, import/no-duplicate should be extended to prefer type imports when fixing duplicates

❌ Invalid ["error", {"prefer-type-imports": true}]

import { AValue, type AType, type BType } from './mama-mia'

import { CValue, type CType } from './papa-mia'

✅ Valid with ["error", {"prefer-type-imports": true}]

import { AValue, } from './mama-mia'
import type { AType , BType } from './mama-mia'

import { CValue } from './papa-mia'
import type { CType } from './papa-mia'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions