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

Fix ns export when between a default export and exported specifiers. #525

Closed
wants to merge 1 commit into from
Closed

Fix ns export when between a default export and exported specifiers. #525

wants to merge 1 commit into from

Conversation

jdalton
Copy link
Member

@jdalton jdalton commented May 15, 2017

Q A
Bug fix? yes
Breaking change? no
New feature? no
Deprecations? no
Spec compliancy? yes
Tests added/pass? yes
Fixed tickets 127
License MIT

A continuation of #127. I noticed that this will error:

export B, * as A, { C, D } from 'test';

The bit that's throwing it off is the last specifier , { C, D }.

Related to benjamn/reify#162.

@codecov
Copy link

codecov bot commented May 15, 2017

Codecov Report

Merging #525 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #525      +/-   ##
==========================================
+ Coverage   98.27%   98.27%   +<.01%     
==========================================
  Files          22       22              
  Lines        3530     3531       +1     
  Branches      979      979              
==========================================
+ Hits         3469     3470       +1     
  Misses         22       22              
  Partials       39       39
Flag Coverage Δ
#babel 81.05% <100%> (ø) ⬆️
#babylon 97.11% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/parser/statement.js 99.08% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ef964e...d5a6a77. Read the comment docs.

@loganfsmyth
Copy link
Member

My understanding is that this is expected behavior. These proposals essentially add export versions of the existing import forms, and the ES6 spec for import allows one, but not both of {foo as foo} or * as foo.

Note in the grammar: https://www.ecma-international.org/ecma-262/7.0/#sec-imports

ImportClause:
    ImportedDefaultBinding
    NameSpaceImport
    NamedImports
    ImportedDefaultBinding, NameSpaceImport
    ImportedDefaultBinding, NamedImports

@jdalton
Copy link
Member Author

jdalton commented May 15, 2017

Thanks, I'll dig a bit and report back.

Update:

Ok, I've pinged Brian Terlson for insight into the design choice.
This can be closed though since it would be yet another proposal to remove binding order significance.

@jdalton jdalton closed this May 15, 2017
@jdalton jdalton deleted the exp-exports branch May 15, 2017 16:58
@jdalton
Copy link
Member Author

jdalton commented May 16, 2017

Just pinging back I made reify support unordered export and import specifiers.
It simplified the export extension a bit too ⚡️

@loganfsmyth
Copy link
Member

Sounds good. I don't think I'm comfortable landing any changes to this unless there were an official proposal, as you mentioned. I agree it's surprising behavior to me from a grammar definition standpoint, but being that this is the first time I've seen the question raised, I can't imagine it's a case that comes up often.

I think every time I've wanted a namespaced import and a named import, I've been fine to reference it off of the namedspace object instead. To me that says that this issue is more annoying for those writing tooling based around adding imports, since it makes adding imports more complicated, but it doesn't make it harder for day-to-day devs to get their work done.

@jdalton
Copy link
Member Author

jdalton commented May 16, 2017

I don't think I'm comfortable landing any changes to this unless there were an official proposal, as you mentioned.

No worries 😎

I agree it's surprising behavior to me from a grammar definition standpoint, but being that this is the first time I've seen the question raised, I can't imagine it's a case that comes up often.

It's a bit WTFJS so I'm ok smoothing over its rough edge in my neck of the woods.

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.

3 participants