Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] no-extraneous-dependencies: ignore export type { ... } from '...' when includeTypes is false #2919

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## [Unreleased]

### Fixed
- [`no-extraneous-dependencies`]: ignore `export type { ... } from '...'` when `includeTypes` is `false` ([#2919], thanks [@Pandemic1617])

## [2.29.0] - 2023-10-22

### Added
Expand Down Expand Up @@ -1094,6 +1097,7 @@ for info on changes for earlier releases.

[`memo-parser`]: ./memo-parser/README.md

[#2919]: https://github.com/import-js/eslint-plugin-import/pull/2919
[#2884]: https://github.com/import-js/eslint-plugin-import/pull/2884
[#2854]: https://github.com/import-js/eslint-plugin-import/pull/2854
[#2851]: https://github.com/import-js/eslint-plugin-import/pull/2851
Expand Down Expand Up @@ -1830,6 +1834,7 @@ for info on changes for earlier releases.
[@ntdb]: https://github.com/ntdb
[@nwalters512]: https://github.com/nwalters512
[@ombene]: https://github.com/ombene
[@Pandemic1617]: https://github.com/Pandemic1617
[@ota-meshi]: https://github.com/ota-meshi
[@OutdatedVersion]: https://github.com/OutdatedVersion
[@panrafal]: https://github.com/panrafal
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-extraneous-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function reportIfMissing(context, deps, depsOptions, node, name) {
&& (
node.importKind === 'type'
|| node.importKind === 'typeof'
|| node.exportKind === 'type'
|| Array.isArray(node.specifiers) && node.specifiers.length && node.specifiers.every((specifier) => specifier.importKind === 'type' || specifier.importKind === 'typeof')
)
) {
Expand Down
12 changes: 12 additions & 0 deletions tests/src/rules/no-extraneous-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,18 @@ describe('TypeScript', () => {
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
...parserConfig,
}),

test({
code: 'import type { T } from "a"; export type { T };',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
...parserConfig,
}),

test({
code: 'export type { T } from "a";',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
...parserConfig,
}),
],
invalid: [
test({
Expand Down