Skip to content

Bug: [no-extraneous-import] should allow type imports if @types package is installed #486

@danielrentz

Description

@danielrentz

Environment

Node version: 22.19.0
npm version: 9.8.1
ESLint version: 9.36
eslint-plugin-n version: 17.23.1
Operating System: Win11

What rule do you want to report?

no-extraneous-import

Link to Minimal Reproducible Example

https://stackblitz.com/edit/node-h8zzzzog

What did you expect to happen?

In TS code, no-extraneous-import should allow type imports from module X if @types/X package is installed although X is not.

Example:

> npm install @types/picomatch
import type { Glob } from "picomatch"; // ^^^^^^^^^^^ "picomatch" is extraneous. export type { Glob } from "picomatch"; // ^^^^^^^^^^^ "picomatch" is extraneous.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions