Skip to content

Commit

Permalink
Named exports no longer trigger stdlib imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Oct 21, 2017
1 parent 1328737 commit 9f7065c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/helpers/variables.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,12 @@ export checkFalsePositiveReference(refPath) ->
!parentNode.computed
elif parentNode.type == "FunctionTypeParam":
true
elif parentNode.type == "ExportSpecifier":
// In `export { x } from 'y'`, x is not actually referenced.
parent2 = refPath.parentPath.parentPath.node
if parent2.type == "ExportNamedDeclaration" and parent2.source:
true
else:
false
else:
false
2 changes: 2 additions & 0 deletions test/fixtures/stdlib/export-from/actual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { map }
export { toPlainObject } from 'otherLib'
2 changes: 2 additions & 0 deletions test/fixtures/stdlib/export-from/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import map from 'lodash/map';export { map };
export { toPlainObject } from 'otherLib';

0 comments on commit 9f7065c

Please sign in to comment.