-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't modify imports when they point at a module with no exports (…
…#60) When an import statement point at a file without any exports at all (e.g. a commonjs module), the fix-imports script was viewing it as a file with only named exports (which is vacuously true) and changing the import style to `import *`. This broke cases where a commonjs module exported anything other than an object.
- Loading branch information
1 parent
b260023
commit 58383e1
Showing
6 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
three = require './three' | ||
console.log(three); |
4 changes: 4 additions & 0 deletions
4
test/examples/fix-imports-import-commonjs/ImportThree.js.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// TODO: This file was created by bulk-decaffeinate. | ||
// Sanity-check the conversion and remove this comment. | ||
import three from './three'; | ||
console.log(three); |
5 changes: 5 additions & 0 deletions
5
test/examples/fix-imports-import-commonjs/bulk-decaffeinate.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
fixImportsConfig: { | ||
searchPath: '.', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters