-
-
Notifications
You must be signed in to change notification settings - Fork 258
Check for duplicate named exports in exported destructuring assignments #144
Conversation
da09c40
to
6800abc
Compare
@@ -1,2 +1,11 @@ | |||
export const { rhythm } = typography; | |||
export const { TypographyStyle } = typography; | |||
export const { foo } = bar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all unique identifiers and should parse without error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool was wondering about a passing test 👍
93c3d0d
to
5152905
Compare
@@ -909,23 +909,21 @@ pp.checkExport = function (node, checkNames, isDefault) { | |||
// Check for duplicate exports | |||
if (isDefault) { | |||
// Default exports | |||
this.checkDuplicateExports(node, "default", isDefault); | |||
this.checkDuplicateExports(node, "default"); | |||
} else if (node.specifiers && node.specifiers.length) { | |||
// Named exports | |||
for (let specifier of node.specifiers) { | |||
const name = specifier.exported.name; | |||
if (name === "default") isDefault = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, except one minor nitpick.
Could you also please rebase your changes onto master, because currently travis is not working in this branch, but i fixed it in master.
this.checkDeclaration(elem); | ||
} | ||
} else if (node.type === "ObjectProperty") { | ||
this.checkDeclaration(node.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to much indentation
235398a
to
909b19a
Compare
Updated - thanks! |
Current coverage is 94.44% (diff: 94.11%)@@ master #144 diff @@
==========================================
Files 19 19
Lines 3111 3117 +6
Methods 327 328 +1
Messages 0 0
Branches 818 820 +2
==========================================
+ Hits 2939 2944 +5
Misses 94 94
- Partials 78 79 +1
|
@danez I know we spoke in Slack, but wasn't sure if there is anything I need to do for the failing codecov checks? |
…ts (babel#144) * Check for duplicate named exports in exported destructuring assignments * Refactor duplicate error reporting * Remove unnecessary check
This is a follow-up to #139. I did a little refactoring - passing
isDefault
all the way through seems unnecessary, in retrospect. Thoughts on this approach? Any cases I missed?