export: handle type-only star re-exports separately#3260
Conversation
…f a value re-export
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes false-positive duplicate export reports when a value export and export type * re-export expose the same name (TypeScript), aligning behavior with the TypeScript type/value namespace separation.
Changes:
- Treat
export type *re-exports as type-namespace entries when recording named exports. - Add a TypeScript test case (and fixture module) covering
export { f }alongsideexport type *. - Document the fix in the changelog and link the tracked issue.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/src/rules/export.js | Adds a TS regression test for export type * + value re-export, guarded by parser capability. |
| tests/files/export-type-star/m.ts | Adds a fixture module used by the new regression test. |
| src/rules/export.js | Records remote export names with type/value distinction for export type *. |
| CHANGELOG.md | Notes the fix and adds issue/author references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // `export type *` requires a TypeScript 5.0-capable parser. | ||
| typescriptEslintParserSatisfies('>= 5.54') ? test({ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3260 +/- ##
==========================================
+ Coverage 95.45% 95.86% +0.41%
==========================================
Files 83 83
Lines 3737 3774 +37
Branches 1352 1374 +22
==========================================
+ Hits 3567 3618 +51
+ Misses 170 156 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…f a value re-export
Handle `export type { x }` (declaration `exportKind`) and `export { type x }` (specifier `exportKind`) the same way `export type *` is,
routing the name into the type namespace so it does not collide with a same-named value re-export.
be687ef to
e909363
Compare
|
Closing this — it's picked up conflicts with |
Problem I saw:
The
exportrule could report a duplicate export when a value export and a type-only star re-export exposed the same name.One small shape that hit it was:
export { f } from './m'
export type * from './m'
That should not collide, since the second export is type-only. Thanks @mykola-mokhnach for the report.
What I changed:
I passed the
ExportAllDeclarationexport kind through to the named export tracking.That keeps plain
export *in the value side, but putsexport type *in the type side.How I checked it:
The focused regression test failed before the fix and passed after it.
I also ran:
npm run mocha -- tests/src/rules/export.js
npm run tests-only
ESLint was clean on the changed files.
Closes #3136