Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Check for duplicate named exports in exported destructuring assignments #144

Merged
merged 3 commits into from
Oct 4, 2016

Conversation

kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented Sep 24, 2016

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?

@kaicataldo kaicataldo force-pushed the check-destructured-exports branch 2 times, most recently from da09c40 to 6800abc Compare September 24, 2016 20:08
@@ -1,2 +1,11 @@
export const { rhythm } = typography;
export const { TypographyStyle } = typography;
export const { foo } = bar;
Copy link
Member Author

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

Copy link
Member

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 👍

@@ -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;
Copy link
Member

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.

Copy link
Member

@danez danez left a 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to much indentation

@kaicataldo
Copy link
Member Author

Updated - thanks!

@codecov-io
Copy link

codecov-io commented Sep 26, 2016

Current coverage is 94.44% (diff: 94.11%)

Merging #144 into master will decrease coverage by 0.02%

@@             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   

Powered by Codecov. Last update 4115bcb...909b19a

@kaicataldo
Copy link
Member Author

@danez I know we spoke in Slack, but wasn't sure if there is anything I need to do for the failing codecov checks?

@danez danez merged commit 76e6927 into babel:master Oct 4, 2016
@kaicataldo kaicataldo deleted the check-destructured-exports branch October 4, 2016 14:26
kristofdegrave pushed a commit to kristofdegrave/babylon that referenced this pull request Oct 27, 2016
…ts (babel#144)

* Check for duplicate named exports in exported destructuring assignments

* Refactor duplicate error reporting

* Remove unnecessary check
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants