New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update babel parser options #4688
Conversation
Current coverage is 88.83% (diff: 100%)@@ master #4688 diff @@
==========================================
Files 195 195
Lines 13794 13794
Methods 1427 1427
Messages 0 0
Branches 3176 3176
==========================================
Hits 12254 12254
Misses 1540 1540
Partials 0 0
|
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.
Thanks. I added one comment that I'm not sure about
plugins: [] | ||
allowImportExportEverywhere: this.opts.allowImportExportEverywhere, | ||
allowReturnOutsideFunction: this.opts.allowReturnOutsideFunction, | ||
allowSuperOutsideMethod: this.opts.allowSuperOutsideMethod, |
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.
did you try if you can set this options? I think that the OptionsManager would throw an Error when trying to set these options in e.g babel.transform(code, { allowImportExportEverywhere: true })
because it does not know the options. So maybe we should only set sourceType
, sourceFilename
and plugins
here because the rest of the options could now be set via the new parserOpts
option anyway. https://github.com/babel/babel/blob/master/CHANGELOG.md#rocket-new-feature-1
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.
Same also applies for the strictMode I think.
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.
You're right, not sure why I thought it worked before. Updated!
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.
Yep I was going to mention that too - if there are invalid might as well not use them and get everyone to use parserOpts
instead
a8c9c3b
to
5652509
Compare
5652509
to
cbb25a7
Compare
sourceType?: "module" | "script"; | ||
filename?: string; | ||
features?: Object; | ||
plugins?: Object; |
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.
I guess plugins is an Array here - Array<Object>
?
* Update babel parser options
Should we also support
strictMode
(noted as TODO in https://github.com/babel/babylon/blob/master/src/options.js#L27)?