Skip to content

Commit 9f36d07

Browse files
committed
[Fix] export: do not flag export type * re-exports as duplicate of a value re-export
1 parent 895fd8a commit 9f36d07

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/rules/export.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ module.exports = {
194194
remoteExports.forEach((v, name) => {
195195
if (name !== 'default') {
196196
any = true; // poor man's filter
197-
addNamed(name, node, parent);
197+
addNamed(name, node, parent, node.exportKind === 'type');
198198
}
199199
});
200200

tests/files/export-type-star/m.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface Foo {}
2+
3+
export function f(foo: Foo): void {}

tests/src/rules/export.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, testFilePath, SYNTAX_CASES, getTSParsers, testVersion } from '../utils';
1+
import { test, testFilePath, SYNTAX_CASES, getTSParsers, testVersion, typescriptEslintParserSatisfies } from '../utils';
22

33
import { RuleTester } from '../rule-tester';
44
import eslintPkg from 'eslint/package.json';
@@ -337,6 +337,19 @@ context('TypeScript', function () {
337337
...parserConfig,
338338
}),
339339

340+
// https://github.com/import-js/eslint-plugin-import/issues/3136
341+
// `export type *` re-exports names into the type namespace, so they must
342+
// not be reported as duplicates of a same-named value re-export.
343+
// `export type *` requires a TypeScript 5.0-capable parser.
344+
typescriptEslintParserSatisfies('>= 5.54') ? test({
345+
code: `
346+
export { f } from './m';
347+
export type * from './m';
348+
`,
349+
filename: testFilePath('export-type-star/index.ts'),
350+
...parserConfig,
351+
}) : [],
352+
340353
semver.satisfies(eslintPkg.version, '>= 6') ? [
341354
test({
342355
code: `

0 commit comments

Comments
 (0)