Skip to content

Commit 12f0300

Browse files
Pandemic1617ljharb
authored andcommitted
[Fix] no-extraneous-dependencies: ignore export type { ... } from '...' when includeTypes is false
1 parent 6d34c88 commit 12f0300

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
66

77
## [Unreleased]
88

9+
### Fixed
10+
- [`no-extraneous-dependencies`]: ignore `export type { ... } from '...'` when `includeTypes` is `false` ([#2919], thanks [@Pandemic1617])
11+
912
## [2.29.0] - 2023-10-22
1013

1114
### Added
@@ -1094,6 +1097,7 @@ for info on changes for earlier releases.
10941097

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

1100+
[#2919]: https://github.com/import-js/eslint-plugin-import/pull/2919
10971101
[#2884]: https://github.com/import-js/eslint-plugin-import/pull/2884
10981102
[#2854]: https://github.com/import-js/eslint-plugin-import/pull/2854
10991103
[#2851]: https://github.com/import-js/eslint-plugin-import/pull/2851
@@ -1830,6 +1834,7 @@ for info on changes for earlier releases.
18301834
[@ntdb]: https://github.com/ntdb
18311835
[@nwalters512]: https://github.com/nwalters512
18321836
[@ombene]: https://github.com/ombene
1837+
[@Pandemic1617]: https://github.com/Pandemic1617
18331838
[@ota-meshi]: https://github.com/ota-meshi
18341839
[@OutdatedVersion]: https://github.com/OutdatedVersion
18351840
[@panrafal]: https://github.com/panrafal

src/rules/no-extraneous-dependencies.js

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ function reportIfMissing(context, deps, depsOptions, node, name) {
177177
&& (
178178
node.importKind === 'type'
179179
|| node.importKind === 'typeof'
180+
|| node.exportKind === 'type'
180181
|| Array.isArray(node.specifiers) && node.specifiers.length && node.specifiers.every((specifier) => specifier.importKind === 'type' || specifier.importKind === 'typeof')
181182
)
182183
) {

tests/src/rules/no-extraneous-dependencies.js

+12
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,18 @@ describe('TypeScript', () => {
427427
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
428428
...parserConfig,
429429
}),
430+
431+
test({
432+
code: 'import type { T } from "a"; export type { T };',
433+
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
434+
...parserConfig,
435+
}),
436+
437+
test({
438+
code: 'export type { T } from "a";',
439+
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
440+
...parserConfig,
441+
}),
430442
],
431443
invalid: [
432444
test({

0 commit comments

Comments
 (0)