eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

Prefer type imports in `import/no-duplicates`

Open Mrazator opened this issue 7 months ago • 9 comments

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'

Mrazator avatar May 02 '25 11:05 Mrazator