Skip to content

Fix no-extraneous-import for type-only @types dependencies#533

Merged
aladdin-add merged 1 commit into
eslint-community:masterfrom
sjh9714:fix-no-extraneous-type-only-at-types
Jun 8, 2026
Merged

Fix no-extraneous-import for type-only @types dependencies#533
aladdin-add merged 1 commit into
eslint-community:masterfrom
sjh9714:fix-no-extraneous-type-only-at-types

Conversation

@sjh9714

@sjh9714 sjh9714 commented May 18, 2026

Copy link
Copy Markdown

Summary

Fixes no-extraneous-import for type-only imports backed by @types/* dependencies.

What changed

  • Added regression coverage for import type and export type from a package with only its @types/* package declared.
  • Allowed type-only import/export targets when the matching DefinitelyTyped package is declared.
  • Preserved extraneous reports for runtime imports and exports.

Why

Issue #486 reports that TypeScript type-only imports from packages such as picomatch are reported as extraneous even when @types/picomatch is installed directly.

Testing

  • npm run test:mocha -- tests/lib/rules/no-extraneous-import.js
  • npm run lint
  • npm run test:types
  • npm test
  • git diff --check

Fixes #486

@aladdin-add aladdin-add left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! 💯

@aladdin-add aladdin-add merged commit 63a90ef into eslint-community:master Jun 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants