From 033ba646c63b31feac2896d5c311a37aecd88405 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 24 Aug 2021 15:30:04 -0700 Subject: [PATCH] [Fix] `named`, `namespace`: properly handle ExportAllDeclarations Fixes #2199 --- CHANGELOG.md | 4 ++++ src/ExportMap.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59bcfb4be..b1bbaffd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ## [Unreleased] +### Fixes +- [`named`], [`namespace`]: properly handle ExportAllDeclarations ([#2199], thanks [@ljharb]) + ## [2.24.1] - 2021-08-19 ### Fixed @@ -1152,6 +1155,7 @@ for info on changes for earlier releases. [#164]: https://github.com/import-js/eslint-plugin-import/pull/164 [#157]: https://github.com/import-js/eslint-plugin-import/pull/157 [#2201]: https://github.com/import-js/eslint-plugin-import/issues/2201 +[#2199]: https://github.com/import-js/eslint-plugin-import/issues/2199 [#2161]: https://github.com/import-js/eslint-plugin-import/issues/2161 [#2118]: https://github.com/import-js/eslint-plugin-import/issues/2118 [#2067]: https://github.com/import-js/eslint-plugin-import/issues/2067 diff --git a/src/ExportMap.js b/src/ExportMap.js index f49841835..5bda83dd3 100644 --- a/src/ExportMap.js +++ b/src/ExportMap.js @@ -421,7 +421,7 @@ ExportMap.parse = function (path, content, context) { switch (s.type) { case 'ExportDefaultSpecifier': - if (!n.source) return; + if (!nsource) return; local = 'default'; break; case 'ExportNamespaceSpecifier': @@ -430,8 +430,8 @@ ExportMap.parse = function (path, content, context) { })); return; case 'ExportAllDeclaration': - local = s.exported ? s.exported.name : s.local.name; - break; + m.namespace.set(s.exported.name, addNamespace(exportMeta, s.source.value)); + return; case 'ExportSpecifier': if (!n.source) { m.namespace.set(s.exported.name, addNamespace(exportMeta, s.local));